| Method from org.jboss.varia.deployment.BeanShellSubDeployer Detail: |
public boolean accepts(DeploymentInfo sdi) {
return super.accepts(sdi);
}
Returns true if this deployer can deploy the given DeploymentInfo. |
public void create(DeploymentInfo di) throws DeploymentException {
try
{
// install the MBeans in this descriptor
log.debug("Deploying BeanShell script, create step: url " + di.url);
String lURL = di.url.toString();
int lIndex = lURL.lastIndexOf( "/" );
di.shortName = lURL.substring( lIndex >= 0 ? lIndex + 1 : 0 );
BeanShellScript script = new BeanShellScript (di);
ObjectName bshScriptName = script.getPreferedObjectName();
ObjectName[] depends = script.getDependsServices();
if (bshScriptName == null)
{
bshScriptName = ObjectNameConverter.convert(
BASE_SCRIPT_OBJECT_NAME + ",url=" + di.url);
}
di.deployedObject = bshScriptName;
try
{
server.unregisterMBean(bshScriptName);
} catch(Exception e) { log.info(e);}
server.registerMBean(script, bshScriptName);
log.debug( "Deploying: " + di.url );
// Init application
if (depends == null)
serviceController.create(bshScriptName);
else
serviceController.create(bshScriptName, Arrays.asList(depends));
super.create(di);
}
catch (Exception e)
{
destroy(di);
DeploymentException de = new DeploymentException("create operation failed for script "
+ di.url, e);
throw de;
}
}
Describe create method here. |
public URL createScriptDeployment(String bshScript,
String scriptName) throws DeploymentException {
try
{
File scriptFile = File.createTempFile(scriptName, ".bsh");
FileWriter fw = new FileWriter(scriptFile);
try
{
fw.write(bshScript);
}
finally
{
fw.close();
}
URL scriptURL = scriptFile.toURL();
mainDeployer.deploy(scriptURL);
return scriptURL;
}
catch(IOException e)
{
throw new DeploymentException("Failed to deploy: "+scriptName, e);
}
}
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. |
public void destroy(DeploymentInfo di) throws DeploymentException {
try
{
serviceController.destroy( di.deployedObject );
serviceController.remove( di.deployedObject );
super.destroy(di);
}
catch (Exception e)
{
throw new DeploymentException( "problem destroying BSH Script: " +
di.url, e );
}
}
|
public void init(DeploymentInfo di) throws DeploymentException {
super.init(di);
di.watch = di.url;
}
Describe init method here. |
protected void processNestedDeployments(DeploymentInfo di) throws DeploymentException {
// no sub-deployment!
}
|
public synchronized void start(DeploymentInfo di) throws DeploymentException {
try
{
// Start application
log.debug( "start script, deploymentInfo: " + di +
", short name: " + di.shortName +
", parent short name: " +
(di.parent == null ? "no parent" : di.parent.shortName) );
serviceController.start(di.deployedObject);
log.debug( "Deployed: " + di.url );
super.start(di);
}
catch (Exception e)
{
throw new DeploymentException( "Could not deploy " + di.url, e );
}
}
|
protected void startService() throws Exception {
serviceController = (ServiceControllerMBean)
MBeanProxyExt.create(ServiceControllerMBean.class,
ServiceControllerMBean.OBJECT_NAME, server);
// register with MainDeployer
super.startService();
}
Get a reference to the ServiceController |
public void stop(DeploymentInfo di) throws DeploymentException {
try
{
serviceController.stop(di.deployedObject);
super.stop(di);
}
catch (Exception e)
{
throw new DeploymentException( "problem stopping ejb module: " +
di.url, e );
}
}
|