return;
}
try
{
VirtualFile jar = unit.getRoot();
if (jar.isLeaf() || ignoredJarsSet.contains(jar.getName()))
{
log.trace(this.getClass().getName() + " ignoring: " + jar.getName());
return;
}
if(!hasAllowedSuffix(jar.getName()))
{
log.trace(this.getClass().getName() + " suffix not allowed: " + jar.getName());
return;
}
// If DDs are required and none are present, skip deployment
// EJBTHREE-1040
if (this.isDeploymentDescriptorRequired() && (metaData == null))
{
log.trace(this.getClass().getSimpleName() + " skipping deployment \"" + unit.getSimpleName()
+ "\", jar: \"" + jar.getName()
+ "\" - either EJB3 Deployment Descriptor or \"jboss.xml\" is required and neither were found.");
return;
}
log.debug("********* " + this.getClass().getSimpleName() + " Begin Unit: " + unit.getSimpleName() + " jar: "
+ jar.getName());
JBoss5DeploymentScope scope = null;
VFSDeploymentUnit parent = unit.getTopLevel();
boolean initScopeDeployment = false;
if (parent != null)
{
// Check for an existing scope
scope = (JBoss5DeploymentScope) parent.getAttachment(DeploymentScope.class);
if (scope == null)
{
// Check for a scoped deployment or an ear top-level unit
boolean isEar = unit != unit.getTopLevel() || parent.isAttachmentPresent(JBossAppMetaData.class);
if(parent.isAttachmentPresent(DeploymentEndpointResolver.class) == true)
scope = new JBoss5DeploymentScope(parent, isEar);
else
{
// EJBTHREE-1291
scope = new JBoss5DeploymentScope(parent, isEar, unit.getSimpleName());
initScopeDeployment = true;
}
parent.addAttachment(DeploymentScope.class, scope);
}
}
JBoss5DeploymentUnit du = new JBoss5DeploymentUnit(unit);
Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, metaData);
if(initScopeDeployment)
{
scope.setDeployment(deployment);
}
deployment.setCacheFactoryRegistry(this.getCacheFactoryRegistry());
// TODO: if the deployment becomes a proper MC bean, it'll get injected by MC.
deployment.setMessageDestinationReferenceResolver(messageDestinationReferenceResolver);
deployment.setPersistenceManagerFactoryRegistry(this.getPersistenceManagerFactoryRegistry());
// TODO: if the deployment becomes a proper MC bean, it'll get injected by MC.
deployment.setPersistenceUnitDependencyResolver(persistenceUnitDependencyResolver);
deployment.setPoolFactoryRegistry(this.getPoolFactoryRegistry());
if (scope != null)
scope.register(deployment);
// create() creates initial EJB containers and initializes metadata.
deployment.create();
if (deployment.getEjbContainers().size() == 0)
{
log.trace("Found no containers in scanned jar, consider adding it to the ignore list: " + jar.getName() + " url: " + jar.toURL() + " unit: " + unit.getSimpleName());
deployment.destroy();
return;
}
// We'll delay the start and let org.jboss.ejb3.deployers.Ejb3DeploymentDeployer start the deployment
// deployment.start();