org.jboss.services.deployment
Class DeploymentService

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.system.ListenerServiceMBeanSupport
              extended by org.jboss.services.deployment.DeploymentService
All Implemented Interfaces:
EventListener, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, NotificationListener, org.jboss.kernel.spi.dependency.KernelControllerContextAware, DeploymentServiceMBean, ListenerServiceMBean, Service, ServiceMBean

public class DeploymentService
extends ListenerServiceMBeanSupport
implements DeploymentServiceMBean

Version:
$Revision: 81038 $
Author:
Dimitris Andreadis

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.system.ListenerServiceMBeanSupport
ListenerServiceMBeanSupport.SubscriptionInfo
 
Field Summary
static String DEFAULT_DEPLOY_DIR
          where modules are moved for hot deployment
static String DEFAULT_TEMPLATE_DIR
          where to look for templates
static String DEFAULT_UNDEPLOY_DIR
          where modules are created/removed
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ListenerServiceMBean
SL_FILTER_ELEMENT, SL_FILTER_FACTORY_ATTRIBUTE, SL_MBEAN_ELEMENT, SL_MBEAN_HANDBACK_ATTRIBUTE, SL_MBEAN_NAME_ATTRIBUTE, SL_NOTIFICATION_ELEMENT, SL_NOTIFICATION_TYPE_ATTRIBUTE, SL_ROOT_ELEMENT
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
DeploymentService()
          CTOR
 
Method Summary
 String createModule(String module, String template, HashMap properties)
          Generate a new module based on the specified template and the input properties
 String createModule(String module, String template, String[] properties)
          Used primarily for testing through the jmx-console
 void deployModuleAsynch(String module)
          Move a module to the deploy directory
 String getDeployDir()
          Gets the directory where modules should be deployed
 URL getDeployedURL(String module)
          Get the URL of a deployed module
 String getTemplateDir()
          Gets the directory where templates are stored
 List getTemplatePropertyInfo(String template)
          Get property metadata information for a particular template List
 String getUndeployDir()
          Gets the directory where new deployments are produced
 URL getUndeployedURL(String module)
          Get the URL of an undeployed module
 Set listModuleTemplates()
          Return the set of available deployment templates Set
 String removeDataSource(String module, String template, HashMap properties)
          Remove an existing data source based on the specified template and the input properties.
 boolean removeModule(String module)
          Remove a module if exists
 void setDeployDir(String deployDir)
          Sets the directory where modules should be deployed
 void setTemplateDir(String templateDir)
          Sets the directory where templates are stored
 void setUndeployDir(String undeployDir)
          Sets the directory where new deployments are produced
 void startService()
           
 void stopService()
           
 void undeployModuleAsynch(String module)
          Move a module to the undeploy directory
 String updateDataSource(String module, String template, HashMap properties)
          Update an existing data source based on the specified template and the input properties.
 boolean updateMBean(MBeanData data)
          Update an existing module based on the specified template and the input properties
 boolean uploadLibrary(URL src, String filename)
          Upload a new library to server lib dir.
 
Methods inherited from class org.jboss.system.ListenerServiceMBeanSupport
getSubscriptions, handleNotification, handleNotification2, setSubscriptionList, setSubscriptions, subscribe, subscribe, subscribe, unsubscribe
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, pojoChange, pojoCreate, pojoDestroy, pojoStart, pojoStop, postDeregister, postRegister, preDeregister, preRegister, setKernelControllerContext, start, stop, unsetKernelControllerContext
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ListenerServiceMBean
setSubscriptionList
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

DEFAULT_TEMPLATE_DIR

public static final String DEFAULT_TEMPLATE_DIR
where to look for templates

See Also:
Constant Field Values

DEFAULT_UNDEPLOY_DIR

public static final String DEFAULT_UNDEPLOY_DIR
where modules are created/removed

See Also:
Constant Field Values

DEFAULT_DEPLOY_DIR

public static final String DEFAULT_DEPLOY_DIR
where modules are moved for hot deployment

See Also:
Constant Field Values
Constructor Detail

DeploymentService

public DeploymentService()
CTOR

Method Detail

setTemplateDir

public void setTemplateDir(String templateDir)
Description copied from interface: DeploymentServiceMBean
Sets the directory where templates are stored

Specified by:
setTemplateDir in interface DeploymentServiceMBean
Parameters:
templateDir - The templateDir to set.

getTemplateDir

public String getTemplateDir()
Description copied from interface: DeploymentServiceMBean
Gets the directory where templates are stored

Specified by:
getTemplateDir in interface DeploymentServiceMBean
Returns:
Returns the templateDir.

getUndeployDir

public String getUndeployDir()
Description copied from interface: DeploymentServiceMBean
Gets the directory where new deployments are produced

Specified by:
getUndeployDir in interface DeploymentServiceMBean

setUndeployDir

public void setUndeployDir(String undeployDir)
Description copied from interface: DeploymentServiceMBean
Sets the directory where new deployments are produced

Specified by:
setUndeployDir in interface DeploymentServiceMBean

getDeployDir

public String getDeployDir()
Description copied from interface: DeploymentServiceMBean
Gets the directory where modules should be deployed

Specified by:
getDeployDir in interface DeploymentServiceMBean

setDeployDir

public void setDeployDir(String deployDir)
Description copied from interface: DeploymentServiceMBean
Sets the directory where modules should be deployed

Specified by:
setDeployDir in interface DeploymentServiceMBean

listModuleTemplates

public Set listModuleTemplates()
Description copied from interface: DeploymentServiceMBean
Return the set of available deployment templates Set

Specified by:
listModuleTemplates in interface DeploymentServiceMBean

getTemplatePropertyInfo

