geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/lock LockInterceptor.java
Date Sat, 23 Aug 2003 22:09:39 GMT
jboynes     2003/08/23 15:09:39

  Modified:    modules/core/src/java/org/apache/geronimo/common
                        AbstractInterceptor.java AbstractRPCContainer.java
               modules/core/src/java/org/apache/geronimo/ejb
                        CallbackInterceptor.java
                        StatelessLifeCycleInterceptor.java
               modules/core/src/java/org/apache/geronimo/ejb/cache
                        StatefulInstanceInterceptor.java
                        StatefulSessionSynchronizationInterceptor.java
                        StatelessInstanceInterceptor.java
               modules/core/src/java/org/apache/geronimo/ejb/context
                        ExecutionContextInterceptor.java
                        StatelessBMTInterceptor.java
                        TransactionInterceptor.java
               modules/core/src/java/org/apache/geronimo/lock
                        LockInterceptor.java
  Log:
  Interceptors are not Components so remove dependency
  
  There is nothing here to invoke doStart() and doStop() so we need
  a better solution for interceptor lifecycle. However, we do not, as yet,
  have a mechanism for starting a generic interceptor stack, so lifecycle can
  be postponed until then. I don't think it was being used anyway.
  
  Revision  Changes    Path
  1.7       +15 -7     incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/AbstractInterceptor.java
  
  Index: AbstractInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/AbstractInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractInterceptor.java	20 Aug 2003 07:13:25 -0000	1.6
  +++ AbstractInterceptor.java	23 Aug 2003 22:09:39 -0000	1.7
  @@ -54,7 +54,9 @@
    * ====================================================================
    */
   package org.apache.geronimo.common;
  -import org.apache.geronimo.management.State;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   
   
   /**
  @@ -62,18 +64,24 @@
    *
    * @version $Revision$ $Date$
    */
  -public abstract class AbstractInterceptor extends AbstractComponent implements Interceptor
{
  +public abstract class AbstractInterceptor implements Interceptor {
  +    private RPCContainer container;
       private Interceptor next;
  +    protected Log log = LogFactory.getLog(getClass());
  +
  +    public RPCContainer getContainer() {
  +        return container;
  +    }
  +
  +    public void setContainer(RPCContainer container) {
  +        this.container = container;
  +    }
   
       public final Interceptor getNext() {
           return next;
       }
   
       public final void setNext(Interceptor nextInterceptor) {
  -        State state = getStateInstance();
  -        if (state != State.STOPPED) {
  -            throw new IllegalStateException("setNext can only be called while in the stopped
state: state=" + state);
  -        }
           next = nextInterceptor;
       }
   
  
  
  
  1.7       +15 -6     incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/AbstractRPCContainer.java
  
  Index: AbstractRPCContainer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/AbstractRPCContainer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractRPCContainer.java	23 Aug 2003 05:04:57 -0000	1.6
  +++ AbstractRPCContainer.java	23 Aug 2003 22:09:39 -0000	1.7
  @@ -63,7 +63,7 @@
   import org.apache.geronimo.management.State;
   
   /**
  - * Base class for a Container that can be accecpt invocation.
  + * Base class for a Container that can accept invocations.
    *
    * @version $Revision$ $Date$
    */
  @@ -113,8 +113,8 @@
        * @param interceptor
        */
       public final void addInterceptor(Interceptor interceptor) {
  -        if (getStateInstance() != State.STOPPED) {
  -            throw new IllegalStateException("Interceptors cannot be added unless the Container
is stopped");
  +        if (getStateInstance() == State.RUNNING) {
  +            throw new IllegalStateException("Interceptors cannot be added if the Container
is running");
           }
   
           if (firstInterceptor == null) {
  @@ -125,8 +125,17 @@
               lastInterceptor.setNext(interceptor);
               interceptors.addLast(interceptor);
           }
  -        if( interceptor instanceof Component)
  -            super.addComponent((Component) interceptor);
  +    }
  +
  +    /**
  +     * Clear the interceptor stack
  +     */
  +    public final void clearInterceptors() {
  +        if (getStateInstance() == State.RUNNING) {
  +            throw new IllegalStateException("Interceptors cannot be cleared is the Container
is running");
  +        }
  +        interceptors.clear();
  +        firstInterceptor = null;
       }
   
       public final ObjectName getPlugin(String logicalPluginName) {
  
  
  
  1.5       +2 -2      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/CallbackInterceptor.java
  
  Index: CallbackInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/CallbackInterceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CallbackInterceptor.java	15 Aug 2003 14:12:19 -0000	1.4
  +++ CallbackInterceptor.java	23 Aug 2003 22:09:39 -0000	1.5
  @@ -89,7 +89,7 @@
           }
   
           // Method metadata
  -        EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata((RPCContainer)getContainer());
  +        EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata(getContainer());
           Method interfaceMethod = EJBInvocationUtil.getMethod(invocation);
           MethodMetadata methodMetadata = ejbMetadata.getMethodMetadata(interfaceMethod);
   
  
  
  
  1.6       +4 -6      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/StatelessLifeCycleInterceptor.java
  
  Index: StatelessLifeCycleInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/StatelessLifeCycleInterceptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StatelessLifeCycleInterceptor.java	16 Aug 2003 23:16:38 -0000	1.5
  +++ StatelessLifeCycleInterceptor.java	23 Aug 2003 22:09:39 -0000	1.6
  @@ -90,8 +90,7 @@
       private Method createLocal;
   
       protected void doStart() throws Exception {
  -        super.doStart();
  -        EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata((RPCContainer)getContainer());
  +        EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata(getContainer());
           Class homeInterface = ejbMetadata.getHomeInterface();
           if (homeInterface != null) {
               createRemote = homeInterface.getMethod("create", null);
  @@ -106,7 +105,6 @@
       protected void doStop() throws Exception {
           createRemote = null;
           createLocal = null;
  -        super.doStop();
       }
   
       public InvocationResult invoke(Invocation invocation) throws Exception {
  @@ -119,14 +117,14 @@
               // remove for a stateless bean does nothing
               return new SimpleInvocationResult();
           } else if (method.equals(createRemote)) {
  -            EJBProxyFactoryManager ejbProxyFactoryManager = EJBPlugins.getEJBProxyFactoryManager((RPCContainer)getContainer());
  +            EJBProxyFactoryManager ejbProxyFactoryManager = EJBPlugins.getEJBProxyFactoryManager(getContainer());
               EJBProxyFactory ejbProxyFactory = ejbProxyFactoryManager.getThreadEJBProxyFactory();
               if (ejbProxyFactory == null) {
                   throw new IllegalStateException("No remote proxy factory set");
               }
               return new SimpleInvocationResult(ejbProxyFactory.getEJBObject());
           } else if (method.equals(createLocal)) {
  -            EJBProxyFactoryManager ejbProxyFactoryManager = EJBPlugins.getEJBProxyFactoryManager((RPCContainer)getContainer());
  +            EJBProxyFactoryManager ejbProxyFactoryManager = EJBPlugins.getEJBProxyFactoryManager(getContainer());
               EJBProxyFactory ejbProxyFactory = ejbProxyFactoryManager.getEJBProxyFactory("local");
               if (ejbProxyFactory == null) {
                   throw new IllegalStateException("No local proxy factoy set");
  
  
  
  1.7       +2 -4      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatefulInstanceInterceptor.java
  
  Index: StatefulInstanceInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatefulInstanceInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StatefulInstanceInterceptor.java	23 Aug 2003 09:07:11 -0000	1.6
  +++ StatefulInstanceInterceptor.java	23 Aug 2003 22:09:39 -0000	1.7
  @@ -84,8 +84,7 @@
       private LockDomain lockDomain;
   
       protected void doStart() throws Exception {
  -        super.doStart();
  -        RPCContainer container = (RPCContainer)getContainer();
  +        RPCContainer container = getContainer();
           lockDomain = EJBPlugins.getLockDomain(container);
           pool = EJBPlugins.getInstancePool(container);
           cache = EJBPlugins.getInstanceCache(container);
  @@ -95,7 +94,6 @@
           lockDomain = null;
           cache = null;
           pool = null;
  -        super.doStop();
       }
   
       public InvocationResult invoke(Invocation invocation) throws Exception {
  
  
  
  1.6       +3 -5      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatefulSessionSynchronizationInterceptor.java
  
  Index: StatefulSessionSynchronizationInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatefulSessionSynchronizationInterceptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StatefulSessionSynchronizationInterceptor.java	16 Aug 2003 23:16:43 -0000	1.5
  +++ StatefulSessionSynchronizationInterceptor.java	23 Aug 2003 22:09:39 -0000	1.6
  @@ -67,10 +67,10 @@
   
   import org.apache.geronimo.cache.InstanceCache;
   import org.apache.geronimo.common.AbstractInterceptor;
  -import org.apache.geronimo.common.RPCContainer;
   import org.apache.geronimo.common.Invocation;
   import org.apache.geronimo.common.InvocationResult;
   import org.apache.geronimo.common.InvocationType;
  +import org.apache.geronimo.common.RPCContainer;
   import org.apache.geronimo.ejb.EJBInvocationUtil;
   import org.apache.geronimo.ejb.EnterpriseContext;
   import org.apache.geronimo.ejb.container.EJBPlugins;
  @@ -90,8 +90,7 @@
       private boolean hasSynchronization;
   
       protected void doStart() throws Exception {
  -        super.doStart();
  -        RPCContainer container = (RPCContainer)getContainer();
  +        RPCContainer container = getContainer();
           tm = EJBPlugins.getTransactionManager(container);
           cache = EJBPlugins.getInstanceCache(container);
           EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata(container);
  @@ -101,7 +100,6 @@
       protected void doStop() throws Exception {
           cache = null;
           tm = null;
  -        super.doStop();
       }
   
       public InvocationResult invoke(Invocation invocation) throws Exception {
  
  
  
  1.6       +2 -4      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatelessInstanceInterceptor.java
  
  Index: StatelessInstanceInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/cache/StatelessInstanceInterceptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StatelessInstanceInterceptor.java	16 Aug 2003 23:16:43 -0000	1.5
  +++ StatelessInstanceInterceptor.java	23 Aug 2003 22:09:39 -0000	1.6
  @@ -78,14 +78,12 @@
       private InstancePool pool;
   
       protected void doStart() throws Exception {
  -        super.doStart();
  -        RPCContainer container = (RPCContainer)getContainer();
  +        RPCContainer container = getContainer();
           pool = EJBPlugins.getInstancePool(container);
       }
   
       protected void doStop() throws Exception {
           pool = null;
  -        super.doStop();
       }
   
       public InvocationResult invoke(final Invocation invocation) throws Exception {
  
  
  
  1.5       +2 -5      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context/ExecutionContextInterceptor.java
  
  Index: ExecutionContextInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context/ExecutionContextInterceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExecutionContextInterceptor.java	16 Aug 2003 23:16:51 -0000	1.4
  +++ ExecutionContextInterceptor.java	23 Aug 2003 22:09:39 -0000	1.5
  @@ -62,7 +62,6 @@
   import org.apache.geronimo.common.AbstractInterceptor;
   import org.apache.geronimo.common.Invocation;
   import org.apache.geronimo.common.InvocationResult;
  -import org.apache.geronimo.common.RPCContainer;
   import org.apache.geronimo.ejb.container.EJBPlugins;
   
   /**
  @@ -75,13 +74,11 @@
       protected TransactionManager tm;
   
       protected void doStart() throws Exception {
  -        super.doStart();
  -        tm = EJBPlugins.getTransactionManager((RPCContainer)getContainer());
  +        tm = EJBPlugins.getTransactionManager(getContainer());
       }
   
       protected void doStop() throws Exception {
           tm = null;
  -        super.doStop();
       }
   
       /**
  
  
  
  1.7       +2 -2      incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context/StatelessBMTInterceptor.java
  
  Index: StatelessBMTInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context/StatelessBMTInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StatelessBMTInterceptor.java	23 Aug 2003 09:07:11 -0000	1.6
  +++ StatelessBMTInterceptor.java	23 Aug 2003 22:09:39 -0000	1.7
  @@ -78,7 +78,7 @@
   
       protected void doStart() throws Exception {
           super.doStart();
  -        ejbName = EJBPlugins.getEJBMetadata((RPCContainer)getContainer()).getName();
  +        ejbName = EJBPlugins.getEJBMetadata(getContainer()).getName();
       }
   
       public InvocationResult invoke(Invocation invocation) throws Exception {
  
  
  
  1.11      +10 -61    incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context/TransactionInterceptor.java
  
  Index: TransactionInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context/TransactionInterceptor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TransactionInterceptor.java	22 Aug 2003 02:08:41 -0000	1.10
  +++ TransactionInterceptor.java	23 Aug 2003 22:09:39 -0000	1.11
  @@ -55,12 +55,9 @@
    */
   package org.apache.geronimo.ejb.context;
   
  -import org.apache.geronimo.common.Container;
  -import org.apache.geronimo.common.Interceptor;
  +import org.apache.geronimo.common.AbstractInterceptor;
   import org.apache.geronimo.common.Invocation;
   import org.apache.geronimo.common.InvocationResult;
  -import org.apache.geronimo.common.RPCContainer;
  -import org.apache.geronimo.management.State;
   import org.apache.geronimo.ejb.container.EJBPlugins;
   import org.apache.geronimo.ejb.metadata.EJBMetadata;
   
  @@ -70,76 +67,28 @@
    *
    * @version $Revision$ $Date$
    */
  -public class TransactionInterceptor implements Interceptor {
  +public class TransactionInterceptor extends AbstractInterceptor {
       private ExecutionContextInterceptor transactionInterceptor;
  -    private Container container;
  -    private Interceptor nextInterceptor;
   
  -    public int getState() {
  -        return transactionInterceptor.getState();
  -    }
  -    
  -    public State getStateInstance() {
  -        return transactionInterceptor.getStateInstance();
  -    }
  -
  -    public long getStartTime(){
  -        return transactionInterceptor.getStartTime();
  -    }
  -
  -    public final Container getContainer() {
  -        return container;
  -    }
  -
  -    public final void setContainer(Container container) {
  -        this.container = container;
  -    }
  -
  -    public final Interceptor getNext() {
  -        return nextInterceptor;
  -    }
  -
  -    public final void setNext(Interceptor nextInterceptor) {
  -        this.nextInterceptor = nextInterceptor;
  -    }
  -
  -    public void start() throws Exception {
  -        EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata((RPCContainer)container);
  +    public void doStart() throws Exception {
  +        EJBMetadata ejbMetadata = EJBPlugins.getEJBMetadata(getContainer());
           if (ejbMetadata.getTransactionDemarcation().isContainer()) {
               transactionInterceptor = new CMTInterceptor();
           } else {
               transactionInterceptor = new StatelessBMTInterceptor();
           }
  -        transactionInterceptor.setContainer(container);
  -        transactionInterceptor.setNext(nextInterceptor);
  -        transactionInterceptor.start();
  -    }
  -    
  -    public void startRecursive() throws Exception {
  -        transactionInterceptor.startRecursive();
  +        transactionInterceptor.setContainer(getContainer());
  +        transactionInterceptor.setNext(getNext());
  +        transactionInterceptor.doStart();
       }
   
  -    public void stop() throws Exception {
  -        transactionInterceptor.stop();
  +    public void doStop() throws Exception {
  +        transactionInterceptor.doStop();
           transactionInterceptor.setContainer(null);
           transactionInterceptor = null;
       }
   
       public InvocationResult invoke(Invocation invocation) throws Exception {
           return transactionInterceptor.invoke(invocation);
  -    }
  -
  -
  -    /**
  -     * For compliance with Component interface.
  -     * NOTE: This Interceptor should probably implement
  -     * AbstractComponent!
  -     *
  -     * @todo need to return a decent name if Interceptors are Components
  -     * @return a <code>String</code> value
  -     */
  -    public String getObjectName ()
  -    {
  -        return transactionInterceptor.getObjectName();
       }
   }
  
  
  
  1.7       +2 -4      incubator-geronimo/modules/core/src/java/org/apache/geronimo/lock/LockInterceptor.java
  
  Index: LockInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/lock/LockInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LockInterceptor.java	23 Aug 2003 09:07:11 -0000	1.6
  +++ LockInterceptor.java	23 Aug 2003 22:09:39 -0000	1.7
  @@ -76,14 +76,12 @@
       private LockDomain lockDomain;
   
       protected void doStart() throws Exception {
  -        super.doStart();
  -        RPCContainer container = (RPCContainer) getContainer();
  +        RPCContainer container = getContainer();
           lockDomain = EJBPlugins.getLockDomain(container);
       }
   
       protected void doStop() throws Exception {
           lockDomain = null;
  -        super.doStop();
       }
   
       public InvocationResult invoke(Invocation invocation) throws Exception {
  
  
  

Mime
View raw message