org.apache.servicemix.jbi.framework
Class DeploymentService

java.lang.Object
  extended by org.apache.servicemix.jbi.management.BaseLifeCycle
      extended by org.apache.servicemix.jbi.management.BaseSystemService
          extended by org.apache.servicemix.jbi.framework.DeploymentService
All Implemented Interfaces:
javax.jbi.management.DeploymentServiceMBean, javax.jbi.management.LifeCycleMBean, MBeanInfoProvider

public class DeploymentService
extends BaseSystemService
implements javax.jbi.management.DeploymentServiceMBean

The deployment service MBean allows administrative tools to manage service assembly deployments.

Version:
$Revision: 564900 $

Field Summary
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseSystemService
container
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
currentState, INITIALIZED, listener
 
Fields inherited from interface javax.jbi.management.DeploymentServiceMBean
SHUTDOWN, STARTED, STOPPED
 
Fields inherited from interface javax.jbi.management.LifeCycleMBean
SHUTDOWN, STARTED, STOPPED, UNKNOWN
 
Constructor Summary
DeploymentService()
           
 
Method Summary
protected  void buildState()
          Find runnning state and things deployed before shutdown
 boolean canDeployToComponent(String componentName)
          Returns a boolean value indicating whether the SU can be deployed to a component.
protected  void checkSus(File saDirectory, ServiceUnit[] sus)
           
 String deploy(String saZipURL)
          Deploys the given SA to the JBI environment.
protected  String deployServiceAssembly(File tmpDir, ServiceAssembly sa)
          Deploy an SA
 MBeanAttributeInfo[] getAttributeInfos()
          Get an array of MBeanAttributeInfo
protected  Element getChildElement(Element element, String name)
           
 String[] getComponentsForDeployedServiceAssembly(String saName)
          Returns a list of components(to which SUs are targeted for) in a Service Assembly.
protected  void getComponentTaskError(Exception exception, String component, List<Element> results)
           
protected  boolean getComponentTaskResult(String resultMsg, String component, List<Element> results, boolean success)
           
 String[] getDeployedServiceAssemblies()
          Returns a list of Service Assemblies deployed to the JBI enviroment.
 String[] getDeployedServiceAssembliesForComponent(String componentName)
          Returns a list of Service Assemblies that contain SUs for the given component.
 String[] getDeployedServiceUnitList(String componentName)
          Returns a list of Service Units that are currently deployed to the given component.
 String getDescription()
          Get the description
protected  Element getElement(Document doc, String name)
           
 MBeanOperationInfo[] getOperationInfos()
          Get an array of MBeanOperationInfo
 String getServiceAssemblyDescriptor(String saName)
          Returns the descriptor of the Service Assembly that was deployed to the JBI enviroment.
protected  Class<javax.jbi.management.DeploymentServiceMBean> getServiceMBean()
           
 String getState(String serviceAssemblyName)
          Returns the state of service assembly.
 void init(JBIContainer container)
          Initialize the Service
 boolean isDeployedServiceUnit(String componentName, String suName)
          Returns a boolean value indicating whether the SU is currently deployed.
protected  boolean isSaDeployed(String serviceAssemblyName)
          See if an Sa is already deployed
protected  Document parse(String result)
           
 String shutDown(String serviceAssemblyName)
          Shutdown the service assembly and puts it in SHUTDOWN state.
 void start()
          Start the item.
 String start(String serviceAssemblyName)
          Starts the service assembly and puts it in STARTED state.
 String stop(String serviceAssemblyName)
          Stops the service assembly and puts it in STOPPED state.
 String undeploy(String saName)
          Undeploys the given SA from the JBI environment.
protected  void undeployServiceUnit(ServiceUnitLifeCycle su)
           
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseSystemService
getContainer, getName, getType, shutDown
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getCurrentState, getObjectToManage, getSubType, init, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeploymentService

public DeploymentService()
Method Detail

init

public void init(JBIContainer container)
          throws javax.jbi.JBIException
Initialize the Service

Overrides:
init in class BaseSystemService
Parameters:
container -
Throws:
javax.jbi.JBIException
javax.jbi.management.DeploymentException

getServiceMBean

protected Class<javax.jbi.management.DeploymentServiceMBean> getServiceMBean()
Specified by:
getServiceMBean in class BaseSystemService

start

public void start()
           throws javax.jbi.JBIException
Description copied from class: BaseLifeCycle
Start the item.

Specified by:
start in interface javax.jbi.management.LifeCycleMBean
Overrides:
start in class BaseLifeCycle
Throws:
javax.jbi.JBIException - if the item fails to start.

getAttributeInfos

public MBeanAttributeInfo[] getAttributeInfos()
                                       throws JMException
Get an array of MBeanAttributeInfo

Specified by:
getAttributeInfos in interface MBeanInfoProvider
Overrides:
getAttributeInfos in class BaseLifeCycle
Returns:
array of AttributeInfos
Throws:
JMException

getOperationInfos

public MBeanOperationInfo[] getOperationInfos()
                                       throws JMException
Get an array of MBeanOperationInfo

Specified by:
getOperationInfos in interface MBeanInfoProvider
Overrides:
getOperationInfos in class BaseLifeCycle
Returns:
array of OperationInfos
Throws:
JMException

getDescription

public String getDescription()
Get the description

Specified by:
getDescription in interface MBeanInfoProvider
Returns:
description

deploy

public String deploy(String saZipURL)
              throws Exception
Deploys the given SA to the JBI environment.

