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
 
Constructor Summary
DeploymentDockImpl(java.lang.String name, java.lang.String rmiHost, java.lang.String rmiPort)
          The constructor
 
Method Summary
 void addConnectorUnitITs(java.lang.String dpName, java.lang.String dpVersion, java.lang.String componentInstanceName)
          Adds the instantiation templates for the given component to the local DockConnectorManager
 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.
 DeploymentDockRegistry getDeploymentDockRegistry()
          Gets a reference to the DDR object this Deployment Dock is registered in
 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
 ComponentHandle instantiateComponent(java.lang.String dpName, java.lang.String dpVersion, java.lang.String componentName, java.lang.String componentInstanceName, ComponentHandle parent, java.util.LinkedList<org.objectweb.dsrg.sofa.deployment.ConnectorUnitBindable> cuListCurrent, long appID)
          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, long 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 the name and version of a Deployment Plan
 ComponentHandle lookup(java.lang.String name)
          Gets a reference to a component with a given name
 void notifyDeploymentFailed(java.lang.String deploymentPlanID)
          Removes all components with the given deployment plan ID from the table
 void notifyDeploymentSuccessfull(java.lang.String deploymentPlanID)
          Mark all components with the given deployment plan ID as deployed
 void shutdownApplication(java.lang.String componentID)
          Shuts down the application identified by the component instance ID.
 void shutdownApplication(java.lang.String appName, java.lang.String appVersion)
          Deprecated. 
 void startComponent(ComponentHandle component)
          Starts a component on this dock
 void stopComponent(ComponentHandle component, boolean remove)
          Stops component on this dock
 boolean unregister()
          Unregisters this deployment dock from deployment dock registry.
 
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
 

Constructor Detail

DeploymentDockImpl

public DeploymentDockImpl(java.lang.String name,
                          java.lang.String rmiHost,
                          java.lang.String rmiPort)
                   throws java.rmi.RemoteException,
                          SOFAException
The constructor

Parameters:
name - Name of the Deployment Dock
rmiHost - Address of the machine where a Deployment Dock Registry is running
rmiPort - Port on which the Deployment Dock Registry is running
Throws:
RemoteException, - SOFAException
java.rmi.RemoteException
SOFAException
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
Launches an application specified by the 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:
RemoteException, - DeploymentErrorException
java.rmi.RemoteException
DeploymentErrorException

instantiateComponent

public ComponentHandle instantiateComponent(java.lang.String dpName,
                                            java.lang.String dpVersion,
                                            java.lang.String componentName,
                                            java.lang.String componentInstanceName,
                                            ComponentHandle parent,
                                            java.util.LinkedList<org.objectweb.dsrg.sofa.deployment.ConnectorUnitBindable> cuListCurrent,
                                            long appID)
                                     throws java.rmi.RemoteException,
                                            DeploymentErrorException
Instantiates a component with a given name in the given Deployment Plan

Specified by:
instantiateComponent in interface DeploymentDock
Parameters:
dpName - Name of the Deployment Plan to start with.
dpVersion - The version of the Deployment Plan.
componentName - Name of the component to instantiate.
componentInstanceName - The hierarchical name of the instance of the given component.
parent - Reference to parent component (may be null if the component is top-level).
cuListCurrent - List of ConnectorUnitBindables that should be initialized on this component
appID - application ID
Returns:
Reference of the instantiated component
Throws:
RemoteException, - IncorrectDeploymentRequestException
java.rmi.RemoteException
DeploymentErrorException

instantiateDynamicComponent

public java.lang.Object instantiateDynamicComponent(java.lang.String factoryInstanceName,
                                                    int dynamicInstanceIndex,
                                                    java.lang.String interfaceName,
                                                    java.lang.String dynamicID,
                                                    long appID)
                                             throws java.rmi.RemoteException,
                                                    DeploymentErrorException
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

lookup

public ComponentHandle lookup(java.lang.String name)
                       throws java.rmi.RemoteException
Gets a reference to a component with a given name

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

startComponent

public void startComponent(ComponentHandle component)
                    throws java.rmi.RemoteException
Starts a component on this dock

Specified by:
startComponent in interface DeploymentDock
Parameters:
component - The handle of the component to start
Throws:
java.rmi.RemoteException

stopComponent

public void stopComponent(ComponentHandle component,
                          boolean remove)
                   throws java.rmi.RemoteException
Stops component on this dock

Specified by:
stopComponent in interface DeploymentDock
Parameters:
component - The handle of the component to stop
remove - True if this component should be removed from this dock as well
Throws:
java.rmi.RemoteException

shutdownApplication

@Deprecated
public void shutdownApplication(java.lang.String appName,
                                           java.lang.String appVersion)
                         throws java.rmi.RemoteException,
                                DockNotFoundException,
                                DeploymentErrorException
Deprecated. 

Shuts down an application with a given name

Specified by:
shutdownApplication in interface DeploymentDock
Parameters:
appName - The name of the application to shutdown
appVersion - The version of the application to shutdown
Throws:
RemoteException, - DockNotFoundException, DeploymentErrorException
java.rmi.RemoteException
DockNotFoundException
DeploymentErrorException

shutdownApplication

public void shutdownApplication(java.lang.String componentID)
                         throws java.rmi.RemoteException,
                                DockNotFoundException,
                                DeploymentErrorException
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
DockNotFoundException
DeploymentErrorException

notifyDeploymentSuccessfull

public void notifyDeploymentSuccessfull(java.lang.String deploymentPlanID)
                                 throws java.rmi.RemoteException
Mark all components with the given deployment plan ID as deployed

Specified by:
notifyDeploymentSuccessfull in interface DeploymentDock
Parameters:
deploymentPlanID - The ID of the deployment plan that succeeded
Throws:
java.rmi.RemoteException

notifyDeploymentFailed

public void notifyDeploymentFailed(java.lang.String deploymentPlanID)
                            throws java.rmi.RemoteException
Removes all components with the given deployment plan ID from the table

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

getRunningApplications

public java.util.List<ComponentHandle> getRunningApplications()
                                                       throws java.rmi.RemoteException
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
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

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

getDeploymentDockRegistry

public DeploymentDockRegistry getDeploymentDockRegistry()
Gets a reference to the DDR object this Deployment Dock is registered in

Returns:
The DeploymentDockRegistry object which this deployment dock is registered in

addConnectorUnitITs

public void addConnectorUnitITs(java.lang.String dpName,
                                java.lang.String dpVersion,
                                java.lang.String componentInstanceName)
                         throws java.rmi.RemoteException,
                                DeploymentErrorException
Adds the instantiation templates for the given component to the local DockConnectorManager

Specified by:
addConnectorUnitITs in interface DeploymentDock
Parameters:
dpName - Name of the Deployment Plan to search
dpVersion - The version of the Deployment Plan
componentInstanceName - The hierarchical name of the instance of the given component
Throws:
RemoteException, - IncorrectDeploymentRequestException, DeploymentErrorException
java.rmi.RemoteException
DeploymentErrorException

getCapabilities

public java.util.List<Capability> getCapabilities()
                                           throws java.rmi.RemoteException
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
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