[jboss-cvs] JBossAS SVN: r82530 - projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb3.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 23 09:31:38 EST 2008
Author: alesj
Date: 2008-12-23 09:31:38 -0500 (Tue, 23 Dec 2008)
New Revision: 82530
Modified:
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb3/EjbDiscoveryEnvironment.java
Log:
Fix DU ejb3 lookup.
Modified: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb3/EjbDiscoveryEnvironment.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb3/EjbDiscoveryEnvironment.java 2008-12-23 14:24:53 UTC (rev 82529)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb3/EjbDiscoveryEnvironment.java 2008-12-23 14:31:38 UTC (rev 82530)
@@ -1,15 +1,12 @@
package org.jboss.webbeans.integration.jbossas.ejb3;
-import java.util.ArrayList;
import java.util.List;
+import java.util.ArrayList;
import javax.servlet.ServletContext;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
import org.jboss.kernel.spi.dependency.KernelController;
@@ -19,6 +16,7 @@
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.integration.jbossas.vdf.KernelControllerVDFConnector;
+import org.jboss.webbeans.integration.jbossas.vdf.VFSDeploymentUnitVDFConnector;
/**
* EjbDiscoveryEnvironment.
@@ -28,8 +26,6 @@
*/
public class EjbDiscoveryEnvironment
{
- private static final String MC_BEAN_NAME_MAIN_DEPLOYER = "MainDeployer";
-
private KernelController controller;
private EjbReferenceResolver resolver;
@@ -44,41 +40,20 @@
controller = controllerVDFConnector.getUtility();
resolver = (EjbReferenceResolver) lookup("org.jboss.ejb3.EjbReferenceResolver", true);
+ VFSDeploymentUnitVDFConnector duConnector = new VFSDeploymentUnitVDFConnector(servletContext);
+ if (duConnector.isValid() == false)
+ throw new IllegalArgumentException("No such DeploymentUnit utility: " + servletContext);
+
ejbs = new ArrayList<EjbDescriptor<?>>();
-
- discoverEjbs();
- }
- /**
- * Get ejbs.
- *
- * @return the ejbs
- */
- public List<EjbDescriptor<?>> getEjbs()
- {
- return ejbs;
- }
-
- /*
- * Look through all EJB3 DeploymentUnits
- */
- protected void discoverEjbs()
- {
- // Get at the MainDeployer
- Object mainDeployer = lookup(MC_BEAN_NAME_MAIN_DEPLOYER, true);
- if (mainDeployer instanceof DeployerClient == false || mainDeployer instanceof MainDeployerStructure == false)
- throw new IllegalArgumentException("Obtained Main Deployer is not of expected type: " + mainDeployer);
-
- DeployerClient dc = (DeployerClient) mainDeployer;
- MainDeployerStructure mds = (MainDeployerStructure) mainDeployer;
-
- // Loop through each Deployment
- for (Deployment d : dc.getTopLevel())
+ DeploymentUnit du = duConnector.getUtility();
+ DeploymentUnit top = du;
+ while (top != null)
{
- // Get the associated DU
- DeploymentUnit du = mds.getDeploymentUnit(d.getName());
- discoverEjbs(du);
+ du = top;
+ top = top.getParent();
}
+ discoverEjbs(du);
}
/**
@@ -107,9 +82,14 @@
}
}
}
- for (DeploymentUnit childDu : du.getChildren())
+
+ List<DeploymentUnit> children = du.getChildren();
+ if (children != null && children.isEmpty() == false)
{
- discoverEjbs(childDu);
+ for (DeploymentUnit childDu : children)
+ {
+ discoverEjbs(childDu);
+ }
}
}
@@ -146,4 +126,14 @@
// Return
return context.getTarget();
}
+
+ /**
+ * Get ejbs.
+ *
+ * @return the ejbs
+ */
+ public List<EjbDescriptor<?>> getEjbs()
+ {
+ return ejbs;
+ }
}
More information about the jboss-cvs-commits
mailing list