[jboss-cvs] JBossAS SVN: r86870 - in projects/webbeans-ri-int/trunk: microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/deployer/env and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 6 15:08:39 EDT 2009
Author: petemuir
Date: 2009-04-06 15:08:39 -0400 (Mon, 06 Apr 2009)
New Revision: 86870
Added:
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossResourceServices.java
Modified:
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbServices.java
projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/deployer/env/WebBeansBootstrapDeployer.java
Log:
WBX-15
Modified: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbServices.java
===================================================================
--- projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbServices.java 2009-04-06 19:00:01 UTC (rev 86869)
+++ projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbServices.java 2009-04-06 19:08:39 UTC (rev 86870)
@@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.inject.manager.InjectionPoint;
import javax.naming.NamingException;
@@ -21,7 +20,6 @@
import org.jboss.webbeans.ejb.api.SessionObjectReference;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.integration.ejb.util.Reflections;
import org.jboss.webbeans.integration.vdf.DeploymentUnitAware;
import org.jboss.webbeans.resources.spi.NamingContext;
@@ -108,55 +106,6 @@
};
}
- public Object resolveResource(InjectionPoint injectionPoint)
- {
- if (!injectionPoint.isAnnotationPresent(Resource.class))
- {
- throw new IllegalArgumentException("No @Resource annotation found on injection point " + injectionPoint);
- }
- if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1)
- {
- throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint);
- }
- String name = getResourceName(injectionPoint);
- return naming.lookup(name, Object.class);
- }
-
- private static String getResourceName(InjectionPoint injectionPoint)
- {
- Resource resource = injectionPoint.getAnnotation(Resource.class);
- String mappedName = resource.mappedName();
- if (!mappedName.equals(""))
- {
- return mappedName;
- }
- String name = resource.name();
- if (!name.equals(""))
- {
- return RESOURCE_LOOKUP_PREFIX + "/" + name;
- }
- String propertyName;
- if (injectionPoint.getMember() instanceof Field)
- {
- propertyName = injectionPoint.getMember().getName();
- }
- else if (injectionPoint.getMember() instanceof Method)
- {
- propertyName = Reflections.getPropertyName((Method) injectionPoint.getMember());
- if (propertyName == null)
- {
- throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (unable to determine property name) " + injectionPoint);
- }
- }
- else
- {
- throw new AssertionError("Unable to inject into " + injectionPoint);
- }
- String className = injectionPoint.getMember().getDeclaringClass().getName();
- return RESOURCE_LOOKUP_PREFIX + "/" + className + "/" + propertyName;
- }
-
-
/**
* Discover ejbs.
*
Added: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossResourceServices.java
===================================================================
--- projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossResourceServices.java (rev 0)
+++ projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossResourceServices.java 2009-04-06 19:08:39 UTC (rev 86870)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.integration.ejb;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.webbeans.resources.spi.helpers.AbstractResourceServices;
+
+public class JBossResourceServices extends AbstractResourceServices
+{
+
+ private final Context context;
+
+ public JBossResourceServices() throws NamingException
+ {
+ this.context = new InitialContext();
+ }
+
+ @Override
+ protected Context getContext()
+ {
+ return context;
+ }
+
+}
Property changes on: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossResourceServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/deployer/env/WebBeansBootstrapDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/deployer/env/WebBeansBootstrapDeployer.java 2009-04-06 19:00:01 UTC (rev 86869)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/deployer/env/WebBeansBootstrapDeployer.java 2009-04-06 19:08:39 UTC (rev 86870)
@@ -63,6 +63,7 @@
bootstrap.addPropertyMetaData("webBeanDiscovery", bootstrap.createInject(envName));
bootstrap.addPropertyMetaData("ejbServices", createEjbConnector("JBossEjbServices", "org.jboss.webbeans.integration.ejb.JBossEjbServices", unit));
bootstrap.addPropertyMetaData("jpaServices", createEjbConnector("JBossJpaServices", "org.jboss.webbeans.integration.ejb.JBossJpaServices", unit));
+ bootstrap.addPropertyMetaData("resourceServices", bootstrap.createInject("JBossResourceServices"));
bootstrap.addPropertyMetaData("transactionServices", bootstrap.createInject("JBossTransactionServices"));
bootstrap.addPropertyMetaData("applicationContext", createBeanStore());
bootstrap.addPropertyMetaData("environment", Environments.EE);
More information about the jboss-cvs-commits
mailing list