com.eurotech.framework.core.deployment
Class CloudDeploymentHandler

java.lang.Object
  extended by com.eurotech.framework.core.deployment.CloudDeploymentHandler
All Implemented Interfaces:
CloudClientListener, org.osgi.service.event.EventHandler

public class CloudDeploymentHandler
extends Object
implements org.osgi.service.event.EventHandler, CloudClientListener


Field Summary
static String APP_ID
           
static String METRIC_INSTALL_COMMAND_FILENAME
           
static String METRIC_INSTALL_COMMAND_URL
           
static String METRIC_INSTALL_REPLY_PKG_NAME
           
static String METRIC_INSTALL_REPLY_PKG_VERSION
           
static String RESOURCE_BUNDLES
           
static String RESOURCE_INSTALL
           
static String RESOURCE_PACKAGES
           
static String RESOURCE_START
           
static String RESOURCE_STOP
           
static String RESOURCE_UNINSTALL
           
 
Constructor Summary
CloudDeploymentHandler()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext componentContext)
           
protected  void deactivate(org.osgi.service.component.ComponentContext componentContext)
           
 void handleEvent(org.osgi.service.event.Event event)
           
 void onConnectionEstablished()
          Called when the CloudClient has successfully connected with the broker.
 void onConnectionLost()
          Called when the client has lost its connection with the broker.
 void onControlMessageArrived(String deviceId, String appTopic, EsfPayload msg, int qos, boolean retain)
          Called by the CloudClient when it receives a published control message from the broker.
 void onMessageArrived(String deviceId, String appTopic, EsfPayload msg, int qos, boolean retain)
          Called by the client when it receives a published data message from the broker.
 void onMessageConfirmed(int messageId, String topic)
          Called by the CloudClient when a published message has been fully acknowledged by the broker, as appropriate for the quality of service.
 void onMessagePublished(int messageId, String topic)
          Called by the CloudClient when a message has been transfered from the publishing queue to the underlying DataTransportService for publishing on the wire.
protected  void setCloudService(CloudService cloudService)
           
protected  void setDeploymentAdmin(org.osgi.service.deploymentadmin.DeploymentAdmin deploymentAdmin)
           
protected  void setDeploymentAgentService(DeploymentAgentService deploymentAgentService)
           
 void setSystemService(SystemService systemService)
           
protected  void unsetCloudService(CloudService cloudService)
           
protected  void unsetDeploymentAdmin(org.osgi.service.deploymentadmin.DeploymentAdmin deploymentAdmin)
           
