dain        2006/02/01 06:50:03

  Modified:    modules/core/src/java/org/openejb/cluster/server
                        ClusteredInstanceContextFactory.java
                        ClusteredInstanceInterceptor.java
                        DefaultEJBClusterManager.java
                        EJBClusterManager.java EJBInvocationContext.java
  Added:       modules/core/src/java/org/openejb/cluster/server
                        ClusteredEjbDeployment.java
                        DefaultClusteredEjbDeployment.java
  Removed:     modules/core/src/java/org/openejb/cluster/server
                        ClusteredEJBContainer.java
                        DefaultClusteredEJBContainer.java
  Log:

  Major refactor
  Split container into an object to represent a deployed ejb and a set of 
shared containers which process invocations
  Introduced interface between CMP container and CMP engine
  
  Revision  Changes    Path
  1.2       +3 -3      
openejb/modules/core/src/java/org/openejb/cluster/server/ClusteredInstanceContextFactory.java
  
  Index: ClusteredInstanceContextFactory.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/cluster/server/ClusteredInstanceContextFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClusteredInstanceContextFactory.java      21 Dec 2005 14:21:50 -0000      
1.1
  +++ ClusteredInstanceContextFactory.java      1 Feb 2006 11:50:03 -0000       
1.2
  @@ -51,7 +51,7 @@
    * @version $Revision$ $Date$

    */

   public interface ClusteredInstanceContextFactory extends 
