org.objectweb.dsrg.sofa.deployment
Class DeploymentDockImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.objectweb.dsrg.sofa.deployment.DeploymentDockImpl
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, DeploymentDock, DeploymentDockRegistryClient

public class DeploymentDockImpl
extends java.rmi.server.UnicastRemoteObject
implements DeploymentDock, DeploymentDockRegistryClient

The main Deployment Dock implementation.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Method Summary
protected  void closeOSGi(org.objectweb.dsrg.sofa.deployment.DeploymentDockImpl.ComponentInfo info)
          Stop provided OSGi services by given component and stop tracking for required services.
 java.util.List<Capability> getCapabilities()
          Returns a list of capabilities of the dock.
 Capability getCapability(java.lang.String name)
          Returns a capability with the given name.
static org.eclipse.emf.common.util.EList<Property> getComponentProperties(Architecture arch, Frame frm)
          Returns an EList of properties of the given Architecture which implements the Frame frm.
 java.lang.String getName()
          Returns the name of the deployment dock.
 java.util.List<ComponentHandle> getRunningApplications()
          Gets the names of all applications running in this Deployment Dock.
 java.util.List<ComponentHandle> getRunningComponents()
          Gets the names of all components running in this Deployment Dock.
protected  void initOSGi(org.objectweb.dsrg.sofa.deployment.DeploymentDockImpl.ComponentInfo info)
          Initialize service tracker and provided services for given component.
 ComponentHandle instantiateComponent(org.objectweb.dsrg.sofa.deployment.DeploymentDescripton desc, java.lang.String hierarchicalName, ComponentHandle parent, java.util.List<org.objectweb.dsrg.sofa.deployment.ConnectorUnitTemplate> cuTemplates)
          Instantiates a component with a given name in the given Deployment Plan
 java.lang.Object instantiateDynamicComponent(java.lang.String factoryInstanceName, int dynamicInstanceIndex, java.lang.String interfaceName, java.lang.String dynamicID, java.lang.String appID)
          Instantiates a dynamic component from a factory with a given name.
 boolean isAlive()
          Checks if this Deployment Dock is running.
 ComponentHandle launchApplication(java.lang.String dpName, java.lang.String dpVersion)
          Launches an application specified by name and version of a Deployment Plan
 ComponentHandle launchApplication(java.lang.String dpName, java.lang.String dpVersion, java.lang.String dpTag)
          Launches an application specified by name and version/tag of a Deployment Plan.
 ComponentHandle lookup(java.lang.String name)
          Gets a reference to a component with a given identifier
 ComponentHandle lookup(java.lang.String appID, java.lang.String name)
          Gets a reference to a component identified by name of the containing application and hierarchical name of the component.
 void notifyDeploymentFailed(java.lang.String appID)
          Notifies DeploymentDock that application deplyment failed.
 void notifyDeploymentSuccessfull(java.lang.String appID)
          Notifies DeploymentDock that the application was succefully deployed.
 void removeApplicationComponents(java.lang.String componentID)
           
protected  void setComponentProperties(SOFAParametrized component, InstanceDeploymentDescription idd)
          Passes the properties described in the InstanceDeploymentDescription with their values to the component.
 void shutdownApplication(java.lang.String componentID)
          Shuts down the application identified by the component instance ID.
 void startComponent(java.lang.String componentId)
          Starts a component on this dock.
 void stopComponent(java.lang.String componentId)
          Stops component on this dock.
 boolean unregister()
          Unregisters this deployment dock from deployment dock registry.
 ComponentHandle updateComponent(java.lang.String componentID, java.lang.String archName, java.lang.String archVersion)
          Updates the component with another implementation.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

unregister

public boolean unregister()
                   throws java.rmi.RemoteException
Unregisters this deployment dock from deployment dock registry.

Specified by:
unregister in interface DeploymentDockRegistryClient
Returns:
Result of the unregistration process
Throws:
java.rmi.RemoteException

launchApplication

public ComponentHandle launchApplication(java.lang.String dpName,
                                         java.lang.String dpVersion)
                                  throws java.rmi.RemoteException,
                                         DeploymentErrorException
Description copied from interface: DeploymentDock
Launches an application specified by name and version of a Deployment Plan

Specified by:
launchApplication in interface DeploymentDock
Parameters:
dpName - Name of the Deployment Plan to start with
dpVersion - The version of the Deployment Plan
Returns:
Handle to the top-level component of the launched application.
Throws:
java.rmi.RemoteException
DeploymentErrorException