protected  void unsetDeploymentAgentService(DeploymentAgentService deploymentAgentService)
           
 void unsetSystemService(SystemService systemService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_ID

public static final String APP_ID
See Also:
Constant Field Values

RESOURCE_PACKAGES

public static final String RESOURCE_PACKAGES
See Also:
Constant Field Values

RESOURCE_BUNDLES

public static final String RESOURCE_BUNDLES
See Also:
Constant Field Values

RESOURCE_INSTALL

public static final String RESOURCE_INSTALL
See Also:
Constant Field Values

RESOURCE_UNINSTALL

public static final String RESOURCE_UNINSTALL
See Also:
Constant Field Values

RESOURCE_START

public static final String RESOURCE_START
See Also:
Constant Field Values

RESOURCE_STOP

public static final String RESOURCE_STOP
See Also:
Constant Field Values

METRIC_INSTALL_COMMAND_URL

public static final String METRIC_INSTALL_COMMAND_URL
See Also:
Constant Field Values

METRIC_INSTALL_COMMAND_FILENAME

public static final String METRIC_INSTALL_COMMAND_FILENAME
See Also:
Constant Field Values

METRIC_INSTALL_REPLY_PKG_NAME

public static final String METRIC_INSTALL_REPLY_PKG_NAME
See Also:
Constant Field Values

METRIC_INSTALL_REPLY_PKG_VERSION

public static final String METRIC_INSTALL_REPLY_PKG_VERSION
See Also:
Constant Field Values
Constructor Detail

CloudDeploymentHandler

public CloudDeploymentHandler()
Method Detail

setCloudService

protected void setCloudService(CloudService cloudService)

unsetCloudService

protected void unsetCloudService(CloudService cloudService)

setDeploymentAdmin

protected void setDeploymentAdmin(org.osgi.service.deploymentadmin.DeploymentAdmin deploymentAdmin)

unsetDeploymentAdmin

protected void unsetDeploymentAdmin(org.osgi.service.deploymentadmin.DeploymentAdmin deploymentAdmin)

setDeploymentAgentService

protected void setDeploymentAgentService(DeploymentAgentService deploymentAgentService)

unsetDeploymentAgentService

protected void unsetDeploymentAgentService(DeploymentAgentService deploymentAgentService)

setSystemService

public void setSystemService(SystemService systemService)

unsetSystemService

public void unsetSystemService(SystemService systemService)

activate

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

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

onControlMessageArrived

public void onControlMessageArrived(String deviceId,
                                    String appTopic,
                                    EsfPayload msg,
                                    int qos,
                                    boolean retain)
Description copied from interface: CloudClientListener
Called by the CloudClient when it receives a published control message from the broker. If the message received has a binary payload that it has NOT been encoded using the the EsfPayload class, the received bytes will be set as the body field of a new EsfPaylaod instance which is passed to the callback Listener interface.

Specified by:
onControlMessageArrived in interface CloudClientListener
Parameters:
deviceId - The deviceId this message was addressed to.
appTopic - The appTopic the message arrived on.
msg - The EsfPayload that arrived.
qos - The Quality of Service that the message was received on.
retain - Whether the message was retained by the broker.

onMessageArrived

public void onMessageArrived(String deviceId,
                             String appTopic,
                             EsfPayload msg,
                             int qos,
                             boolean retain)
Description copied from interface: CloudClientListener
Called by the client when it receives a published data message from the broker. If the message received has a binary payload that it has NOT been encoded using the the EsfPayload class, the received bytes will be set as the body field of a new EsfPaylaod instance which is passed to the callback Listener interface.

Specified by:
onMessageArrived in interface CloudClientListener
Parameters:
deviceId - The asset ID of the semanticTopic prefix the message arrived on.
appTopic - The appTopic the message arrived on.
msg - The EsfPayload that arrived.
qos - The Quality of Service that the message was received on.
retain - Whether the message was retained by the broker.

onConnectionLost

public void onConnectionLost()
Description copied from interface: CloudClientListener
Called when the client has lost its connection with the broker. Depending on the DataService configuration, the client will attempt to reconnect and call the CloudClientListener.onConnectionEstablished() method upon a successful reconnect. This is only a notification, the callback handler should not attempt to handle the reconnect.
If the bundle using the client relies on subscriptions beyond the default ones, it is responsibility of the application to implement the CloudClientListener.onConnectionEstablished() callback method to restore the subscriptions it needs after a connection loss.

Specified by:
onConnectionLost in interface CloudClientListener

onConnectionEstablished

public void onConnectionEstablished()
Description copied from interface: CloudClientListener
Called when the CloudClient has successfully connected with the broker.
If the bundle using the client relies on subscriptions beyond the default ones, it is responsibility of the application to implement the CloudClientListener.onConnectionEstablished() callback method to restore the subscriptions it needs after a connection loss.

Specified by:
onConnectionEstablished in interface CloudClientListener

onMessagePublished

public void onMessagePublished(int messageId,
                               String topic)
Description copied from interface: CloudClientListener
Called by the CloudClient when a message has been transfered from the publishing queue to the underlying DataTransportService for publishing on the wire.

Specified by:
onMessagePublished in interface CloudClientListener

onMessageConfirmed

public void onMessageConfirmed(int messageId,
                               String topic)
Description copied from interface: CloudClientListener
Called by the CloudClient when a published message has been fully acknowledged by the broker, as appropriate for the quality of service. The published method is not called for QoS 0 publications.

Specified by:
onMessageConfirmed in interface CloudClientListener
Parameters:
messageId - The message id of the published message


Copyright © 2013. All Rights Reserved.