geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/ejb/context TransactionInterceptor.java
Date Fri, 22 Aug 2003 02:08:42 GMT
chirino     2003/08/21 19:08:41

  Modified:    modules/core/src/java/org/apache/geronimo/common
                        AbstractRPCContainer.java Component.java
                        Interceptor.java SimpleInvocation.java
                        SimpleInvocationResult.java
               modules/core/src/java/org/apache/geronimo/core/util
                        ClassUtil.java
               modules/core/src/java/org/apache/geronimo/ejb/context
                        TransactionInterceptor.java
  Log:
  Updated Component so that it does not extend StateManagable.  This allows
  us to create Component implementations that do not have a managable state.
  Allowed SimpleInvocations to be serializable and added a few more
  helper methods to ClassUtil.
  
  Revision  Changes    Path
  1.5       +12 -5     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractRPCContainer.java	20 Aug 2003 07:13:25 -0000	1.4
  +++ AbstractRPCContainer.java	22 Aug 2003 02:08:41 -0000	1.5
  @@ -1,10 +1,9 @@
   package org.apache.geronimo.common;
   
  -import java.util.Iterator;
   import java.util.LinkedHashMap;
   import java.util.LinkedList;
  -import java.util.ListIterator;
   import java.util.Map;
  +
   import javax.management.ObjectName;
   import org.apache.geronimo.management.State;
   
  @@ -71,8 +70,8 @@
               lastInterceptor.setNext(interceptor);
               interceptors.addLast(interceptor);
           }
  -
  -        super.addComponent(interceptor);
  +        if( interceptor instanceof Component)
  +            super.addComponent((Component) interceptor);
       }
   
       public final ObjectName getPlugin(String logicalPluginName) {
  @@ -88,10 +87,18 @@
           plugins.put(logicalPluginName, objectName);
       }
   
  +    /**
  +     * @deprecated
  +     * @see org.apache.geronimo.common.RPCContainer#getPluginObject(java.lang.String)
  +     */
       public final Object getPluginObject(String logicalPluginName) {
           return pluginObjects.get(logicalPluginName);
       }
   
  +    /**
  +     * @deprecated
  +     * @see org.apache.geronimo.common.RPCContainer#putPluginObject(java.lang.String, java.lang.Object)
  +     */
       public final void putPluginObject(String logicalPluginName, Object plugin) {
           if (getStateInstance() != State.STOPPED) {
               throw new IllegalStateException(
  
  
  
  1.8       +2 -3      incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/Component.java
  
  Index: Component.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/Component.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Component.java	20 Aug 2003 07:13:25 -0000	1.7
  +++ Component.java	22 Aug 2003 02:08:41 -0000	1.8
  @@ -54,7 +54,6 @@
    * ====================================================================
    */
   package org.apache.geronimo.common;
  -import org.apache.geronimo.management.StateManageable;
   
   
   /**
  @@ -63,7 +62,7 @@
    *
    * @version $Revision$ $Date$
    */
  -public interface Component extends StateManageable
  +public interface Component 
   {
       /**
        * Gets the container to which this component belongs.
  
  
  
  1.3       +2 -2      incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/Interceptor.java
  
  Index: Interceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/Interceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Interceptor.java	11 Aug 2003 17:59:10 -0000	1.2
  +++ Interceptor.java	22 Aug 2003 02:08:41 -0000	1.3
  @@ -62,7 +62,7 @@
    *
    * @version $Revision$ $Date$
    */
  -public interface Interceptor extends Component {
  +public interface Interceptor {
       /**
        * Gets the next interceptor in the chain of command.
        *
  
  
  
  1.4       +24 -2     incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/SimpleInvocation.java
  
  Index: SimpleInvocation.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/SimpleInvocation.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleInvocation.java	11 Aug 2003 17:59:10 -0000	1.3
  +++ SimpleInvocation.java	22 Aug 2003 02:08:41 -0000	1.4
  @@ -55,6 +55,10 @@
    */
   package org.apache.geronimo.common;
   
  +import java.io.Externalizable;
  +import java.io.IOException;
  +import java.io.ObjectInput;
  +import java.io.ObjectOutput;
   import java.util.HashMap;
   import java.util.Map;
   
  @@ -64,7 +68,8 @@
    *
    * @version $Revision$ $Date$
    */
  -public class SimpleInvocation implements Invocation {
  +public class SimpleInvocation implements Invocation, Externalizable {
  +    
       private Map marshalMap = new HashMap();
       private Map asIsMap = new HashMap();
       private Map transientMap = new HashMap();
  @@ -91,5 +96,22 @@
   
       public void putTransient(Object key, Object value) {
           transientMap.put(key, value);
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
  +     */
  +    public void writeExternal(ObjectOutput out) throws IOException {
  +        out.writeObject(marshalMap);
  +        out.writeObject(asIsMap);        
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
  +     */
  +    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
  +        marshalMap = (Map) in.readObject();
  +        asIsMap = (Map) in.readObject();
  +        transientMap = new HashMap();        
       }
   }
  
  
  
  1.3       +4 -2      incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/SimpleInvocationResult.java
  
  Index: SimpleInvocationResult.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/SimpleInvocationResult.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleInvocationResult.java	11 Aug 2003 17:59:10 -0000	1.2
  +++ SimpleInvocationResult.java	22 Aug 2003 02:08:41 -0000	1.3
  @@ -55,13 +55,15 @@
    */
   package org.apache.geronimo.common;
   
  +import java.io.Serializable;
  +
   /**
    *
    *
    *
    * @version $Revision$ $Date$
    */
  -public class SimpleInvocationResult implements InvocationResult {
  +public class SimpleInvocationResult implements InvocationResult, Serializable {
       private Object result;
   
       public SimpleInvocationResult() {
  
  
  
  1.2       +49 -1     incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/util/ClassUtil.java
  
  Index: ClassUtil.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/util/ClassUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClassUtil.java	11 Aug 2003 17:59:10 -0000	1.1
  +++ ClassUtil.java	22 Aug 2003 02:08:41 -0000	1.2
  @@ -55,6 +55,8 @@
    */
   package org.apache.geronimo.core.util;
   
  +import java.io.IOException;
  +import java.lang.reflect.Array;
   import java.util.HashMap;
   import java.util.Map;
   
  @@ -78,6 +80,18 @@
           primitives.put("char", Character.TYPE);
       }
   
  +    static HashMap vmPrimitives = new HashMap();
  +    static {
  +        primitives.put("B", byte.class);
  +        primitives.put("C", char.class);
  +        primitives.put("D", double.class);
  +        primitives.put("F", float.class);
  +        primitives.put("I", int.class);
  +        primitives.put("J", long.class);
  +        primitives.put("S", short.class);
  +        primitives.put("Z", boolean.class);
  +    }
  +
       public static Class getClassForName(String name) throws ClassNotFoundException {
           return getClassForName(Thread.currentThread().getContextClassLoader(), name);
       }
  @@ -89,4 +103,38 @@
           }
           return clazz;
       }
  +    
  +
  +    /**
  +     * @see java.io.ObjectInputStream#resolveClass(java.io.ObjectStreamClass)
  +     */
  +    static public Class resolveObjectStreamClass(ClassLoader loader, String className)
throws IOException, ClassNotFoundException {
  +        
  +        // Is it a normal class??
  +        if (!className.startsWith("[")) 
  +            return loader.loadClass(className);        
  +        
  +        // Is it an array class??
  +        Class type;             
  +        int arrayDimension = className.lastIndexOf('[')+1;             
  +
  +        // Is the array type a primitive?
  +        if (className.charAt(arrayDimension) != 'L') {
  +            if (className.length() != arrayDimension + 1) 
  +                throw new ClassNotFoundException(className);                
  +            type = (Class) vmPrimitives.get(className.substring(arrayDimension,1));
  +        } else {           
  +            String cn = className.substring(arrayDimension + 1, className.length() - 1);
  +            type = loader.loadClass(cn);
  +        }
  +        
  +        // This kinda sucks.. there must be an easier way at getting
  +        // to Class of an array.. 
  +        int dim[] = new int[arrayDimension];
  +        for (int i = 0; i < arrayDimension; i++) 
  +            dim[i] = 0;        
  +        Object o = Array.newInstance(type, dim);
  +        return o.getClass();
  +    }
  +    
   }
  
  
  
  1.10      +2 -2      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TransactionInterceptor.java	20 Aug 2003 07:13:26 -0000	1.9
  +++ TransactionInterceptor.java	22 Aug 2003 02:08:41 -0000	1.10
  @@ -71,7 +71,7 @@
    * @version $Revision$ $Date$
    */
   public class TransactionInterceptor implements Interceptor {
  -    private Interceptor transactionInterceptor;
  +    private ExecutionContextInterceptor transactionInterceptor;
       private Container container;
       private Interceptor nextInterceptor;
   
  
  
  

Mime
View raw message