[jboss-cvs] JBossAS SVN: r82265 - in projects/webbeans-ri-int/trunk: jbossas and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Dec 14 15:30:56 EST 2008
Author: petemuir
Date: 2008-12-14 15:30:55 -0500 (Sun, 14 Dec 2008)
New Revision: 82265
Added:
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/EjbDiscovery.java
Modified:
projects/webbeans-ri-int/trunk/jbossas/pom.xml
projects/webbeans-ri-int/trunk/pom.xml
Log:
start adding EJB3 support
Modified: projects/webbeans-ri-int/trunk/jbossas/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/pom.xml 2008-12-14 11:28:41 UTC (rev 82264)
+++ projects/webbeans-ri-int/trunk/jbossas/pom.xml 2008-12-14 20:30:55 UTC (rev 82265)
@@ -183,6 +183,12 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
<scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-common</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/EjbDiscovery.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/EjbDiscovery.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/EjbDiscovery.java 2008-12-14 20:30:55 UTC (rev 82265)
@@ -0,0 +1,80 @@
+package org.jboss.webbeans.integration.jbossas;
+
+import java.rmi.NotBoundException;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.Kernel;
+import org.jboss.webbeans.integration.jbossas.vdf.KernelVDFConnector;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+public class EjbDiscovery
+{
+
+ private static final LogProvider log = Logging.getLogProvider(EjbDiscovery.class);
+
+ private Kernel kernel;
+
+ public EjbDiscovery(ServletContext servletContext)
+ {
+ KernelVDFConnector kernelVDFConnector = new KernelVDFConnector(servletContext);
+ kernel = kernelVDFConnector.getUtility();
+ }
+
+ /**
+ * Obtains the value bound at the specified name,
+ * throwing RuntimeException if there is nothing
+ * bound at the key. If the "checkInstalled"
+ * flag is true, this implementation will
+ * also ensure that the lookup value is of
+ * ControllerState.INSTALLED, else NotBoundException
+ *
+ * @param name
+ * @param checkInstalled
+ * @throws NotBoundException
+ * @return
+ */
+ public Object lookup(final Object name, boolean checkInstalled) throws NotBoundException
+ {
+ // Get Controller Context
+ ControllerContext context = kernel.getController().getContext(name, null);
+
+ // Ensure Bound
+ if (context == null || context.getTarget() == null)
+ {
+ throw new NotBoundException("Requested value bound at name \"" + name + "\" is not bound.");
+ }
+
+ // If we're checking for installed
+ if (checkInstalled)
+ {
+ // Get State
+ ControllerState state = context.getState();
+
+ // If State is other than INSTALLED
+ if (!state.equals(ControllerState.INSTALLED))
+ {
+ throw new NotBoundException("Object is bound at key " + name
+ + ", but is not fully installed, instead of state: " + state);
+ }
+
+ }
+
+ // If there's an error with the context, throw it
+ Throwable error = context.getError();
+ if (error != null)
+ {
+ throw new RuntimeException("Could not lookup object at name \"" + name
+ + "\" due to an error with the underlying " + ControllerContext.class.getSimpleName(), error);
+ }
+
+ // Return
+ Object target = context.getTarget();
+ log.debug("Returning from name \"" + name + "\": " + target);
+ return target;
+ }
+
+}
Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/EjbDiscovery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: projects/webbeans-ri-int/trunk/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/pom.xml 2008-12-14 11:28:41 UTC (rev 82264)
+++ projects/webbeans-ri-int/trunk/pom.xml 2008-12-14 20:30:55 UTC (rev 82265)
@@ -33,7 +33,8 @@
<version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
<version.jboss.classloading.spi>5.0.1.GA</version.jboss.classloading.spi>
<version.jboss.metadata>1.0.0.CR5</version.jboss.metadata>
- <version.jbossxb>2.0.0.GA</version.jbossxb>
+ <version.jbossxb>2.0.0.GA</version.jbossxb>
+ <version.jboss.ejb3>1.0.0-SNAPSHOT</version.jboss.ejb3>
<version.servlet.api>2.5</version.servlet.api>
<version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
<version.junit>4.4</version.junit>
@@ -326,6 +327,12 @@
<artifactId>servlet-api</artifactId>
<version>${version.servlet.api}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-common</artifactId>
+ <version>${version.jboss.ejb3}</version>
+ </dependency>
<!-- test dependencies -->
More information about the jboss-cvs-commits
mailing list