Methods Summary |
---|
public void | deploy(org.jboss.deployers.spi.deployer.DeploymentUnit unit)
try
{
if (unit.getDeploymentContext().isComponent()) return;
VirtualFile jar = unit.getDeploymentContext().getRoot();
if (jar.isLeaf() || ignoredJarsSet.contains(jar.getName()) )
{
log.trace("EJBRegistrationDeployer ignoring: " + jar.getName());
return;
}
if (allowedSuffixes != null)
{
for (String suffix : allowedSuffixes)
{
if (jar.getName().endsWith(suffix))
{
log.trace("EJBRegistrationDeployer ignoring: " + jar.getName());
return;
}
}
}
log.debug("********* EJBRegistrationDepoyer Begin Unit: " + unit.getName() + " jar: " + jar.getName());
VirtualFile ejbjar = unit.getMetaDataFile("ejb-jar.xml");
if (ejbjar != null)
{
InputStream is = ejbjar.openStream();
boolean has30EjbJarXml = EJB3Deployer.has30EjbJarXml(is);
is.close();
if (!has30EjbJarXml) return;
}
DeploymentScope scope = null;
DeploymentContext parent = unit.getDeploymentContext().getParent();
if (parent != null && parent.getRoot().getName().endsWith(".ear")) // todo should look for metadata instead of ".ear"
{
scope = parent.getTransientAttachments().getAttachment(DeploymentScope.class);
if (scope == null)
{
scope = new JBoss5DeploymentScope(unit.getDeploymentContext().getParent());
parent.getTransientAttachments().addAttachment(DeploymentScope.class, scope);
}
}
JBoss5DeploymentUnit du = new JBoss5DeploymentUnit(unit);
du.setDefaultPersistenceProperties(defaultPersistenceProperties);
Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope);
if (scope != null) scope.register(deployment);
// create() creates initial EJB containers and initializes metadata.
deployment.create();
if (deployment.getEjbContainers().size() == 0 && deployment.getPersistenceUnitDeployments().size() == 0)
{
log.trace("EJBRegistrationDeployer no containers in scanned jar, consider adding it to the ignore list: " + jar.getName() + " url: " + jar.toURL() + " unit: " + unit.getName());
return;
}
unit.addAttachment(Ejb3Deployment.class, deployment);
}
catch (Exception e)
{
throw new DeploymentException(e);
}
|
public java.util.List | getAllowedSuffixes()
return allowedSuffixes;
|
public java.util.Properties | getDefaultPersistenceProperties()
return defaultPersistenceProperties;
|
public java.util.HashSet | getIgnoredJarsSet()
return ignoredJarsSet;
|
public org.jboss.kernel.Kernel | getKernel()
return kernel;
|
public javax.management.MBeanServer | getMbeanServer()
return mbeanServer;
|
public void | setAllowedSuffixes(java.util.List allowedSuffixes)
this.allowedSuffixes = allowedSuffixes;
|
public void | setDefaultPersistenceProperties(java.util.Properties defaultPersistenceProperties)
this.defaultPersistenceProperties = defaultPersistenceProperties;
|
public void | setIgnoredJarsSet(java.util.HashSet ignoredJarsSet)
this.ignoredJarsSet = ignoredJarsSet;
|
public void | setKernel(org.jboss.kernel.Kernel kernel)
this.kernel = kernel;
|
public void | setMbeanServer(javax.management.MBeanServer mbeanServer)
this.mbeanServer = mbeanServer;
|
public void | undeploy(org.jboss.deployers.spi.deployer.DeploymentUnit unit)
Ejb3Deployment deployment = unit.getAttachment(Ejb3Deployment.class);
if (deployment == null) return;
try
{
deployment.stop();
}
catch (Exception e)
{
log.error("failed to stop deployment", e);
}
try
{
deployment.destroy();
}
catch (Exception e)
{
log.error("failed to destroy deployment", e);
}
|