openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r453451 - in /incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/ assembler/spring/ core/
Date Fri, 06 Oct 2006 01:17:05 GMT
Author: dblevins
Date: Thu Oct  5 18:17:05 2006
New Revision: 453451

URL: http://svn.apache.org/viewvc?view=rev&rev=453451
Log:
Moved global JNDI building from ContainerSystem into Assembler where it should be.
Renamed the ContainerBuilder to ContainersBuilder as one instance builds all the containers
unlike how just one instance of EjbJarBuilder builds only one ejb jar.

Added:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainersBuilder.java
  (contents, props changed)
      - copied, changed from r453073, incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainerBuilder.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
Removed:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainerBuilder.java
Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/Assembler.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ContainerSystem.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?view=diff&rev=453451&r1=453450&r2=453451
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
Thu Oct  5 18:17:05 2006
@@ -221,15 +221,19 @@
             }
         }
 
+        JndiBuilder jndiBuilder = new JndiBuilder(containerSystem.getJNDIContext());
+
         /*[4] Apply method permissions, role refs, and tx attributes ////////////////////////////////////*/
-        ContainerBuilder containerBuilder = new ContainerBuilder(containerSystemInfo, ((AssemblerTool)this).props);
-        List containers = (List) containerBuilder.build();
+        ContainersBuilder containersBuilder = new ContainersBuilder(containerSystemInfo,
((AssemblerTool)this).props);
+        List containers = (List) containersBuilder.build();
         for (int i1 = 0; i1 < containers.size(); i1++) {
             Container container1 = (Container) containers.get(i1);
             containerSystem.addContainer(container1.getContainerID(), container1);
             org.apache.openejb.DeploymentInfo[] deployments1 = container1.deployments();
             for (int j = 0; j < deployments1.length; j++) {
-                containerSystem.addDeployment((CoreDeploymentInfo) deployments1[j]);
+                CoreDeploymentInfo deployment = (CoreDeploymentInfo) deployments1[j];
+                containerSystem.addDeployment(deployment);
+                jndiBuilder.bind(deployment);
             }
         }
 

Copied: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainersBuilder.java
(from r453073, incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainerBuilder.java)
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainersBuilder.java?view=diff&rev=453451&p1=incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainerBuilder.java&r1=453073&p2=incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainersBuilder.java&r2=453451
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainerBuilder.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainersBuilder.java
Thu Oct  5 18:17:05 2006
@@ -24,6 +24,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Properties;
+import java.util.Collection;
+import java.util.Iterator;
 
 import javax.transaction.TransactionManager;
 
@@ -35,11 +37,13 @@
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.RpcContainer;
 import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.core.ivm.naming.Reference;
+import org.apache.openejb.core.ivm.naming.ObjectReference;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.SecurityService;
 import org.apache.openejb.util.Logger;
 