public List getTemplatePropertyInfo(String template)
                             throws Exception
Description copied from interface: DeploymentServiceMBean
Get property metadata information for a particular template List

Specified by:
getTemplatePropertyInfo in interface DeploymentServiceMBean
Throws:
Exception

createModule

public String createModule(String module,
                           String template,
                           HashMap properties)
                    throws Exception
Description copied from interface: DeploymentServiceMBean
Generate a new module based on the specified template and the input properties

Specified by:
createModule in interface DeploymentServiceMBean
Throws:
Exception

createModule

public String createModule(String module,
                           String template,
                           String[] properties)
                    throws Exception
Used primarily for testing through the jmx-console

Specified by:
createModule in interface DeploymentServiceMBean
Throws:
Exception

removeModule

public boolean removeModule(String module)
Description copied from interface: DeploymentServiceMBean
Remove a module if exists

Specified by:
removeModule in interface DeploymentServiceMBean

updateMBean

public boolean updateMBean(MBeanData data)
                    throws Exception
Description copied from interface: DeploymentServiceMBean
Update an existing module based on the specified template and the input properties

Specified by:
updateMBean in interface DeploymentServiceMBean
Parameters:
data - Data used to update the mbean descriptor. The name and templateName properties are required.
Returns:
True if MBean successfully updated, false otherwise.
Throws:
Exception

updateDataSource

public String updateDataSource(String module,
                               String template,
                               HashMap properties)
                        throws Exception
Description copied from interface: DeploymentServiceMBean
Update an existing data source based on the specified template and the input properties. Note that this method takes the exact same parameters as the createModule method. Thus the client code for creating a new data source or updating an existing data source can be the same, and only the code that makes the deployment service call needs to differentiate between calling createModule and updateDataSource.

Before updating a data source, you will need to gather the properties for the existing data source. The properties can be found in the following MBeans (where XXX is the data source jndi name, and YYY corresponds to the transaction type: NoTxCM, LocalTxCM, XATxCM):

The service=metadata MBean provides the type-mapping, which should be provided as a property named "type-mapping".

To find the dependencies, get the jboss.system:service=ServiceController MBean and invoke the listDeployed method. Then search through the returned results for the jboss.jca:name=XXX,service=ManagedConnectionFactory MBean. That entry will contain the dependecies. Note that there will be an extra implied dependency named "jboss.jca:service=RARDeployment,name='jboss-ZZZ-jdbc.rar'", where ZZZ is 'local' (local and no transaction types) or 'xa'. Ignore this extra dependency, do not provide it when doing an update.

Specified by:
updateDataSource in interface DeploymentServiceMBean
Parameters:
module - The name of the model that contains the data source definition. For example, the default data source, DefaultDS, is typically found in a module named "hsqldb-ds.xml", with "hsqldb" being an acceptable abbreviation.
template - The name of the template to use to update the data source. You must select the proper template based on the data source transaction type. Use one of the following: "local-tx-datasource", "no-tx-datasource", or "xa-datasource". Alternatively, you could add the "-update" suffix; for example, "local-tx-datasource-update" is the same as "local-tx-datasource".
Returns:
The full module name, with the suffix. For example, "hsqldb-ds.xml".
Throws:
Exception

removeDataSource

public String removeDataSource(String module,
                               String template,
                               HashMap properties)
                        throws Exception
Description copied from interface: DeploymentServiceMBean
Remove an existing data source based on the specified template and the input properties. This method takes the same parameters as the updateDataSource method. Refer to the comments of the updateDataSource method for more descriptions.

Specified by:
removeDataSource in interface DeploymentServiceMBean
Parameters:
module - The name of the model that contains the data source definition. See the module parameter under updateDataSource for more information.
template - There is only one delete template: "datasource". Optionally, you can use the template name "datasource-remove".
properties - The key property to provide is "jndi-name". This property if used to determine which data source to remove.
Returns:
The full module name, with the suffix.
Throws:
Exception
See Also:
DeploymentServiceMBean.updateDataSource(String, String, HashMap)

deployModuleAsynch

public void deployModuleAsynch(String module)
                        throws Exception
Description copied from interface: DeploymentServiceMBean
Move a module to the deploy directory

Specified by:
deployModuleAsynch in interface DeploymentServiceMBean
Throws:
Exception

getDeployedURL

public URL getDeployedURL(String module)
                   throws Exception
Description copied from interface: DeploymentServiceMBean
Get the URL of a deployed module

Specified by:
getDeployedURL in interface DeploymentServiceMBean
Throws:
Exception

undeployModuleAsynch

public void undeployModuleAsynch(String module)
                          throws Exception
Description copied from interface: DeploymentServiceMBean
Move a module to the undeploy directory

Specified by:
undeployModuleAsynch in interface DeploymentServiceMBean
Throws:
Exception

getUndeployedURL

public URL getUndeployedURL(String module)
                     throws Exception
Description copied from interface: DeploymentServiceMBean
Get the URL of an undeployed module

Specified by:
getUndeployedURL in interface DeploymentServiceMBean
Throws:
Exception

uploadLibrary

public boolean uploadLibrary(URL src,
                             String filename)
Upload a new library to server lib dir. A different filename may be specified, when writing the library. If the target filename exists, upload is not performed.

Specified by:
uploadLibrary in interface DeploymentServiceMBean
Parameters:
src - the source url to copy
filename - the filename to use when copying (optional)
Returns:
true if upload was succesful, false otherwise

startService

public void startService()
                  throws Exception
Overrides:
startService in class ServiceMBeanSupport
Throws:
Exception

stopService

public void stopService()
Overrides:
stopService in class ServiceMBeanSupport


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.