launchApplication

public ComponentHandle launchApplication(java.lang.String dpName,
                                         java.lang.String dpVersion,
                                         java.lang.String dpTag)
                                  throws java.rmi.RemoteException,
                                         DeploymentErrorException
Description copied from interface: DeploymentDock
Launches an application specified by name and version/tag of a Deployment Plan. To leave version or tag unspecified, simply pass null, but at least one of them must be specified.

Specified by:
launchApplication in interface DeploymentDock
Parameters:
dpName - Name of the Deployment Plan to start with
dpVersion - The version of the Deployment Plan
dpTag - The tag of the Deployment Plan
Returns:
Handle to the top-level component of the launched application.
Throws:
java.rmi.RemoteException
DeploymentErrorException

getComponentProperties

public static org.eclipse.emf.common.util.EList<Property> getComponentProperties(Architecture arch,
                                                                                 Frame frm)
Returns an EList of properties of the given Architecture which implements the Frame frm.


setComponentProperties

protected void setComponentProperties(SOFAParametrized component,
                                      InstanceDeploymentDescription idd)
Passes the properties described in the InstanceDeploymentDescription with their values to the component.


instantiateComponent

public ComponentHandle instantiateComponent(org.objectweb.dsrg.sofa.deployment.DeploymentDescripton desc,
                                            java.lang.String hierarchicalName,
                                            ComponentHandle parent,
                                            java.util.List<org.objectweb.dsrg.sofa.deployment.ConnectorUnitTemplate> cuTemplates)
                                     throws java.rmi.RemoteException,
                                            DeploymentErrorException
Description copied from interface: DeploymentDock
Instantiates a component with a given name in the given Deployment Plan

Specified by:
instantiateComponent in interface DeploymentDock
Parameters:
desc - Context of the application being deployed. Can be seen as transaction identifier.
hierarchicalName - The hierarchical name of the instance of component to be instantiated as is in the deployment dock.
parent - Reference to parent component (may be null if the component is top-level).
cuTemplates - List of ConnectorUnitTemplate that should be initialized on this component.
Returns:
Handle to the instantiated component
Throws:
java.rmi.RemoteException
DeploymentErrorException

updateComponent

public ComponentHandle updateComponent(java.lang.String componentID,
                                       java.lang.String archName,
                                       java.lang.String archVersion)
                                throws java.rmi.RemoteException,
                                       DeploymentErrorException
Description copied from interface: DeploymentDock
Updates the component with another implementation.

Specified by:
updateComponent in interface DeploymentDock
Parameters:
componentID - ID of the component to be updated.
archName - Architecture of a primitive component to replace running component.
archVersion - Version of the architecture that replaces the component.
Returns:
ComponentHandle to the new component instance.
Throws:
java.rmi.RemoteException
DeploymentErrorException

instantiateDynamicComponent

public java.lang.Object instantiateDynamicComponent(java.lang.String factoryInstanceName,
                                                    int dynamicInstanceIndex,
                                                    java.lang.String interfaceName,
                                                    java.lang.String dynamicID,
                                                    java.lang.String appID)
                                             throws java.rmi.RemoteException,
                                                    DeploymentErrorException
Description copied from interface: DeploymentDock
Instantiates a dynamic component from a factory with a given name.

Specified by:
instantiateDynamicComponent in interface DeploymentDock
Parameters:
factoryInstanceName - The hierarchical name of the factory of the given component
dynamicInstanceIndex - Index of the dynamic instance in above mentioned factory's list
interfaceName - The name of the interface that should be returned
dynamicID - ID of the newly created component
appID - application ID
Returns:
The shared connector unit for the client
Throws:
java.rmi.RemoteException - DeploymentErrorException
DeploymentErrorException

startComponent

public void startComponent(java.lang.String componentId)
                    throws java.rmi.RemoteException,
                           DeploymentErrorException
Description copied from interface: DeploymentDock
Starts a component on this dock.

Specified by:
startComponent in interface DeploymentDock
Parameters:
componentId - ID of the component to be started.
Throws:
java.rmi.RemoteException
DeploymentErrorException

initOSGi

protected void initOSGi(org.objectweb.dsrg.sofa.deployment.DeploymentDockImpl.ComponentInfo info)
Initialize service tracker and provided services for given component.

Parameters:
info - component

stopComponent

public void stopComponent(java.lang.String componentId)
                   throws java.rmi.RemoteException,
                          DeploymentErrorException
