tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r766208 - in /openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/java/org/apache/openejb/client/ container/openejb-core/src/main/java/org/apache/openejb/core/ c...
Date Sat, 18 Apr 2009 03:28:12 GMT
Author: dblevins
Date: Sat Apr 18 03:28:12 2009
New Revision: 766208

URL: http://svn.apache.org/viewvc?rev=766208&view=rev
Log:
OPENEJB-1018: Support for exposing a single interface as @WebService, @Remote, and @Local
Another step in the right direction.  Split the internal openejb/ejb/ tree into two trees:
openejb/local and openejb/remote.  One is for the LocalInitialContextFactory and the other
is for the RemoteInitialContextFactory.  The business local and local home interfaces are
not bound into the openejb/remote tree.  The result is that if someone uses the same interface
as the remote and local business interface the LocalInitialContextFactory will always give
you the local view and the RemoteInitalContextFactory will always give you the remote view.

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/client/LocalInitialContext.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/InitContextFactory.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrMappingTests.java
    openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
    openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/WebAdminBean.java
    openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/httpd/HttpRequestImpl.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
Sat Apr 18 03:28:12 2009
@@ -874,9 +874,10 @@
         try {
             IvmContext ivmContext = (IvmContext) globalContext;
             ivmContext.prune("openejb/Deployment");
-            ivmContext.prune("openejb/ejb");
+            ivmContext.prune("openejb/local");
+            ivmContext.prune("openejb/remote");
         } catch (NamingException e) {
-            undeployException.getCauses().add(new Exception("Unable to prune openejb/Deployments
and openejb/ejb namespaces, this could cause future deployments to fail.", e));
+            undeployException.getCauses().add(new Exception("Unable to prune openejb/Deployments
and openejb/local namespaces, this could cause future deployments to fail.", e));
         }
 
         deployments.clear();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
Sat Apr 18 03:28:12 2009
@@ -266,9 +266,11 @@
             Class homeInterface = deployment.getHomeInterface();
             if (homeInterface != null) {
 
-                String name = "openejb/ejb/" + strategy.getName(homeInterface, JndiNameStrategy.Interface.REMOTE_HOME);
                 ObjectReference ref = new ObjectReference(deployment.getEJBHome());
-                bind(name, ref, bindings, beanInfo, homeInterface);
+
+                String name = strategy.getName(homeInterface, JndiNameStrategy.Interface.REMOTE_HOME);
+                bind("openejb/local/" + name, ref, bindings, beanInfo, homeInterface);
+                bind("openejb/remote/" + name, ref, bindings, beanInfo, homeInterface);
 
                 name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getRemoteInterface().getName());
                 bind(name, ref, bindings, beanInfo, homeInterface);
@@ -277,16 +279,17 @@
                 bind(name, ref, bindings, beanInfo, homeInterface);
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind home interface for deployment " +
id, e);
+            throw new RuntimeException("Unable to bind remote home interface for deployment
" + id, e);
         }
 
         try {
             Class localHomeInterface = deployment.getLocalHomeInterface();
             if (localHomeInterface != null) {
 
-                String name = "openejb/ejb/" + strategy.getName(deploymentInfo.getLocalHomeInterface(),
JndiNameStrategy.Interface.LOCAL_HOME);
                 ObjectReference ref = new ObjectReference(deployment.getEJBLocalHome());
-                bind(name, ref, bindings, beanInfo, localHomeInterface);
+
+                String name = strategy.getName(deploymentInfo.getLocalHomeInterface(), JndiNameStrategy.Interface.LOCAL_HOME);
+                bind("openejb/local/" + name, ref, bindings, beanInfo, localHomeInterface);
 
                 name = "openejb/Deployment/" + format(deployment.getDeploymentID(), deployment.getLocalInterface().getName());
                 bind(name, ref, bindings, beanInfo, localHomeInterface);
@@ -295,7 +298,7 @@
                 bind(name, ref, bindings, beanInfo, localHomeInterface);
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind local interface for deployment " +
id, e);
+            throw new RuntimeException("Unable to bind local home interface for deployment
" + id, e);
         }
 
         try {
@@ -313,7 +316,7 @@
                 String internalName = "openejb/Deployment/" + format(deployment.getDeploymentID(),
interfce.getName(), InterfaceType.BUSINESS_LOCAL);
                 bind(internalName, ref, bindings, beanInfo, interfce);
 
-                String externalName = "openejb/ejb/" + strategy.getName(interfce, JndiNameStrategy.Interface.BUSINESS_LOCAL);
+                String externalName = "openejb/local/" + strategy.getName(interfce, JndiNameStrategy.Interface.BUSINESS_LOCAL);
                 bind(externalName, ref, bindings, beanInfo, interfce);
             }
         } catch (NamingException e) {
@@ -336,8 +339,9 @@
                 String internalName = "openejb/Deployment/" + format(deployment.getDeploymentID(),
interfce.getName(), InterfaceType.BUSINESS_REMOTE);
                 bind(internalName, ref, bindings, beanInfo, interfce);
 
-                String externalName = "openejb/ejb/" + strategy.getName(interfce, JndiNameStrategy.Interface.BUSINESS_REMOTE);
-                bind(externalName, ref, bindings, beanInfo, interfce);
+                String name = strategy.getName(interfce, JndiNameStrategy.Interface.BUSINESS_REMOTE);
+                bind("openejb/local/" + name, ref, bindings, beanInfo, interfce);
+                bind("openejb/remote/" + name, ref, bindings, beanInfo, interfce);
             }
         } catch (NamingException e) {
             throw new RuntimeException("Unable to bind business remote deployment in jndi.",
e);
@@ -345,13 +349,14 @@
 
         try {
             if (MessageListener.class.equals(deployment.getMdbInterface())) {
-                String name = "openejb/ejb/" + deployment.getDeploymentID().toString();
 
                 String destinationId = deployment.getDestinationId();
                 String jndiName = "java:openejb/Resource/" + destinationId;
                 Reference reference = new IntraVmJndiReference(jndiName);
 
-                bind(name, reference, bindings, beanInfo, MessageListener.class);
+                String deploymentId = deployment.getDeploymentID().toString();
+                bind("openejb/local/" + deploymentId, reference, bindings, beanInfo, MessageListener.class);
+                bind("openejb/remote/" + deploymentId, reference, bindings, beanInfo, MessageListener.class);
             }
         } catch (NamingException e) {
             throw new RuntimeException("Unable to bind mdb destination in jndi.", e);
@@ -380,12 +385,15 @@
 
     private void bind(String name, Reference ref, Bindings bindings, EnterpriseBeanInfo beanInfo,
Class intrface) throws NamingException {
 
-        if (name.startsWith("openejb/ejb/")) {
+        if (name.startsWith("openejb/local/") || name.startsWith("openejb/remote/")) {
 
-            String externalName = name.replaceFirst("openejb/ejb/", "");
+            String externalName = name.replaceFirst("openejb/[^/]+/", "");
 
             if (bindings.contains(name)){
-                logger.debug("Duplicate: Jndi(name=" + externalName +")");
+                // We bind under two sections of jndi, only warn once.. the user doesn't
need to be bothered with that detail
+                if (name.startsWith("openejb/local/")) {
+                    logger.debug("Duplicate: Jndi(name=" + externalName +")");
+                }
                 return;
             }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/client/LocalInitialContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/client/LocalInitialContext.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/client/LocalInitialContext.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/client/LocalInitialContext.java
Sat Apr 18 03:28:12 2009
@@ -203,7 +203,7 @@
     private static Context getContainerSystemEjbContext() throws NamingException {
         ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
         Context context = containerSystem.getJNDIContext();
-        context = (Context) context.lookup("openejb/ejb");
+        context = (Context) context.lookup("openejb/local");
         return context;
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
Sat Apr 18 03:28:12 2009
@@ -36,7 +36,7 @@
      * Constructs a CoreContainerSystem and initializes the root JNDI context.
      * It also creates three sub contexts, namely
      * <ul>
-     *  <li>java:openejb/ejb</li>
+     *  <li>java:openejb/local</li>
      *  <li>java:openejb/client</li>
      *  <li>java:openejb/Deployment</li>
      * </ul>
@@ -49,10 +49,11 @@
 
             jndiRootContext = IvmContext.createRootContext();
 
-            jndiRootContext.createSubcontext("java:openejb/ejb");
+            jndiRootContext.createSubcontext("java:openejb/local");
             jndiRootContext.createSubcontext("java:openejb/client");
             jndiRootContext.createSubcontext("java:openejb/Deployment");
-            jndiRootContext.bind("openejb/ejb/.", "");
+            jndiRootContext.bind("openejb/local/.", "");
+            jndiRootContext.bind("openejb/remote/.", "");
             jndiRootContext.bind("openejb/client/.", "");
             jndiRootContext.bind("openejb/Deployment/.", "");
         }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/InitContextFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/InitContextFactory.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/InitContextFactory.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/InitContextFactory.java
Sat Apr 18 03:28:12 2009
@@ -59,7 +59,7 @@
 
         ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
         Context context = containerSystem.getJNDIContext();
-        context = (Context) context.lookup("java:openejb/ejb");
+        context = (Context) context.lookup("java:openejb/local");
         return context;
 
     }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
Sat Apr 18 03:28:12 2009
@@ -264,6 +264,7 @@
             ClassFinder finder = new ClassFinder(interceptor.getClass());
             providerData.getAroundInvoke().addAll(finder.findAnnotatedMethods(AroundInvoke.class));
             interceptorDatas.add(providerData);
+//            interceptorDatas.add(0, providerData);
         }
 
         InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod,
Operation.BUSINESS_WS, interceptorDatas, interceptors);

Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrMappingTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrMappingTests.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrMappingTests.java
(original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrMappingTests.java
Sat Apr 18 03:28:12 2009
@@ -65,9 +65,9 @@
         compoundPK_20_20 = new Integer(20);
         compoundPK_20_20_field1 = new Integer(20);
 
-        oneInverseHome = (OneInverseSideLocalHome) initialContext.lookup("java:openejb/ejb/client/tests/entity/cmp2/OneInverseSideBean/EJBHomeLocal");
-        oneOwningHome = (OneOwningSideLocalHome) initialContext.lookup("java:openejb/ejb/client/tests/entity/cmp2/OneOwningSideBean/EJBHomeLocal");
-        manyHome = (ManyOwningSideLocalHome) initialContext.lookup("java:openejb/ejb/client/tests/entity/cmp2/ManyOwningSideBean/EJBHomeLocal");
+        oneInverseHome = (OneInverseSideLocalHome) initialContext.lookup("java:openejb/local/client/tests/entity/cmp2/OneInverseSideBean/EJBHomeLocal");
+        oneOwningHome = (OneOwningSideLocalHome) initialContext.lookup("java:openejb/local/client/tests/entity/cmp2/OneOwningSideBean/EJBHomeLocal");
+        manyHome = (ManyOwningSideLocalHome) initialContext.lookup("java:openejb/local/client/tests/entity/cmp2/ManyOwningSideBean/EJBHomeLocal");
     }
 
     public void testOneToOneSetCMROnOwningSide() throws Exception {

Modified: openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
(original)
+++ openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
Sat Apr 18 03:28:12 2009
@@ -77,7 +77,7 @@
 
     JndiRequestHandler(EjbDaemon daemon) throws Exception {
         ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
-        ejbJndiTree = (Context) containerSystem.getJNDIContext().lookup("openejb/ejb");
+        ejbJndiTree = (Context) containerSystem.getJNDIContext().lookup("openejb/remote");
         deploymentsJndiTree = (Context) containerSystem.getJNDIContext().lookup("openejb/Deployment");
         try {
             clientJndiTree = (Context) containerSystem.getJNDIContext().lookup("openejb/client");

Modified: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/WebAdminBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/WebAdminBean.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/WebAdminBean.java
(original)
+++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/WebAdminBean.java
Sat Apr 18 03:28:12 2009
@@ -332,7 +332,7 @@
         try{
             ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
             Context ctx = containerSystem.getJNDIContext();
-            ctx = (Context) ctx.lookup("openejb/ejb");
+            ctx = (Context) ctx.lookup("openejb/local");
             NamingEnumeration enumeration = ctx.list("");
             //System.out.println("\n\nENUM "+enumeration);
 

Modified: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/httpd/HttpRequestImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/httpd/HttpRequestImpl.java?rev=766208&r1=766207&r2=766208&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/httpd/HttpRequestImpl.java
(original)
+++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/httpd/HttpRequestImpl.java
Sat Apr 18 03:28:12 2009
@@ -627,7 +627,7 @@
         WebSessionHome home = null;
 
         try {
-            home = (WebSessionHome)new InitialContext().lookup("java:openejb/ejb/httpd/session");
+            home = (WebSessionHome)new InitialContext().lookup("java:openejb/local/httpd/session");
         } catch (NamingException e) {
             // TODO Auto-generated catch block
             throw new IllegalStateException("The WebSessionBean has not been deployed. "+



Mime
View raw message