com.eurotech.framework.core.cloud
Class CloudServiceImpl

java.lang.Object
  extended by com.eurotech.framework.core.cloud.CloudServiceImpl
All Implemented Interfaces:
CloudService, ConfigurableComponent, DataServiceListener, org.osgi.service.event.EventHandler

public class CloudServiceImpl
extends Object
implements CloudService, DataServiceListener, ConfigurableComponent, org.osgi.service.event.EventHandler


Constructor Summary
CloudServiceImpl()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext componentContext, Map<String,Object> properties)
           
protected  void deactivate(org.osgi.service.component.ComponentContext componentContext)
           
 String[] getCloudApplicationIdentifiers()
          Returns the application identifiers for which a CloudClient instance was created.
 CloudServiceOptions getCloudServiceOptions()
           
 DataService getDataService()
           
 NetworkService getNetworkService()
           
 PositionService getPositionService()
           
 SystemAdminService getSystemAdminService()
           
 SystemService getSystemService()
           
 void handleEvent(org.osgi.service.event.Event event)
           
 boolean isConnected()
          Returns true if the underlying DataService is currently connected to the remote server.
 CloudClient newCloudClient(String applicationId)
          Returns a new instance of the CloudClient for the given application Id.
 void onConnectionEstablished()
          Notifies that the DataService has established a connection.
 void onConnectionLost(Throwable cause)
          Notifies that the DataService has unexpectedly disconnected.
 void onDisconnected()
          Notifies that the DataService has cleanly disconnected.
 void onDisconnecting()
          Notifies that the DataService is about to cleanly disconnect.
 void onMessageArrived(String topic, byte[] payload, int qos, boolean retained)
          Notifies a message arrival.
 void onMessageConfirmed(int messageId, String topic)
          Confirms message delivery to the broker.
 void onMessagePublished(int messageId, String topic)
          Notifies the a message has been published.
 void removeCloudClient(CloudClientImpl cloudClient)
           
 void setDataService(DataService dataService)
           
 void setEventAdmin(org.osgi.service.event.EventAdmin eventAdmin)
           
 void setNetworkService(NetworkService networkService)
           
 void setPositionService(PositionService positionService)
           
 void setSystemAdminService(SystemAdminService systemAdminService)
           
 void setSystemService(SystemService systemService)
           
 void unsetDataService(DataService dataService)
           
 void unsetEventAdmin(org.osgi.service.event.EventAdmin eventAdmin)
           
 void unsetNetworkService(NetworkService networkService)
           
 void unsetPositionService(PositionService positionService)
           
 void unsetSystemAdminService(SystemAdminService systemAdminService)
           
 void unsetSystemService(SystemService systemService)
           
 void updated(Map<String,Object> properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloudServiceImpl

public CloudServiceImpl()
Method Detail

setDataService

public void setDataService(DataService dataService)

unsetDataService

public void unsetDataService(DataService dataService)

getDataService

public DataService getDataService()

setSystemAdminService

public void setSystemAdminService(SystemAdminService systemAdminService)

unsetSystemAdminService

public void unsetSystemAdminService(SystemAdminService systemAdminService)

getSystemAdminService

public SystemAdminService getSystemAdminService()

setSystemService

public void setSystemService(SystemService systemService)

unsetSystemService

public void unsetSystemService(SystemService systemService)

getSystemService

public SystemService getSystemService()

setNetworkService

public void setNetworkService(NetworkService networkService)

unsetNetworkService

public void unsetNetworkService(NetworkService networkService)

getNetworkService

public NetworkService getNetworkService()

setPositionService

public void setPositionService(PositionService positionService)

unsetPositionService

public void unsetPositionService(PositionService positionService)

getPositionService

public PositionService getPositionService()

setEventAdmin

public void setEventAdmin(org.osgi.service.event.EventAdmin eventAdmin)

unsetEventAdmin

public void unsetEventAdmin(org.osgi.service.event.EventAdmin eventAdmin)

activate

protected void activate(org.osgi.service.component.ComponentContext componentContext,
                        Map<String,Object> properties)

updated

public void updated(Map<String,Object> properties)

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext componentContext)

handleEvent

public void handleEvent(org.osgi.service.event.Event event)
Specified by:
handleEvent in interface org.osgi.service.event.EventHandler

newCloudClient

public CloudClient newCloudClient(String applicationId)
                           throws EsfException
Description copied from interface: CloudService
Returns a new instance of the CloudClient for the given application Id. The CloudClient is designed to be used by single application bundles. CloudClient instances are acquired from the CloudService and they are released when the work is completed. Generally, a CloudClient is acquired during the activation phase of a bundle and it is released through the CloudClient.release() method during the bundle deactivation phase.
CloudClient will clean-up the subscriptions and the callback registrations when the CloudClient.release() method is called.
If the bundle using the CloudClient relies on subscriptions, it is responsibility of the application to implement the CloudClientListener#connectionRestored callback method in the CloudCallbackHandler to restore the subscriptions it needs.

Specified by:
newCloudClient in interface CloudService
Parameters:
applicationId - A String object specifying a unique application ID.
Returns:
CloudClient instance
Throws:
EsfException

getCloudApplicationIdentifiers

public String[] getCloudApplicationIdentifiers()
Description copied from interface: CloudService
Returns the application identifiers for which a CloudClient instance was created.

Specified by:
getCloudApplicationIdentifiers in interface CloudService
Returns:
An array of application identifiers

isConnected

public boolean isConnected()
Description copied from interface: CloudService
Returns true if the underlying DataService is currently connected to the remote server.

Specified by:
isConnected in interface CloudService
Returns:

getCloudServiceOptions

public CloudServiceOptions getCloudServiceOptions()

removeCloudClient

public void removeCloudClient(CloudClientImpl cloudClient)

onConnectionEstablished

public void onConnectionEstablished()
Description copied from interface: DataServiceListener
Notifies that the DataService has established a connection.

Specified by:
onConnectionEstablished in interface DataServiceListener

onDisconnecting

public void onDisconnecting()
Description copied from interface: DataServiceListener
Notifies that the DataService is about to cleanly disconnect. If something needs to be done in reaction to this event, e.g. publishing a special last message, it SHOULD be done before the method returns. As soon as the method returns the DataService will start disconnecting.

Specified by:
onDisconnecting in interface DataServiceListener

onDisconnected

public void onDisconnected()
Description copied from interface: DataServiceListener
Notifies that the DataService has cleanly disconnected.

Specified by:
onDisconnected in interface DataServiceListener

onConnectionLost

public void onConnectionLost(Throwable cause)
Description copied from interface: DataServiceListener
Notifies that the DataService has unexpectedly disconnected.

Specified by:
onConnectionLost in interface DataServiceListener

onMessageArrived

public void onMessageArrived(String topic,
                             byte[] payload,
                             int qos,
                             boolean retained)
Description copied from interface: DataServiceListener
Notifies a message arrival.

Specified by:
onMessageArrived in interface DataServiceListener

onMessagePublished

public void onMessagePublished(int messageId,
                               String topic)
Description copied from interface: DataServiceListener
Notifies the a message has been published. There is no guarantee the message has been actually transmitted over the wire or that it eventually will. The only guarantee is that message byte have been passed to the underlying OS.

Specified by:
onMessagePublished in interface DataServiceListener

onMessageConfirmed

public void onMessageConfirmed(int messageId,
                               String topic)
Description copied from interface: DataServiceListener
Confirms message delivery to the broker.

Specified by:
onMessageConfirmed in interface DataServiceListener


Copyright © 2013. All Rights Reserved.