org.apache.servicemix.jbi.framework
Class AutoDeploymentService

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.AutoDeploymentService
All Implemented Interfaces:
javax.jbi.management.LifeCycleMBean, AutoDeploymentServiceMBean, MBeanInfoProvider

public class AutoDeploymentService
extends BaseSystemService
implements AutoDeploymentServiceMBean

Monitors install and deploy directories to auto install/deploy archives

Version:
$Revision: 695373 $

Nested Class Summary
static class AutoDeploymentService.ArchiveEntry
           
 
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.LifeCycleMBean
SHUTDOWN, STARTED, STOPPED, UNKNOWN
 
Constructor Summary
AutoDeploymentService()
           
 
Method Summary
protected  javax.jbi.management.DeploymentException failure(String task, String info)
           
protected  javax.jbi.management.DeploymentException failure(String task, String info, Exception e)
           
protected  javax.jbi.management.DeploymentException failure(String task, String info, Exception e, List componentResults)
           
 MBeanAttributeInfo[] getAttributeInfos()
          Get an array of MBeanAttributeInfo
protected  Set<String> getComponentNames(ServiceAssembly sa)
           
 String getDescription()
          Get the Description of the item
 String getExtensions()
           
 int getMonitorInterval()
           
protected  Class<AutoDeploymentServiceMBean> getServiceMBean()
           
protected  Set<String> getSharedLibraryNames(Component comp)
           
 void init(JBIContainer container)
          Initialize the Service
 boolean isMonitorDeploymentDirectory()
           
 boolean isMonitorInstallationDirectory()
           
 void removeArchive(AutoDeploymentService.ArchiveEntry entry)
          Remove an archive location
 void setExtensions(String extensions)
           
 void setMonitorDeploymentDirectory(boolean monitorDeploymentDirectory)
           
 void setMonitorInstallationDirectory(boolean monitorInstallationDirectory)
           
 void setMonitorInterval(int monitorInterval)
           
 void start()
          Start the item.
 void stop()
          Stop the item.
protected static File unpackLocation(File tmpRoot, String location)
          Unpack a location into a temp file directory.
 void updateArchive(String location, AutoDeploymentService.ArchiveEntry entry, boolean autoStart)
          Update an archive
protected  void updateComponent(AutoDeploymentService.ArchiveEntry entry, boolean autoStart, File tmpDir, Descriptor root)
           
 AutoDeploymentService.ArchiveEntry updateExternalArchive(String location, boolean autoStart)
          load an archive from an external location
protected  void updateServiceAssembly(AutoDeploymentService.ArchiveEntry entry, boolean autoStart, File tmpDir, Descriptor root)
           
protected  void updateSharedLibrary(AutoDeploymentService.ArchiveEntry entry, File tmpDir, Descriptor root)
           
 
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, getOperationInfos, getSubType, init, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jbi.management.LifeCycleMBean
getCurrentState, shutDown
 

Constructor Detail

AutoDeploymentService

public AutoDeploymentService()
Method Detail

getExtensions

public String getExtensions()
Returns:
the extensions

setExtensions

public void setExtensions(String extensions)
Parameters:
extensions - the extensions to set

getDescription

public String getDescription()
Description copied from interface: MBeanInfoProvider
Get the Description of the item

Specified by:
getDescription in interface MBeanInfoProvider
Returns:
a description of this

isMonitorInstallationDirectory

public boolean isMonitorInstallationDirectory()
Returns:
Returns the monitorInstallationDirectory.

setMonitorInstallationDirectory

public void setMonitorInstallationDirectory(boolean monitorInstallationDirectory)
Parameters:
monitorInstallationDirectory - The monitorInstallationDirectory to set.

isMonitorDeploymentDirectory

public boolean isMonitorDeploymentDirectory()
Returns:
Returns the monitorDeploymentDirectory.

setMonitorDeploymentDirectory

public void setMonitorDeploymentDirectory(boolean monitorDeploymentDirectory)
Parameters:
monitorDeploymentDirectory - The monitorDeploymentDirectory to set.

getMonitorInterval

public int getMonitorInterval()
Returns:
Returns the monitorInterval (number in secs)

setMonitorInterval

public void setMonitorInterval(int monitorInterval)
Parameters:
monitorInterval - The monitorInterval to set (in secs)

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.

stop

public void stop()
          throws javax.jbi.JBIException
Stop the item. This suspends current messaging activities.

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

init

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

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

getServiceMBean

protected Class<AutoDeploymentServiceMBean> getServiceMBean()
Specified by:
getServiceMBean in class BaseSystemService

updateExternalArchive

public AutoDeploymentService.ArchiveEntry updateExternalArchive(String location,
                                                                boolean autoStart)
                                                         throws javax.jbi.management.DeploymentException
load an archive from an external location

Parameters:
location -
autoStart -
Throws:
javax.jbi.management.DeploymentException

updateArchive

public void updateArchive(String location,
                          AutoDeploymentService.ArchiveEntry entry,
                          boolean autoStart)
                   throws javax.jbi.management.DeploymentException
Update an archive

Parameters:
location -
autoStart -
Throws:
javax.jbi.management.DeploymentException

updateComponent

protected void updateComponent(AutoDeploymentService.ArchiveEntry entry,
                               boolean autoStart,
                               File tmpDir,
                               Descriptor root)
                        throws javax.jbi.management.DeploymentException
Throws:
javax.jbi.management.DeploymentException

updateSharedLibrary

protected void updateSharedLibrary(AutoDeploymentService.ArchiveEntry entry,
                                   File tmpDir,
                                   Descriptor root)
                            throws javax.jbi.management.DeploymentException
Throws:
javax.jbi.management.DeploymentException

updateServiceAssembly

protected void updateServiceAssembly(AutoDeploymentService.ArchiveEntry entry,
                                     boolean autoStart,
                                     File tmpDir,
                                     Descriptor root)
                              throws javax.jbi.management.DeploymentException
Throws:
javax.jbi.management.DeploymentException

failure

protected javax.jbi.management.DeploymentException failure(String task,
                                                           String info)

failure

protected javax.jbi.management.DeploymentException failure(String task,
                                                           String info,
                                                           Exception e)

failure

protected javax.jbi.management.DeploymentException failure(String task,
                                                           String info,
                                                           Exception e,
                                                           List componentResults)

getComponentNames

protected Set<String> getComponentNames(ServiceAssembly sa)

getSharedLibraryNames

protected Set<String> getSharedLibraryNames(Component comp)

removeArchive

public void removeArchive(AutoDeploymentService.ArchiveEntry entry)
                   throws javax.jbi.management.DeploymentException
Remove an archive location

Parameters:
location -
Throws:
javax.jbi.management.DeploymentException

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

unpackLocation

protected static File unpackLocation(File tmpRoot,
                                     String location)
                              throws javax.jbi.management.DeploymentException
Unpack a location into a temp file directory. If the location does not contain a jbi descritor, no unpacking occurs.

Parameters:
location -
Returns:
tmp directory (if location contains a jbi descriptor)
Throws:
javax.jbi.management.DeploymentException


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