InstanceContextFactory {

  -    void setEJBClusterManager(EJBClusterManager clusteredManager);

  +    void setClusterManager(EJBClusterManager clusteredManager);

   

       void setServersHolder(ServerMetaDataArrayHolder serversHolder);

   

  
  
  
  1.2       +4 -4      
openejb/modules/core/src/java/org/openejb/cluster/server/ClusteredInstanceInterceptor.java
  
  Index: ClusteredInstanceInterceptor.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/cluster/server/ClusteredInstanceInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClusteredInstanceInterceptor.java 21 Dec 2005 14:21:50 -0000      1.1
  +++ ClusteredInstanceInterceptor.java 1 Feb 2006 11:50:03 -0000       1.2
  @@ -48,7 +48,7 @@
   import org.apache.geronimo.core.service.Invocation;

   import org.apache.geronimo.core.service.InvocationResult;

   import org.openejb.EJBInstanceContext;

  -import org.openejb.EJBInvocation;

  +import org.openejb.EjbInvocation;

   

   /**

    * 

  @@ -64,7 +64,7 @@
       public InvocationResult invoke(final Invocation invocation) throws 
Throwable {

           InvocationResult result = next.invoke(invocation);

           

  -        EJBInvocation ejbInvocation = (EJBInvocation) invocation;

  +        EjbInvocation ejbInvocation = (EjbInvocation) invocation;

           EJBInstanceContext context = ejbInvocation.getEJBInstanceContext();

           if (context instanceof ClusteredEJBInstanceContext) {

               ClusteredEJBInstanceContext clusteredContext = 
(ClusteredEJBInstanceContext) context;

  
  
  
  1.2       +8 -8      
openejb/modules/core/src/java/org/openejb/cluster/server/DefaultEJBClusterManager.java
  
  Index: DefaultEJBClusterManager.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/cluster/server/DefaultEJBClusterManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultEJBClusterManager.java     21 Dec 2005 14:21:50 -0000      1.1
  +++ DefaultEJBClusterManager.java     1 Feb 2006 11:50:03 -0000       1.2
  @@ -162,15 +162,15 @@
                   null);

       }

       

  -    public void addEJBContainer(ClusteredEJBContainer container) {

  -        Object containerID = container.getContainerID();

  +    public void addEJBContainer(ClusteredEjbDeployment container) {

  +        Object containerID = container.getContainerId();

           ClusteredInstanceCache cache = container.getInstanceCache();

           ClusteredInstanceContextFactory factory = 
container.getInstanceContextFactory();

           

           EJBInstanceContextRecreator recreator = 
factory.getInstanceContextRecreator();

           recreatorSelector.addMapping(containerID, recreator);

           cache.setEJBClusterManager(this);

  -        factory.setEJBClusterManager(this);

  +        factory.setClusterManager(this);

           

           ServerMetaDataArrayHolder holder;

           synchronized (contIdToServersMDHolder) {

  @@ -185,14 +185,14 @@
           advertiser.advertiseJoin(containerID);

       }

   

  -    public void removeEJBContainer(ClusteredEJBContainer container) {

  -        Object containerID = container.getContainerID();

  +    public void removeEJBContainer(ClusteredEjbDeployment container) {

  +        Object containerID = container.getContainerId();

           ClusteredInstanceCache cache = container.getInstanceCache();

           ClusteredInstanceContextFactory factory = 
container.getInstanceContextFactory();

   

           recreatorSelector.removeMapping(containerID);

           cache.setEJBClusterManager(null);

  -        factory.setEJBClusterManager(null);

  +        factory.setClusterManager(null);

           factory.setServersHolder(null);

   

           advertiser.advertiseLeave(containerID);

  
  
  
  1.2       +4 -4      
openejb/modules/core/src/java/org/openejb/cluster/server/EJBClusterManager.java
  
  Index: EJBClusterManager.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/cluster/server/EJBClusterManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EJBClusterManager.java    21 Dec 2005 14:21:50 -0000      1.1
  +++ EJBClusterManager.java    1 Feb 2006 11:50:03 -0000       1.2
  @@ -54,9 +54,9 @@
    * @version $Revision$ $Date$

    */

   public interface EJBClusterManager {

  -    void addEJBContainer(ClusteredEJBContainer container);

  +    void addEJBContainer(ClusteredEjbDeployment container);

   

  -    void removeEJBContainer(ClusteredEJBContainer container);

  +    void removeEJBContainer(ClusteredEjbDeployment container);

       

       void putInstanceInCache(InstanceCache cache, String beanId);

   

  
  
  
  1.2       +6 -6      
openejb/modules/core/src/java/org/openejb/cluster/server/EJBInvocationContext.java
  
  Index: EJBInvocationContext.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/cluster/server/EJBInvocationContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EJBInvocationContext.java 21 Dec 2005 14:21:50 -0000      1.1
  +++ EJBInvocationContext.java 1 Feb 2006 11:50:03 -0000       1.2
  @@ -59,7 +59,7 @@
   public class EJBInvocationContext implements InvocationContext {

       private final boolean proxiedInvocation;

       private final InstanceCache cache;

  -    

  +

       public EJBInvocationContext(InstanceCache cache) {

           this.cache = cache;

           this.proxiedInvocation = false;

  @@ -71,7 +71,7 @@
       }

   

       public void invoke(PoolableInvocationWrapper wrapper) throws 
InvocationException {

  -        if (false == wrapper instanceof EJBInvocationWrapper) {

  +        if (!(wrapper instanceof EJBInvocationWrapper)) {

               throw new IllegalArgumentException(EJBInvocationProxy.class +

                       " is expected.");

           }

  @@ -82,13 +82,13 @@
           Object id = sessionUtil.getId();

           InstanceContext context = invWrap.getInstanceContext();

   

  -        if (false == context instanceof StatefulInstanceContext) {

  +        if (!(context instanceof StatefulInstanceContext)) {

               throw new IllegalStateException("Context should be a " +

                       StatefulInstanceContext.class +

                       ". Was " + context.getClass());

           }

           StatefulInstanceContext sfContext = (StatefulInstanceContext) 
context;

  -        

  +

           sfContext.setCache(cache);

           cache.putInactive(id, context);

       }

  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/cluster/server/ClusteredEjbDeployment.java
  
  Index: ClusteredEjbDeployment.java
  ===================================================================
  /**

   * Redistribution and use of this software and associated documentation

   * ("Software"), with or without modification, are permitted provided

   * that the following conditions are met:

   *

   * 1. Redistributions of source code must retain copyright

   *    statements and notices.  Redistributions must also contain a

   *    copy of this document.

   *

   * 2. Redistributions in binary form must reproduce the

   *    above copyright notice, this list of conditions and the

   *    following disclaimer in the documentation and/or other

   *    materials provided with the distribution.

   *

   * 3. The name "OpenEJB" must not be used to endorse or promote

   *    products derived from this Software without prior written

   *    permission of The OpenEJB Group.  For written permission,

   *    please contact [EMAIL PROTECTED]

   *

   * 4. Products derived from this Software may not be called "OpenEJB"

   *    nor may "OpenEJB" appear in their names without prior written

   *    permission of The OpenEJB Group. OpenEJB is a registered

   *    trademark of The OpenEJB Group.

   *

   * 5. Due credit should be given to the OpenEJB Project

   *    (http://openejb.org/).

   *

   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS

   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT

   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL

   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,

   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES

   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR

   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,

   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED

   * OF THE POSSIBILITY OF SUCH DAMAGE.

   *

   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.

   *

   * $Id: ClusteredEjbDeployment.java,v 1.1 2006/02/01 11:50:03 dain Exp $

   */

  package org.openejb.cluster.server;

  

  import org.openejb.RpcEjbDeployment;

  

  

  /**

   * 

   * @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:03 $

   */

  public interface ClusteredEjbDeployment extends RpcEjbDeployment {

      ClusteredInstanceCache getInstanceCache();

      

      ClusteredInstanceContextFactory getInstanceContextFactory();

  }
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/cluster/server/DefaultClusteredEjbDeployment.java
  
  Index: DefaultClusteredEjbDeployment.java
  ===================================================================
  /**

   * Redistribution and use of this software and associated documentation

   * ("Software"), with or without modification, are permitted provided

   * that the following conditions are met:

   *

   * 1. Redistributions of source code must retain copyright

   *    statements and notices.  Redistributions must also contain a

   *    copy of this document.

   *

   * 2. Redistributions in binary form must reproduce the

   *    above copyright notice, this list of conditions and the

   *    following disclaimer in the documentation and/or other

   *    materials provided with the distribution.

   *

   * 3. The name "OpenEJB" must not be used to endorse or promote

   *    products derived from this Software without prior written

   *    permission of The OpenEJB Group.  For written permission,

   *    please contact [EMAIL PROTECTED]

   *

   * 4. Products derived from this Software may not be called "OpenEJB"

   *    nor may "OpenEJB" appear in their names without prior written

   *    permission of The OpenEJB Group. OpenEJB is a registered

   *    trademark of The OpenEJB Group.

   *

   * 5. Due credit should be given to the OpenEJB Project

   *    (http://openejb.org/).

   *

   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS

   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT

   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL

   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,

   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES

   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR

   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,

   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED

   * OF THE POSSIBILITY OF SUCH DAMAGE.

   *

   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.

   *

   * $Id: DefaultClusteredEjbDeployment.java,v 1.1 2006/02/01 11:50:03 dain Exp 
$

   */

  package org.openejb.cluster.server;

  

  import java.io.Serializable;

  import java.lang.reflect.Method;

  

  import javax.ejb.EJBHome;

  import javax.ejb.EJBLocalHome;

  import javax.ejb.EJBLocalObject;

  import javax.ejb.EJBObject;

  import javax.security.auth.Subject;

  

  import org.apache.geronimo.core.service.Invocation;

  import org.apache.geronimo.core.service.InvocationResult;

  import org.openejb.RpcEjbDeployment;

  import org.openejb.EjbDeployment;

  import org.openejb.dispatch.InterfaceMethodSignature;

  import org.openejb.proxy.ProxyInfo;

  

  

  /**

   * 

   * @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:03 $

   */

  public class DefaultClusteredEjbDeployment implements ClusteredEjbDeployment {

      private final RpcEjbDeployment container;

      private final ClusteredInstanceCache cache;

      private final ClusteredInstanceContextFactory factory;

  

      public DefaultClusteredEjbDeployment(RpcEjbDeployment container, 
ClusteredInstanceCache cache, ClusteredInstanceContextFactory factory) {

          this.container = container;

          this.cache = cache;

          this.factory = factory;

      }

  

      public ClassLoader getClassLoader() {

          return container.getClassLoader();

      }

  

      public String getContainerId() {

          return container.getContainerId();

      }

  

      public Subject getDefaultSubject() {

          return container.getDefaultSubject();

      }

  

      public EJBHome getEjbHome() {

          return container.getEjbHome();

      }

  

      public EJBLocalHome getEjbLocalHome() {

          return container.getEjbLocalHome();

      }

  

      public EJBLocalObject getEjbLocalObject(Object primaryKey) {

          return container.getEjbLocalObject(primaryKey);

      }

  

      public String getEjbName() {

          return container.getEjbName();

      }

  

      public EJBObject getEjbObject(Object primaryKey) {

          return container.getEjbObject(primaryKey);

      }

  

      public Serializable getHomeTxPolicyConfig() {

          return container.getHomeTxPolicyConfig();

      }

  

      public String[] getJndiNames() {

          return container.getJndiNames();

      }

  

      public String[] getLocalJndiNames() {

          return container.getLocalJndiNames();

      }

  

      public int getMethodIndex(Method method) {

          return container.getMethodIndex(method);

      }

  

      public ProxyInfo getProxyInfo() {

          return container.getProxyInfo();

      }

  

      public Serializable getRemoteTxPolicyConfig() {

          return container.getRemoteTxPolicyConfig();

      }

  

      public InterfaceMethodSignature[] getSignatures() {

          return container.getSignatures();

      }

  

      public EjbDeployment getUnmanagedReference() {

          return container.getUnmanagedReference();

      }

  

      public InvocationResult invoke(Invocation arg0) throws Throwable {

          return container.invoke(arg0);

      }

  

      public Object invoke(Method callMethod, Object[] args, Object primKey) 
throws Throwable {

          return container.invoke(callMethod, args, primKey);

      }

  

      public ClusteredInstanceCache getInstanceCache() {

          return cache;

      }

  

      public ClusteredInstanceContextFactory getInstanceContextFactory() {

          return factory;

      }

  }
  
  

Reply via email to