geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r499627 - in /geronimo/server/trunk: configs/openejb-deployer/src/plan/ modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deploy...
Date Thu, 25 Jan 2007 00:24:50 GMT
Author: dain
Date: Wed Jan 24 16:24:49 2007
New Revision: 499627

URL: http://svn.apache.org/viewvc?view=rev&rev=499627
Log:
Flattened hierarch of ejb-ref builder

Added:
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
      - copied, changed from r499569, geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/EjbRefBuilder.java
Removed:
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/
Modified:
    geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml

Modified: geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml?view=diff&rev=499627&r1=499626&r2=499627
==============================================================================
--- geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml Wed Jan 24 16:24:49 2007
@@ -63,7 +63,7 @@
     </gbean>
 
 
-    <gbean name="EjbRefBuilder" class="org.apache.geronimo.openejb.deployment.ejbref.EjbRefBuilder">
+    <gbean name="EjbRefBuilder" class="org.apache.geronimo.openejb.deployment.EjbRefBuilder">
         <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee</attribute>
         <xml-attribute name="defaultEnvironment">
             <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
@@ -78,7 +78,7 @@
         </xml-attribute>
     </gbean>
 
-    <gbean name="ClientEjbRefBuilder" class="org.apache.geronimo.openejb.deployment.ejbref.ClientEjbRefBuilder">
+    <gbean name="ClientEjbRefBuilder" class="org.apache.geronimo.openejb.deployment.EjbRefBuilder">
         <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee</attribute>
         <attribute name="host">${PlanClientAddresses}</attribute>
         <attribute name="port">${PlanOpenEJBPort}</attribute>

Copied: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
(from r499569, geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/EjbRefBuilder.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java?view=diff&rev=499627&p1=geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/EjbRefBuilder.java&r1=499569&p2=geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java&r2=499627
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/EjbRefBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
Wed Jan 24 16:24:49 2007
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.geronimo.openejb.deployment.ejbref;
+package org.apache.geronimo.openejb.deployment;
 
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -42,7 +44,7 @@
 import org.apache.geronimo.kernel.config.MultiParentClassLoader;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
-import org.apache.geronimo.openejb.deployment.EjbModuleBuilder;
+import org.apache.geronimo.openejb.ClientEjbReference;
 import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
 import org.apache.geronimo.xbeans.javaee.EjbRefType;
 import org.apache.geronimo.xbeans.javaee.InjectionTargetType;
@@ -52,6 +54,7 @@
 import org.apache.openejb.assembler.classic.EjbJarInfo;
 import org.apache.openejb.assembler.classic.JndiEncBuilder;
 import org.apache.openejb.assembler.classic.JndiEncInfo;
+import org.apache.openejb.core.ivm.naming.IntraVmJndiReference;
 import org.apache.openejb.jee.EjbLocalRef;
 import org.apache.openejb.jee.EjbRef;
 import org.apache.openejb.jee.InjectionTarget;
@@ -70,9 +73,16 @@
 
     private final QNameSet ejbRefQNameSet;
     private final QNameSet ejbLocalRefQNameSet;
+    private final URI uri;
 
-    public EjbRefBuilder(Environment defaultEnvironment, String[] eeNamespaces) {
+    public EjbRefBuilder(Environment defaultEnvironment, String[] eeNamespaces, String host,
int port) throws URISyntaxException {
         super(defaultEnvironment);
+        if (host != null) {
+            uri = new URI("ejb", null, host, port, null, null, null);
+        } else {
+            uri = null;
+        }
+
         ejbRefQNameSet = buildQNameSet(eeNamespaces, "ejb-ref");
         ejbLocalRefQNameSet = buildQNameSet(eeNamespaces, "ejb-local-ref");
         ejbRefQNameSet.union(ejbLocalRefQNameSet);
@@ -120,14 +130,22 @@
 
             // if this is a ref it will be prefixed with env/
             if (name.startsWith("env/")) {
-                getJndiContextMap(componentContext).put(name, wrapReference(value));
+                if (uri != null) {
+                    value = createClientRef(value);
+                }
+                getJndiContextMap(componentContext).put(name, value);
             }
         }
     }
 
-    // this method exists so client refs can be made remote
-    protected Object wrapReference(Object value) {
-        return value;
+    private Object createClientRef(Object value) {
+        IntraVmJndiReference intraVmJndiReference = (IntraVmJndiReference) value;
+        String deploymentId = intraVmJndiReference.getJndiName();
+        if (deploymentId.startsWith("java:openejb/ejb/")) {
+            deploymentId = deploymentId.substring("java:openejb/ejb/".length());
+        }
+        ClientEjbReference clientRef = new ClientEjbReference(uri.toString(), deploymentId);
+        return clientRef;
     }
 
     protected JndiConsumer createJndiConsumer(XmlObject specDD) throws DeploymentException
{
@@ -343,10 +361,13 @@
 
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EjbRefBuilder.class,
NameFactory.MODULE_BUILDER);
+
         infoBuilder.addAttribute("eeNamespaces", String[].class, true, true);
         infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true);
+        infoBuilder.addAttribute("host", String.class, true);
+        infoBuilder.addAttribute("port", int.class, true);
 
-        infoBuilder.setConstructor(new String[]{"defaultEnvironment", "eeNamespaces"});
+        infoBuilder.setConstructor(new String[]{"defaultEnvironment", "eeNamespaces", "host",
"port"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }



Mime
View raw message