org.jboss.varia.deployment
Class BeanShellSubDeployer

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.deployment.SubDeployerSupport (src) 
              extended byorg.jboss.varia.deployment.BeanShellSubDeployer
All Implemented Interfaces:
MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src) , SubDeployer (src)

public class BeanShellSubDeployer
extends SubDeployerSupport (src)

A deployer that takes a bean shell script file and creates a JBoss mbean service wrapper for the script.


Nested Class Summary
 
Nested classes inherited from class org.jboss.deployment.SubDeployerSupport (src)
SubDeployerSupport.ClassConfiguration (src)
 
Field Summary
static java.lang.String BASE_SCRIPT_OBJECT_NAME
           
static java.lang.String BEANSHELL_EXTENSION
           
protected  ServiceControllerMBean serviceController
           
 
Fields inherited from class org.jboss.deployment.SubDeployerSupport (src)
CONFIGURATION, mainDeployer, nativePrefix, nativeSuffix, relativeOrder, suffixes, tempDeployDir
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.deployment.SubDeployer (src)
CREATE_NOTIFICATION, DESTROY_NOTIFICATION, INIT_NOTIFICATION, RELATIVE_ORDER_100, RELATIVE_ORDER_200, RELATIVE_ORDER_300, RELATIVE_ORDER_400, RELATIVE_ORDER_500, RELATIVE_ORDER_600, RELATIVE_ORDER_700, RELATIVE_ORDER_800, RELATIVE_ORDER_900, START_NOTIFICATION, STOP_NOTIFICATION
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
BeanShellSubDeployer()
          Default CTOR used to set default values to the Suffixes and RelativeOrder attributes.
 
Method Summary
 boolean accepts(DeploymentInfo (src)  sdi)
          Returns true if this deployer can deploy the given DeploymentInfo.
 void create(DeploymentInfo (src)  di)
          Describe create method here.
 java.net.URL createScriptDeployment(java.lang.String bshScript, java.lang.String scriptName)
          Create a bsh deployment given the script content and name.
 void destroy(DeploymentInfo (src)  di)
          Sub-classes should override this method to provide custom 'destroy' logic.
 void init(DeploymentInfo (src)  di)
          Describe init method here.
protected  void processNestedDeployments(DeploymentInfo (src)  di)
          The processNestedDeployments method searches for any nested and deployable elements.
 void start(DeploymentInfo (src)  di)
          Sub-classes should override this method to provide custom 'start' logic.
protected  void startService()
          Get a reference to the ServiceController
 void stop(DeploymentInfo (src)  di)
          Sub-classes should override this method to provide custom 'stop' logic.
 
Methods inherited from class org.jboss.deployment.SubDeployerSupport (src)
addDeployableFiles, addDeployableJar, createService, deployUrl, destroyService, emitNotification, getRelativeOrder, getSuffixes, isDeployable, setRelativeOrder, setSuffixes, stopService
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, 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.deployment.SubDeployer (src)
getServiceName
 

Field Detail

BEANSHELL_EXTENSION

public static final java.lang.String BEANSHELL_EXTENSION
See Also:
Constant Field Values (src)

BASE_SCRIPT_OBJECT_NAME

public static final java.lang.String BASE_SCRIPT_OBJECT_NAME
See Also:
Constant Field Values (src)

serviceController

protected ServiceControllerMBean serviceController
Constructor Detail

BeanShellSubDeployer

public BeanShellSubDeployer()
Default CTOR used to set default values to the Suffixes and RelativeOrder attributes. Those are read at subdeployer registration time by the MainDeployer to alter its SuffixOrder.

Method Detail

startService

protected void startService()
                     throws java.lang.Exception
Get a reference to the ServiceController

Overrides:
startService in class SubDeployerSupport (src)
Throws:
java.lang.Exception

processNestedDeployments

protected void processNestedDeployments(DeploymentInfo (src)  di)
                                 throws DeploymentException (src) 
Description copied from class: SubDeployerSupport (src)
The processNestedDeployments method searches for any nested and deployable elements. Only Directories and Zipped archives are processed, and those are delegated to the addDeployableFiles and addDeployableJar methods respectively. This method can be overridden for alternate behaviour.

Overrides:
processNestedDeployments in class SubDeployerSupport (src)
Throws:
DeploymentException (src)

accepts

public boolean accepts(DeploymentInfo (src)  sdi)
Returns true if this deployer can deploy the given DeploymentInfo.

Parameters:
sdi - a DeploymentInfo value
Returns:
True if this deployer can deploy the given DeploymentInfo.

init

public void init(DeploymentInfo (src)  di)
          throws DeploymentException (src) 
Describe init method here.

Specified by:
init in interface SubDeployer (src)
Overrides:
init in class SubDeployerSupport (src)
Parameters:
di - a DeploymentInfo value
Throws:
DeploymentException (src) - if an error occurs

create

public void create(DeploymentInfo (src)  di)
            throws DeploymentException (src) 
Describe create method here.

Specified by:
create in interface SubDeployer (src)
Overrides:
create in class SubDeployerSupport (src)
Parameters:
di - a DeploymentInfo value
Throws:
DeploymentException (src) - if an error occurs

start

public void start(DeploymentInfo (src)  di)
           throws DeploymentException (src) 
Description copied from class: SubDeployerSupport (src)
Sub-classes should override this method to provide custom 'start' logic. This method issues a JMX notification of type SubDeployer.START_NOTIFICATION.

Specified by:
start in interface SubDeployer (src)
Overrides:
start in class SubDeployerSupport (src)
Throws:
DeploymentException (src)

stop

public void stop(DeploymentInfo (src)  di)
          throws DeploymentException (src) 
Description copied from class: SubDeployerSupport (src)
Sub-classes should override this method to provide custom 'stop' logic. This method issues a JMX notification of type SubDeployer.START_NOTIFICATION.

Specified by:
stop in interface SubDeployer (src)
Overrides:
stop in class SubDeployerSupport (src)
Throws:
DeploymentException (src)

destroy

public void destroy(DeploymentInfo (src)  di)
             throws DeploymentException (src) 
Description copied from class: SubDeployerSupport (src)
Sub-classes should override this method to provide custom 'destroy' logic. This method issues a JMX notification of type SubDeployer.DESTROY_NOTIFICATION.

Specified by:
destroy in interface SubDeployer (src)
Overrides:
destroy in class SubDeployerSupport (src)
Throws:
DeploymentException (src)

createScriptDeployment

public java.net.URL createScriptDeployment(java.lang.String bshScript,
                                           java.lang.String scriptName)
                                    throws DeploymentException (src) 
Create a bsh deployment given the script content and name. This creates a temp file using File.createTempFile(scriptName, ".bsh") and then deploys this script via the main deployer.

Parameters:
bshScript - the bsh script content
scriptName - the bsh script name to use
Returns:
the URL of the temporary file used as the deployment script
Throws:
DeploymentException (src) - thrown on failure to create the bsh script or deploy it.