-public class ContainerBuilder {
+public class ContainersBuilder {
 
     private static final Logger logger = Logger.getInstance("OpenEJB", "org.apache.openejb.util.resources");
 
@@ -48,12 +52,13 @@
     private final ContainerInfo[] containerInfos;
     private final String[] decorators;
 
-    public ContainerBuilder(ContainerSystemInfo containerSystemInfo, Properties props) {
+    public ContainersBuilder(ContainerSystemInfo containerSystemInfo, Properties props) {
         this.props = props;
         this.ejbJars = containerSystemInfo.ejbJars;
         this.containerInfos = containerSystemInfo.containers;
         String decorators = props.getProperty("openejb.container.decorators");
         this.decorators = (decorators == null) ? new String[]{} : decorators.split(":");
+
     }
 
     public Object build() throws OpenEJBException {
@@ -99,7 +104,7 @@
         }
         return containers;
     }
-
+    
     private Container buildContainer(ContainerInfo containerInfo, HashMap deploymentsList)
throws OpenEJBException {
         String containerName = containerInfo.containerName;
         ContainerInfo service = containerInfo;

Propchange: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ContainersBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author Id Revision HeadURL

Added: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?view=auto&rev=453451
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
(added)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
Thu Oct  5 18:17:05 2006
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.assembler.classic;
+
+import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.core.ivm.naming.Reference;
+import org.apache.openejb.core.ivm.naming.ObjectReference;
+
+import javax.naming.Context;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JndiBuilder {
+    private final Context context;
+
+    public JndiBuilder(Context context) {
+        this.context = context;
+    }
+
+    public void bind(DeploymentInfo deploymentInfo) {
+        CoreDeploymentInfo deployment = (CoreDeploymentInfo) deploymentInfo;
+        if (deployment.getHomeInterface() != null) {
+            bindProxy(deployment, deployment.getEJBHome(), false);
+        }
+        if (deployment.getLocalHomeInterface() != null) {
+            bindProxy(deployment, deployment.getEJBLocalHome(), true);
+        }
+    }
+
+    private void bindProxy(CoreDeploymentInfo deployment, Object proxy, boolean isLocal)
{
+        Reference ref = new ObjectReference(proxy);
+
+        if (deployment.getComponentType() == DeploymentInfo.STATEFUL) {
+            ref = new org.apache.openejb.core.stateful.EncReference(ref);
+        } else if (deployment.getComponentType() == DeploymentInfo.STATELESS) {
+            ref = new org.apache.openejb.core.stateless.EncReference(ref);
+        } else {
+            ref = new org.apache.openejb.core.entity.EncReference(ref);
+        }
+
+        try {
+
+            String bindName = deployment.getDeploymentID().toString();
+
+            if (bindName.charAt(0) == '/') {
+                bindName = bindName.substring(1);
+            }
+
+            bindName = "openejb/ejb/" + bindName;
+            if (isLocal) {
+                bindName += "Local";
+            }
+            context.bind(bindName, ref);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException();
+        }
+    }
+}

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/Assembler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/Assembler.java?view=diff&rev=453451&r1=453450&r2=453451
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/Assembler.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/Assembler.java
Thu Oct  5 18:17:05 2006
@@ -33,6 +33,7 @@
 import org.apache.openejb.Container;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.RpcContainer;
+import org.apache.openejb.assembler.classic.JndiBuilder;
 import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ContainerSystem;
 import org.apache.openejb.spi.SecurityService;
@@ -173,6 +174,7 @@
         //
         // Create the containers
         //
+        JndiBuilder jndiBuilder = new JndiBuilder(containerSystem.getJNDIContext());
         List<Container> containers = wrapContainers(AssemblerUtil.getBeans(factory,
Container.class));
         List<CoreDeploymentInfo> deployments = new ArrayList<CoreDeploymentInfo>();
         for (Container container : containers) {
@@ -182,6 +184,7 @@
                 deployment.setContainer(container);
                 deployments.add(deployment);
                 containerSystem.addDeployment(deployment);
+                jndiBuilder.bind(deployment);
             }
         }
 

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ContainerSystem.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ContainerSystem.java?view=diff&rev=453451&r1=453450&r2=453451
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ContainerSystem.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ContainerSystem.java
Thu Oct  5 18:17:05 2006
@@ -74,44 +74,8 @@
 
         this.deployments.put(deployment.getDeploymentID(), deployment);
 
-        if (deployment.getHomeInterface() != null) {
-            bindProxy(deployment, deployment.getEJBHome(), false);
-        }
-        if (deployment.getLocalHomeInterface() != null) {
-            bindProxy(deployment, deployment.getEJBLocalHome(), true);
-        }
     }
 
-    private void bindProxy(org.apache.openejb.core.CoreDeploymentInfo deployment, Object
proxy, boolean isLocal) {
-        Reference ref = new ObjectReference(proxy);
-
-        if (deployment.getComponentType() == DeploymentInfo.STATEFUL) {
-            ref = new org.apache.openejb.core.stateful.EncReference(ref);
-        } else if (deployment.getComponentType() == DeploymentInfo.STATELESS) {
-            ref = new org.apache.openejb.core.stateless.EncReference(ref);
-        } else {
-            ref = new org.apache.openejb.core.entity.EncReference(ref);
-        }
-
-        try {
-
-            String bindName = deployment.getDeploymentID().toString();
-
-            if (bindName.charAt(0) == '/') {
-                bindName = bindName.substring(1);
-            }
-
-            bindName = "openejb/ejb/" + bindName;
-            if (isLocal) {
-                bindName += "Local";
-            }
-            jndiRootContext.bind(bindName, ref);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException();
-        }
-    }
 
     public javax.naming.Context getJNDIContext() {
         return jndiRootContext;



Mime
View raw message