Description copied from interface: DeploymentDock
Stops component on this dock.

Specified by:
stopComponent in interface DeploymentDock
Parameters:
componentId - ID of the component to be stopped.
Throws:
java.rmi.RemoteException
DeploymentErrorException

closeOSGi

protected void closeOSGi(org.objectweb.dsrg.sofa.deployment.DeploymentDockImpl.ComponentInfo info)
Stop provided OSGi services by given component and stop tracking for required services.

Parameters:
info - component

shutdownApplication

public void shutdownApplication(java.lang.String componentID)
                         throws java.rmi.RemoteException,
                                DeploymentErrorException
Description copied from interface: DeploymentDock
Shuts down the application identified by the component instance ID.

Specified by:
shutdownApplication in interface DeploymentDock
Parameters:
componentID - Component instance ID.
Throws:
java.rmi.RemoteException - remote exception
DeploymentErrorException

removeApplicationComponents

public void removeApplicationComponents(java.lang.String componentID)
                                 throws java.rmi.RemoteException,
                                        DeploymentErrorException
Specified by:
removeApplicationComponents in interface DeploymentDock
Throws:
java.rmi.RemoteException
DeploymentErrorException

notifyDeploymentSuccessfull

public void notifyDeploymentSuccessfull(java.lang.String appID)
                                 throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Notifies DeploymentDock that the application was succefully deployed.

Specified by:
notifyDeploymentSuccessfull in interface DeploymentDock
Parameters:
appID - The ID of the application that was deployed.
Throws:
java.rmi.RemoteException

notifyDeploymentFailed

public void notifyDeploymentFailed(java.lang.String appID)
                            throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Notifies DeploymentDock that application deplyment failed. The dock should clean up temporary data.

Specified by:
notifyDeploymentFailed in interface DeploymentDock
Parameters:
appID - The ID of the application that failed.
Throws:
java.rmi.RemoteException

lookup

public ComponentHandle lookup(java.lang.String name)
                       throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Gets a reference to a component with a given identifier

Specified by:
lookup in interface DeploymentDock
Parameters:
name - Name of the component to get reference to.
Returns:
Handle to the given component
Throws:
java.rmi.RemoteException

lookup

public ComponentHandle lookup(java.lang.String appID,
                              java.lang.String name)
                       throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Gets a reference to a component identified by name of the containing application and hierarchical name of the component.

Specified by:
lookup in interface DeploymentDock
Parameters:
appID - Application ID.
name - Hierarchical name of the component.
Returns:
Handle to the given component.
Throws:
java.rmi.RemoteException

getName

public java.lang.String getName()
Description copied from interface: DeploymentDock
Returns the name of the deployment dock.

Specified by:
getName in interface DeploymentDock

getRunningApplications

public java.util.List<ComponentHandle> getRunningApplications()
                                                       throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Gets the names of all applications running in this Deployment Dock.

Specified by:
getRunningApplications in interface DeploymentDock
Returns:
An array of the names of all top-level components running in the dock.
Throws:
java.rmi.RemoteException

getRunningComponents

public java.util.List<ComponentHandle> getRunningComponents()
                                                     throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Gets the names of all components running in this Deployment Dock.

Specified by:
getRunningComponents in interface DeploymentDock
Returns:
An array of the names of all components running in the dock
Throws:
java.rmi.RemoteException

getCapabilities

public java.util.List<Capability> getCapabilities()
                                           throws java.rmi.RemoteException
Description copied from interface: DeploymentDock
Returns a list of capabilities of the dock.

Specified by:
getCapabilities in interface DeploymentDock
Returns:
a list of capabilities of the dock
Throws:
java.rmi.RemoteException

getCapability

public Capability getCapability(java.lang.String name)
                         throws java.rmi.RemoteException,
                                java.lang.IllegalArgumentException
Description copied from interface: DeploymentDock
Returns a capability with the given name.

Specified by:
getCapability in interface DeploymentDock
Parameters:
name - name of the capability
Returns:
capability
Throws:
java.rmi.RemoteException
java.lang.IllegalArgumentException - non existing name of a capability

isAlive

public boolean isAlive()
                throws java.rmi.RemoteException
Checks if this Deployment Dock is running.

Specified by:
isAlive in interface DeploymentDockRegistryClient
Returns:
Always true - this method is called by the deployment dock registry to check wheter this DD is running
Throws:
java.rmi.RemoteException