Specified by:
deploy in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
saZipURL - String containing the location of the Service Assembly zip file.
Returns:
Result/Status of the SA deployment in xml format.
Throws:
Exception - in xml format if complete deployment fails.

undeploy

public String undeploy(String saName)
                throws Exception
Undeploys the given SA from the JBI environment.

Specified by:
undeploy in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
saName - name of the SA that has to be undeployed.
Returns:
Result/Status of the SA undeployment.
Throws:
Exception - if compelete undeployment fails.

getDeployedServiceUnitList

public String[] getDeployedServiceUnitList(String componentName)
                                    throws Exception
Returns a list of Service Units that are currently deployed to the given component.

Specified by:
getDeployedServiceUnitList in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
componentName - name of the component.
Returns:
List of deployed ASA Ids.
Throws:
Exception

getDeployedServiceAssemblies

public String[] getDeployedServiceAssemblies()
                                      throws Exception
Returns a list of Service Assemblies deployed to the JBI enviroment.

Specified by:
getDeployedServiceAssemblies in interface javax.jbi.management.DeploymentServiceMBean
Returns:
list of Service Assembly Name's.
Throws:
Exception

getServiceAssemblyDescriptor

public String getServiceAssemblyDescriptor(String saName)
                                    throws Exception
Returns the descriptor of the Service Assembly that was deployed to the JBI enviroment.

Specified by:
getServiceAssemblyDescriptor in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
saName - name of the service assembly.
Returns:
descriptor of the Service Assembly.
Throws:
Exception

getDeployedServiceAssembliesForComponent

public String[] getDeployedServiceAssembliesForComponent(String componentName)
                                                  throws Exception
Returns a list of Service Assemblies that contain SUs for the given component.

Specified by:
getDeployedServiceAssembliesForComponent in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
componentName - name of the component.
Returns:
list of Service Assembly names.
Throws:
Exception - if unable to retrieve service assembly list.

getComponentsForDeployedServiceAssembly

public String[] getComponentsForDeployedServiceAssembly(String saName)
                                                 throws Exception
Returns a list of components(to which SUs are targeted for) in a Service Assembly.

Specified by:
getComponentsForDeployedServiceAssembly in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
saName - name of the service assembly.
Returns:
list of component names.
Throws:
Exception - if unable to retrieve component list.

isDeployedServiceUnit

public boolean isDeployedServiceUnit(String componentName,
                                     String suName)
                              throws Exception
Returns a boolean value indicating whether the SU is currently deployed.

Specified by:
isDeployedServiceUnit in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
componentName - - name of component.
suName - - name of the Service Unit.
Returns:
boolean value indicating whether the SU is currently deployed.
Throws:
Exception - if unable to return status of service unit.

canDeployToComponent

public boolean canDeployToComponent(String componentName)
Returns a boolean value indicating whether the SU can be deployed to a component.

Specified by:
canDeployToComponent in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
componentName - - name of the component.
Returns:
boolean value indicating whether the SU can be deployed.

start

public String start(String serviceAssemblyName)
             throws Exception
Starts the service assembly and puts it in STARTED state.

Specified by:
start in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
serviceAssemblyName - - name of the service assembly.
Returns:
Result/Status of this operation.
Throws:
Exception - if operation fails.

stop

public String stop(String serviceAssemblyName)
            throws Exception
Stops the service assembly and puts it in STOPPED state.

Specified by:
stop in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
serviceAssemblyName - - name of the service assembly.
Returns:
Result/Status of this operation.
Throws:
Exception - if operation fails.

shutDown

public String shutDown(String serviceAssemblyName)
                throws Exception
Shutdown the service assembly and puts it in SHUTDOWN state.

Specified by:
shutDown in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
serviceAssemblyName - - name of the service assembly.
Returns:
Result/Status of this operation.
Throws:
Exception - if operation fails.

getState

public String getState(String serviceAssemblyName)
                throws Exception
Returns the state of service assembly.

Specified by:
getState in interface javax.jbi.management.DeploymentServiceMBean
Parameters:
serviceAssemblyName - - name of the service assembly.
Returns:
State of the service assembly.
Throws:
Exception - if operation fails.

isSaDeployed

protected boolean isSaDeployed(String serviceAssemblyName)
See if an Sa is already deployed

Parameters:
serviceAssemblyName - - name of the service assembly.
Returns:
true if already deployed

deployServiceAssembly

protected String deployServiceAssembly(File tmpDir,
                                       ServiceAssembly sa)
                                throws Exception
Deploy an SA

Parameters:
tmpDir -
sa -
Returns:
result/status of the deployment in xml format
Throws:
Exception - in xml format

checkSus

protected void checkSus(File saDirectory,
                        ServiceUnit[] sus)
                 throws Exception
Throws:
Exception

getComponentTaskError

protected void getComponentTaskError(Exception exception,
                                     String component,
                                     List<Element> results)

getComponentTaskResult

protected boolean getComponentTaskResult(String resultMsg,
                                         String component,
                                         List<Element> results,
                                         boolean success)

parse

protected Document parse(String result)
                  throws ParserConfigurationException,
                         SAXException,
                         IOException
Throws:
ParserConfigurationException
SAXException
IOException

getElement

protected Element getElement(Document doc,
                             String name)

getChildElement

protected Element getChildElement(Element element,
                                  String name)

undeployServiceUnit

protected void undeployServiceUnit(ServiceUnitLifeCycle su)
                            throws javax.jbi.management.DeploymentException
Throws:
javax.jbi.management.DeploymentException

buildState

protected void buildState()
Find runnning state and things deployed before shutdown



Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.