User: oleg    
  Date: 00/06/20 02:08:50

  Modified:    src/main/org/jboss/ejb Container.java EntityContainer.java
                        StatefulSessionContainer.java
                        StatelessSessionContainer.java
  Log:
  Class comparisons are replaced by Class names comparisons, small fixes to invocation 
of methods implemented by container
  
  Revision  Changes    Path
  1.15      +277 -274  jboss/src/main/org/jboss/ejb/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/Container.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Container.java    2000/06/16 13:10:19     1.14
  +++ Container.java    2000/06/20 09:08:49     1.15
  @@ -51,65 +51,68 @@
   
   /**
    *   This is the base class for all EJB-containers in jBoss. A Container
  - *     functions as the central hub of all metadata and plugins. Through this
  - *     the container plugins can get hold of the other plugins and any metadata 
they need.
  + *    functions as the central hub of all metadata and plugins. Through this
  + *    the container plugins can get hold of the other plugins and any metadata they 
need.
    *
  - *     The ContainerFactory creates instances of subclasses of this class and calls 
the appropriate
  - *     initialization methods.
  + *    The ContainerFactory creates instances of subclasses of this class and calls 
the appropriate
  + *    initialization methods.
    *
  - *     A Container does not perform any significant work, but instead delegates to 
the plugins to provide for
  - *     all kinds of algorithmic functionality.
  + *    A Container does not perform any significant work, but instead delegates to 
the plugins to provide for
  + *    all kinds of algorithmic functionality.
    *
    *   @see ContainerFactory
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *    @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
  - *   @version $Revision: 1.14 $
  + *   @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
  + *   @version $Revision: 1.15 $
    */
   public abstract class Container
   {
      // Constants -----------------------------------------------------
  +
  +   // This is used in Class name comparisons
  +   protected static final String EJB_OBJECT = "javax.ejx.EJBObject";
       
      // Attributes ----------------------------------------------------
  -     
  -     // This is the application that this container is a part of
  +    
  +    // This is the application that this container is a part of
      protected Application application;
  -     
  -     // This is the classloader of this container. All classes and resources that
  -     // the bean uses will be loaded from here. By doing this we make the bean 
re-deployable
  +    
  +    // This is the classloader of this container. All classes and resources that
  +    // the bean uses will be loaded from here. By doing this we make the bean 
re-deployable
      protected ClassLoader classLoader;
  -     
  -     // This is the jBoss-specific metadata. Note that it extends the generic EJB 
1.1 class from EJX
  +    
  +    // This is the jBoss-specific metadata. Note that it extends the generic EJB 
1.1 class from EJX
      protected jBossEnterpriseBean metaData;
  -        
  -     // This is the Home interface class
  +       
  +    // This is the Home interface class
      protected Class homeInterface;
  -     
  +    
      // This is the Remote interface class
      protected Class remoteInterface;
  -     
  +    
      // This is the EnterpriseBean class
      protected Class beanClass;
      
      // This is the TransactionManager
      protected TransactionManager tm;
  -     
  +    
      // Public --------------------------------------------------------
  -     
  -     public void setTransactionManager(TransactionManager tm)
  -     {
  -             this.tm = tm;
  -     }
  -     
  -     public TransactionManager getTransactionManager()
  -     {
  -             return tm;
  -     }
  -     
  +    
  +    public void setTransactionManager(TransactionManager tm)
  +    {
  +        this.tm = tm;
  +    }
  +    
  +    public TransactionManager getTransactionManager()
  +    {
  +        return tm;
  +    }
  +    
      public void setApplication(Application app) 
      { 
  -             if (app == null)
  -                     throw new IllegalArgumentException("Null application");
  -                     
  +        if (app == null)
  +            throw new IllegalArgumentException("Null application");
  +            
         application = app; 
      }
      
  @@ -124,40 +127,40 @@
      }
      
      public ClassLoader getClassLoader() 
  -     { 
  -             return classLoader; 
  -     }
  -     
  +    { 
  +        return classLoader; 
  +    }
  +    
      public void setMetaData(jBossEnterpriseBean metaData) 
      { 
         this.metaData = metaData; 
      }
      
      public jBossEnterpriseBean getMetaData() 
  -     { 
  -             return metaData; 
  -     }               
  -                             
  -     public Class getBeanClass()
  -     {
  -        return beanClass;
  -     }
  -     /**
  -      * The ContainerFactory calls this method.  The ContainerFactory has set all 
the 
  -      * plugins and interceptors that this bean requires and now proceeds to 
initialize
  -      * the chain.  The method looks for the standard classes in the URL, sets up
  -      * the naming environment of the bean.
  -      *
  -      * @exception   Exception  
  -      */
  +    { 
  +        return metaData; 
  +    }       
  +                
  +    public Class getBeanClass()
  +    {
  +       return beanClass;
  +    }
  +    /**
  +     * The ContainerFactory calls this method.  The ContainerFactory has set all 
the 
  +     * plugins and interceptors that this bean requires and now proceeds to 
initialize
  +     * the chain.  The method looks for the standard classes in the URL, sets up
  +     * the naming environment of the bean.
  +     *
  +     * @exception   Exception  
  +     */
      public void init()
         throws Exception
      {
  -             // Acquire classes from CL
  +        // Acquire classes from CL
         beanClass = classLoader.loadClass(metaData.getEjbClass());
         
  -             // Setup "java:" namespace
  -      setupEnvironment();            
  +        // Setup "java:" namespace
  +      setupEnvironment();           
      }
      
      public void start()
  @@ -173,29 +176,29 @@
      {
      }
   
  -     /**
  -      *      This method is called by the ContainerInvoker when a method call comes 
in on the Home object.
  -      *
  -      *      The Container forwards this call to the interceptor chain for further 
processing.
  -      *
  -      * @param   mi  the object holding all info about this invocation
  -      * @return     the result of the home invocation
  -      * @exception   Exception  
  -      */
  +    /**
  +     *  This method is called by the ContainerInvoker when a method call comes in 
on the Home object.
  +     *
  +     *  The Container forwards this call to the interceptor chain for further 
processing.
  +     *
  +     * @param   mi  the object holding all info about this invocation
  +     * @return     the result of the home invocation
  +     * @exception   Exception  
  +     */
      public abstract Object invokeHome(MethodInvocation mi)
         throws Exception;
   
  -     /**
  -      *      This method is called by the ContainerInvoker when a method call comes 
in on an EJBObject.
  -      *
  -      *      The Container forwards this call to the interceptor chain for further 
processing.
  -      *
  -      * @param   id  the id of the object being invoked. May be null if stateless
  -      * @param   method  the method being invoked
  -      * @param   args  the parameters
  -      * @return     the result of the invocation
  -      * @exception   Exception  
  -      */
  +    /**
  +     *  This method is called by the ContainerInvoker when a method call comes in 
on an EJBObject.
  +     *
  +     *  The Container forwards this call to the interceptor chain for further 
processing.
  +     *
  +     * @param   id  the id of the object being invoked. May be null if stateless
  +     * @param   method  the method being invoked
  +     * @param   args  the parameters
  +     * @return     the result of the invocation
  +     * @exception   Exception  
  +     */
      public abstract Object invoke(MethodInvocation mi)
         throws Exception;
         
  @@ -219,183 +222,183 @@
      private void setupEnvironment()
         throws DeploymentException
      {
  -             try
  -             {
  -                     // Create a new java: namespace root
  -           NamingServer root = new NamingServer();
  -                     
  -                     // Associate this root with the classloader of the bean
  -           ((BeanClassLoader)getClassLoader()).setJNDIRoot(root);
  -                     
  -               // Since the BCL is already associated with this thread we can start 
using the java: namespace directly
  -           Context ctx = (Context) new InitialContext().lookup("java:/");
  -           ctx.createSubcontext("comp");
  -           ctx = ctx.createSubcontext("comp/env");
  -           
  -           // Bind environment properties
  -           {
  -              Iterator enum = getMetaData().getEnvironmentEntries();
  -              while(enum.hasNext())
  -              {
  -                 EnvironmentEntry entry = (EnvironmentEntry)enum.next();
  -                 if (entry.getType().equals("java.lang.Integer"))
  -                 {
  -                    bind(ctx, entry.getName(), new Integer(entry.getValue()));
  -                 } else if (entry.getType().equals("java.lang.Long"))
  -                 {
  -                    bind(ctx, entry.getName(), new Long(entry.getValue()));
  -                 } else if (entry.getType().equals("java.lang.Double"))
  -                 {
  -                    bind(ctx, entry.getName(), new Double(entry.getValue()));
  -                 } else if (entry.getType().equals("java.lang.Float"))
  -                 {
  -                    bind(ctx, entry.getName(), new Float(entry.getValue()));
  -                 } else if (entry.getType().equals("java.lang.Byte"))
  -                 {
  -                    bind(ctx, entry.getName(), new Byte(entry.getValue()));
  -                 } else if (entry.getType().equals("java.lang.Short"))
  -                 {
  -                    bind(ctx, entry.getName(), new Short(entry.getValue()));
  -                 } else if (entry.getType().equals("java.lang.Boolean"))
  -                 {
  -                    bind(ctx, entry.getName(), new Boolean(entry.getValue()));
  -                 } else
  -                 {
  -                                             // Unknown type
  -                    // Default is string
  -                    bind(ctx, entry.getName(), entry.getValue());
  -                 }
  -              }
  -           }
  -           
  -           // Bind EJB references
  -           {
  -              Iterator enum = getMetaData().getEjbReferences();
  -              while(enum.hasNext())
  -              {
  -                              
  -                 jBossEjbReference ref = (jBossEjbReference)enum.next();
  -                 System.out.println("Binding an EJBReference "+ref);
  -                             
  -                 Name n = ctx.getNameParser("").parse(ref.getLink());
  -                 
  -                 if (!ref.getJndiName().equals(""))
  -                 {
  -                    // External link
  -                    Logger.debug("Binding "+ref.getName()+" to external JNDI 
source: "+ref.getJndiName());
  -                    bind(ctx, ref.getName(), new LinkRef(ref.getJndiName()));
  -                 }
  -                 else
  -                 {
  -                    // Internal link
  -                    Logger.debug("Bind "+ref.getName() +" to "+ref.getLink());
  -                                             
  -                                             final Container con = 
getApplication().getContainer(ref.getLink());
  -                                             
  -                                             // Use Reference to link to ensure 
lazyloading. 
  -                                             // Otherwise we might try to get 
EJBHome from not yet initialized container
  -                                             // will would result in nullpointer 
exception
  -                                             RefAddr refAddr = new RefAddr("EJB")
  -                                             {
  -                                                     public Object getContent() 
  -                                                     {
  -                                                              return con;
  -                                                     }
  -                                             };
  -                                             Reference reference = new 
Reference("javax.ejb.EJBObject",refAddr, new 
EjbReferenceFactory().getClass().getName(), null);
  -                                             
  -                                             bind(ctx, ref.getName(), reference);
  -                 }
  -              }
  -           }
  -           
  -           // Bind resource references
  -           {
  -              Iterator enum = getMetaData().getResourceReferences();
  -              ResourceManagers rms = 
((jBossEjbJar)getMetaData().getBeanContext().getBeanContext()).getResourceManagers();
  -              while(enum.hasNext())
  -              {
  -                 jBossResourceReference ref = (jBossResourceReference)enum.next();
  -                 
  -                 ResourceManager rm = rms.getResourceManager(ref.getResourceName());
  -                 
  -                                     if (rm == null)
  -                                     {
  -                                             // Try to locate defaults
  -                                             if 
(ref.getType().equals("javax.sql.DataSource"))
  -                                             {
  -                                                     // Go through JNDI and look 
for DataSource - use the first one
  -                                                     Context dsCtx = new 
InitialContext();
  -                                                     NamingEnumeration list = 
dsCtx.list("");
  -                                                     while (list.hasMore())
  -                                                     {
  -                                                             NameClassPair pair = 
(NameClassPair)list.next();
  -                                                             try
  -                                                             {
  -                                                                     Class cl = 
getClass().getClassLoader().loadClass(pair.getClassName());
  -                                                                     if 
(DataSource.class.isAssignableFrom(cl))
  -                                                                     {
  -                                                                             // 
Found it!!
  -                                                                             
Logger.log("Using default DataSource:"+pair.getName());
  -                                                                             rm = 
new JDBCResource();
  -                                                                             
((JDBCResource)rm).setJndiName(pair.getName());
  -                                                                             
list.close();
  -                                                                             break;
  -                                                                     }
  -                                                             } catch (Exception e)
  -                                                             {
  -                                                                     
Logger.debug(e);
  -                                                             }
  -                                                     }
  -                                             
  -                                             }
  -                                             
  -                                             // Default failed? Warn user and move 
on
  -                                             // POTENTIALLY DANGEROUS: should this 
be a critical error?
  -                                             if (rm == null)
  -                                             {
  -                                                     Logger.warning("No resource 
manager found for "+ref.getResourceName());
  -                                                     continue;
  -                                             }
  -                                     }
  -                                             
  -                 if (rm.getType().equals("javax.sql.DataSource"))
  -                 {
  -                    // Datasource bindings   
  -                    JDBCResource res = (JDBCResource)rm;
  -                    bind(ctx, ref.getName(), new LinkRef(res.getJndiName()));
  -                 } else if (rm.getType().equals("java.net.URL"))
  -                 {
  -                    // URL bindings  
  -                    try
  -                    {
  -                       URLResource res = (URLResource)rm;
  -                       bind(ctx, ref.getName(), new URL(res.getUrl()));
  -                    } catch (MalformedURLException e)
  -                    {
  -                       throw new NamingException("Malformed URL:"+e.getMessage());
  -                    }
  -                 }
  -              }
  -           }
  -             } catch (NamingException e)
  -             {
  -                     e.printStackTrace();
  -                     e.getRootCause().printStackTrace();
  -                     throw new DeploymentException("Could not set up environment", 
e);
  -             }
  +        try
  +        {
  +            // Create a new java: namespace root
  +          NamingServer root = new NamingServer();
  +            
  +            // Associate this root with the classloader of the bean
  +          ((BeanClassLoader)getClassLoader()).setJNDIRoot(root);
  +            
  +          // Since the BCL is already associated with this thread we can start 
using the java: namespace directly
  +          Context ctx = (Context) new InitialContext().lookup("java:/");
  +          ctx.createSubcontext("comp");
  +          ctx = ctx.createSubcontext("comp/env");
  +          
  +          // Bind environment properties
  +          {
  +             Iterator enum = getMetaData().getEnvironmentEntries();
  +             while(enum.hasNext())
  +             {
  +                EnvironmentEntry entry = (EnvironmentEntry)enum.next();
  +                if (entry.getType().equals("java.lang.Integer"))
  +                {
  +                   bind(ctx, entry.getName(), new Integer(entry.getValue()));
  +                } else if (entry.getType().equals("java.lang.Long"))
  +                {
  +                   bind(ctx, entry.getName(), new Long(entry.getValue()));
  +                } else if (entry.getType().equals("java.lang.Double"))
  +                {
  +                   bind(ctx, entry.getName(), new Double(entry.getValue()));
  +                } else if (entry.getType().equals("java.lang.Float"))
  +                {
  +                   bind(ctx, entry.getName(), new Float(entry.getValue()));
  +                } else if (entry.getType().equals("java.lang.Byte"))
  +                {
  +                   bind(ctx, entry.getName(), new Byte(entry.getValue()));
  +                } else if (entry.getType().equals("java.lang.Short"))
  +                {
  +                   bind(ctx, entry.getName(), new Short(entry.getValue()));
  +                } else if (entry.getType().equals("java.lang.Boolean"))
  +                {
  +                   bind(ctx, entry.getName(), new Boolean(entry.getValue()));
  +                } else
  +                {
  +                        // Unknown type
  +                   // Default is string
  +                   bind(ctx, entry.getName(), entry.getValue());
  +                }
  +             }
  +          }
  +          
  +          // Bind EJB references
  +          {
  +             Iterator enum = getMetaData().getEjbReferences();
  +             while(enum.hasNext())
  +             {
  +                 
  +                jBossEjbReference ref = (jBossEjbReference)enum.next();
  +                System.out.println("Binding an EJBReference "+ref);
  +                
  +                Name n = ctx.getNameParser("").parse(ref.getLink());
  +                
  +                if (!ref.getJndiName().equals(""))
  +                {
  +                   // External link
  +                   Logger.debug("Binding "+ref.getName()+" to external JNDI source: 
"+ref.getJndiName());
  +                   bind(ctx, ref.getName(), new LinkRef(ref.getJndiName()));
  +                }
  +                else
  +                {
  +                   // Internal link
  +                   Logger.debug("Bind "+ref.getName() +" to "+ref.getLink());
  +                        
  +                        final Container con = 
getApplication().getContainer(ref.getLink());
  +                        
  +                        // Use Reference to link to ensure lazyloading. 
  +                        // Otherwise we might try to get EJBHome from not yet 
initialized container
  +                        // will would result in nullpointer exception
  +                        RefAddr refAddr = new RefAddr("EJB")
  +                        {
  +                            public Object getContent() 
  +                            {
  +                                 return con;
  +                            }
  +                        };
  +                        Reference reference = new 
Reference("javax.ejb.EJBObject",refAddr, new 
EjbReferenceFactory().getClass().getName(), null);
  +                        
  +                        bind(ctx, ref.getName(), reference);
  +                }
  +             }
  +          }
  +          
  +          // Bind resource references
  +          {
  +             Iterator enum = getMetaData().getResourceReferences();
  +             ResourceManagers rms = 
((jBossEjbJar)getMetaData().getBeanContext().getBeanContext()).getResourceManagers();
  +             while(enum.hasNext())
  +             {
  +                jBossResourceReference ref = (jBossResourceReference)enum.next();
  +                
  +                ResourceManager rm = rms.getResourceManager(ref.getResourceName());
  +                
  +                    if (rm == null)
  +                    {
  +                        // Try to locate defaults
  +                        if (ref.getType().equals("javax.sql.DataSource"))
  +                        {
  +                            // Go through JNDI and look for DataSource - use the 
first one
  +                            Context dsCtx = new InitialContext();
  +                            NamingEnumeration list = dsCtx.list("");
  +                            while (list.hasMore())
  +                            {
  +                                NameClassPair pair = (NameClassPair)list.next();
  +                                try
  +                                {
  +                                    Class cl = 
getClass().getClassLoader().loadClass(pair.getClassName());
  +                                    if (DataSource.class.isAssignableFrom(cl))
  +                                    {
  +                                        // Found it!!
  +                                        Logger.log("Using default 
DataSource:"+pair.getName());
  +                                        rm = new JDBCResource();
  +                                        
((JDBCResource)rm).setJndiName(pair.getName());
  +                                        list.close();
  +                                        break;
  +                                    }
  +                                } catch (Exception e)
  +                                {
  +                                    Logger.debug(e);
  +                                }
  +                            }
  +                        
  +                        }
  +                        
  +                        // Default failed? Warn user and move on
  +                        // POTENTIALLY DANGEROUS: should this be a critical error?
  +                        if (rm == null)
  +                        {
  +                            Logger.warning("No resource manager found for 
"+ref.getResourceName());
  +                            continue;
  +                        }
  +                    }
  +                        
  +                if (rm.getType().equals("javax.sql.DataSource"))
  +                {
  +                   // Datasource bindings   
  +                   JDBCResource res = (JDBCResource)rm;
  +                   bind(ctx, ref.getName(), new LinkRef(res.getJndiName()));
  +                } else if (rm.getType().equals("java.net.URL"))
  +                {
  +                   // URL bindings  
  +                   try
  +                   {
  +                      URLResource res = (URLResource)rm;
  +                      bind(ctx, ref.getName(), new URL(res.getUrl()));
  +                   } catch (MalformedURLException e)
  +                   {
  +                      throw new NamingException("Malformed URL:"+e.getMessage());
  +                   }
  +                }
  +             }
  +          }
  +        } catch (NamingException e)
  +        {
  +            e.printStackTrace();
  +            e.getRootCause().printStackTrace();
  +            throw new DeploymentException("Could not set up environment", e);
  +        }
      }
      
  -     
  +    
   
  -     /**
  -      *      Bind a value to a name in a JNDI-context, and create any missing 
subcontexts
  -      *
  -      * @param   ctx  
  -      * @param   name  
  -      * @param   val  
  -      * @exception   NamingException  
  -      */
  +    /**
  +     *  Bind a value to a name in a JNDI-context, and create any missing subcontexts
  +     *
  +     * @param   ctx  
  +     * @param   name  
  +     * @param   val  
  +     * @exception   NamingException  
  +     */
      private void bind(Context ctx, String name, Object val)
         throws NamingException
      {
  @@ -416,27 +419,27 @@
         
         ctx.bind(n.get(0), val);
      }
  -     
  -     public static class EjbReferenceFactory
  -     implements ObjectFactory
  -     {
  -             public Object getObjectInstance(Object ref,
  -                                                                             Name 
name,
  -                                                                             
Context nameCtx,
  -                                                                             
Hashtable environment)
  -                                                                             throws 
Exception
  -             {
  -                     Object con = ((Reference)ref).get(0).getContent();
  -                     if (con instanceof EntityContainer)
  -                     {
  -                             return 
((EntityContainer)con).getContainerInvoker().getEJBHome();
  -                     } if (con instanceof StatelessSessionContainer)
  -                     {
  -                             return 
((StatelessSessionContainer)con).getContainerInvoker().getEJBHome();
  -                     } else
  -                     {
  -                             return null;
  -                     }
  -             }
  -     }
  +    
  +    public static class EjbReferenceFactory
  +    implements ObjectFactory
  +    {
  +        public Object getObjectInstance(Object ref,
  +                                        Name name,
  +                                        Context nameCtx,
  +                                        Hashtable environment)
  +                                        throws Exception
  +        {
  +            Object con = ((Reference)ref).get(0).getContent();
  +            if (con instanceof EntityContainer)
  +            {
  +                return ((EntityContainer)con).getContainerInvoker().getEJBHome();
  +            } if (con instanceof StatelessSessionContainer)
  +            {
  +                return 
((StatelessSessionContainer)con).getContainerInvoker().getEJBHome();
  +            } else
  +            {
  +                return null;
  +            }
  +        }
  +    }
   }
  
  
  
  1.10      +155 -155  jboss/src/main/org/jboss/ejb/EntityContainer.java
  
  Index: EntityContainer.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- EntityContainer.java      2000/06/16 13:10:19     1.9
  +++ EntityContainer.java      2000/06/20 09:08:49     1.10
  @@ -33,28 +33,28 @@
    *   @see EntityEnterpriseContext
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  - *   @version $Revision: 1.9 $
  + *   @version $Revision: 1.10 $
    */
   public class EntityContainer
      extends Container
  -     implements ContainerInvokerContainer, InstancePoolContainer
  +    implements ContainerInvokerContainer, InstancePoolContainer
   {
      // Constants -----------------------------------------------------
       
      // Attributes ----------------------------------------------------
  -     
  -     // These are the mappings between the home interface methods and the container 
methods
  -     protected Map homeMapping;
  -     
  -     // These are the mappings between the remote interface methods and the bean 
methods
  -     protected Map beanMapping;
  -     
  -     // This is the container invoker for this container
  -     protected ContainerInvoker containerInvoker;
  -     
  +    
  +    // These are the mappings between the home interface methods and the container 
methods
  +    protected Map homeMapping;
  +    
  +    // These are the mappings between the remote interface methods and the bean 
methods
  +    protected Map beanMapping;
  +    
  +    // This is the container invoker for this container
  +    protected ContainerInvoker containerInvoker;
  +    
      // This is the persistence manager for this container
      protected EntityPersistenceManager persistenceManager;
  -     
  +    
      // This is the instance cache for this container
      protected InstanceCache instanceCache;
      
  @@ -63,41 +63,41 @@
      
      // This is the first interceptor in the chain. The last interceptor must be 
provided by the container itself
      protected Interceptor interceptor;
  -     
  +    
      // Public --------------------------------------------------------
      public void setContainerInvoker(ContainerInvoker ci) 
      { 
         if (ci == null)
  -             throw new IllegalArgumentException("Null invoker");
  -             
  +        throw new IllegalArgumentException("Null invoker");
  +        
         this.containerInvoker = ci; 
         ci.setContainer(this);
      }
   
      public ContainerInvoker getContainerInvoker() 
      { 
  -     return containerInvoker; 
  +    return containerInvoker; 
      }
  -     
  +    
      public void setInstancePool(InstancePool ip) 
      { 
         if (ip == null)
  -             throw new IllegalArgumentException("Null pool");
  -             
  +        throw new IllegalArgumentException("Null pool");
  +        
         this.instancePool = ip; 
         ip.setContainer(this);
      }
   
      public InstancePool getInstancePool() 
      { 
  -     return instancePool; 
  +    return instancePool; 
      }
  -     
  +    
      public void setInstanceCache(InstanceCache ic)
      { 
         if (ic == null)
  -             throw new IllegalArgumentException("Null cache");
  -                     
  +        throw new IllegalArgumentException("Null cache");
  +            
         this.instanceCache = ic; 
         ic.setContainer(this);
      }
  @@ -108,15 +108,15 @@
      }
      
      public EntityPersistenceManager getPersistenceManager() 
  -     { 
  -             return persistenceManager; 
  -     }
  -     
  +    { 
  +        return persistenceManager; 
  +    }
  +    
      public void setPersistenceManager(EntityPersistenceManager pm) 
      { 
         if (pm == null)
  -             throw new IllegalArgumentException("Null persistence manager");
  -                     
  +        throw new IllegalArgumentException("Null persistence manager");
  +            
         persistenceManager = pm; 
         pm.setContainer(this);
      }
  @@ -141,9 +141,9 @@
      
      public Interceptor getInterceptor() 
      { 
  -     return interceptor; 
  +    return interceptor; 
      }
  -     
  +    
      public Class getHomeClass()
      {
         return homeInterface;
  @@ -153,37 +153,37 @@
      {
         return remoteInterface;
      }
  -     
  +    
      // Container implementation --------------------------------------
      public void init()
         throws Exception
      {
  -             // Associate thread with classloader
  +        // Associate thread with classloader
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClassLoader());
         
  -             // Acquire classes from CL
  -             homeInterface = classLoader.loadClass(metaData.getHome());
  -             remoteInterface = classLoader.loadClass(metaData.getRemote());
  -             
  -             // Call default init
  +        // Acquire classes from CL
  +        homeInterface = classLoader.loadClass(metaData.getHome());
  +        remoteInterface = classLoader.loadClass(metaData.getRemote());
  +        
  +        // Call default init
         super.init();      
  -             
  +        
         // Map the bean methods
         setupBeanMapping();
         
         // Map the home methods
         setupHomeMapping();
  -             
  +        
         // Initialize pool 
         instancePool.init();
  -             
  +        
         // Init container invoker
         containerInvoker.init();
  -             
  +        
         // Init instance cache
         instanceCache.init();
  -             
  +        
         // Init persistence
         persistenceManager.init();
         
  @@ -207,7 +207,7 @@
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClassLoader());
         
  -             // Call default start
  +        // Call default start
         super.start();
         
         // Start container invoker
  @@ -219,18 +219,18 @@
         // Start persistence
         persistenceManager.start();
         
  -             // Start the instance pool
  -             instancePool.start();
  -             
  -             // Start all interceptors in the chain          
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                in.start();
  -                in = in.getNext();
  -             }
  -             
  -             // Reset classloader
  +        // Start the instance pool
  +        instancePool.start();
  +        
  +        // Start all interceptors in the chain      
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +           in.start();
  +           in = in.getNext();
  +        }
  +        
  +        // Reset classloader
         Thread.currentThread().setContextClassLoader(oldCl);
      }
      
  @@ -239,71 +239,71 @@
         // Associate thread with classloader
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClassLoader());
  -             
  -             // Call default stop
  +        
  +        // Call default stop
         super.stop();
  -             
  -        // Stop container invoker
  -        containerInvoker.stop();
  -        
  -        // Stop instance cache
  -        instanceCache.stop();
  -        
  -        // Stop persistence
  -        persistenceManager.stop();
  -        
  -        // Stop the instance pool
  -        instancePool.stop();
  -        
  -        // Stop all interceptors in the chain                
  -        Interceptor in = interceptor;
  -        while (in != null)
  -        {
  -           in.stop();
  -           in = in.getNext();
  -        }
  -             
  -        // Reset classloader
  -        Thread.currentThread().setContextClassLoader(oldCl);
  +        
  +       // Stop container invoker
  +       containerInvoker.stop();
  +       
  +       // Stop instance cache
  +       instanceCache.stop();
  +       
  +       // Stop persistence
  +       persistenceManager.stop();
  +       
  +       // Stop the instance pool
  +       instancePool.stop();
  +       
  +       // Stop all interceptors in the chain        
  +       Interceptor in = interceptor;
  +       while (in != null)
  +       {
  +          in.stop();
  +          in = in.getNext();
  +       }
  +        
  +       // Reset classloader
  +       Thread.currentThread().setContextClassLoader(oldCl);
      }
      
      public void destroy()
      {
  -        // Associate thread with classloader
  -        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -        Thread.currentThread().setContextClassLoader(getClassLoader());
  -        
  -        // Call default destroy
  -        super.destroy();
  -        
  -        // Destroy container invoker
  -        containerInvoker.destroy();
  -        
  -        // Destroy instance cache
  -        instanceCache.destroy();
  -        
  -        // Destroy persistence
  -        persistenceManager.destroy();
  -        
  -        // Destroy the pool
  -        instancePool.destroy();
  -        
  -        // Destroy all the interceptors in the chain         
  -        Interceptor in = interceptor;
  -        while (in != null)
  -        {
  -           in.destroy();
  -           in = in.getNext();
  -        }
  -             
  -        // Reset classloader
  -        Thread.currentThread().setContextClassLoader(oldCl);
  +       // Associate thread with classloader
  +       ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +       Thread.currentThread().setContextClassLoader(getClassLoader());
  +       
  +       // Call default destroy
  +       super.destroy();
  +       
  +       // Destroy container invoker
  +       containerInvoker.destroy();
  +       
  +       // Destroy instance cache
  +       instanceCache.destroy();
  +       
  +       // Destroy persistence
  +       persistenceManager.destroy();
  +       
  +       // Destroy the pool
  +       instancePool.destroy();
  +       
  +       // Destroy all the interceptors in the chain     
  +       Interceptor in = interceptor;
  +       while (in != null)
  +       {
  +          in.destroy();
  +          in = in.getNext();
  +       }
  +        
  +       // Reset classloader
  +       Thread.currentThread().setContextClassLoader(oldCl);
      }
      
      public Object invokeHome(MethodInvocation mi)
         throws Exception
      {
  -        return getInterceptor().invokeHome(mi);
  +       return getInterceptor().invokeHome(mi);
      }
   
      public Object invoke(MethodInvocation mi)
  @@ -325,7 +325,7 @@
         throws java.rmi.RemoteException
      {
         // TODO
  -             throw new Error("Not yet implemented");
  +        throw new Error("Not yet implemented");
      }
   
      public Object getPrimaryKey(MethodInvocation mi)
  @@ -344,8 +344,8 @@
      public boolean isIdentical(MethodInvocation mi)
         throws java.rmi.RemoteException
      {
  -             return 
((EJBObject)mi.getArguments()[0]).getPrimaryKey().equals(mi.getEnterpriseContext().getId());
  -             // TODO - should also check type
  +        return 
((EJBObject)mi.getArguments()[0]).getPrimaryKey().equals(mi.getEnterpriseContext().getId());
  +        // TODO - should also check type
      }
      
      // Home interface implementation ---------------------------------
  @@ -402,17 +402,17 @@
         Method[] m = homeInterface.getMethods();
         for (int i = 0; i < m.length; i++)
         {
  -                     try
  -                     {
  -              // Implemented by container
  -              if (m[i].getName().startsWith("find"))
  -                 map.put(m[i], getClass().getMethod("find", new Class[] { 
MethodInvocation.class }));
  -              else            
  -                 map.put(m[i], getClass().getMethod(m[i].getName()+"Home", new 
Class[] { MethodInvocation.class }));
  -                     } catch (NoSuchMethodException e)
  -                     {
  -                             throw new DeploymentException("Could not find matching 
method for "+m[i]);
  -                     }
  +            try
  +            {
  +             // Implemented by container
  +             if (m[i].getName().startsWith("find"))
  +                map.put(m[i], getClass().getMethod("find", new Class[] { 
MethodInvocation.class }));
  +             else            
  +                map.put(m[i], getClass().getMethod(m[i].getName()+"Home", new 
Class[] { MethodInvocation.class }));
  +            } catch (NoSuchMethodException e)
  +            {
  +                throw new DeploymentException("Could not find matching method for 
"+m[i]);
  +            }
         }
         
         homeMapping = map;
  @@ -426,22 +426,22 @@
         Method[] m = remoteInterface.getMethods();
         for (int i = 0; i < m.length; i++)
         {
  -                     try
  -                     {
  -              if (!m[i].getDeclaringClass().equals(EJBObject.class))
  -              {
  -                 // Implemented by bean
  -                 map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  -              }
  -              else
  -              {
  +            try
  +            {
  +             if (!m[i].getDeclaringClass().getName().equals(EJB_OBJECT))
  +             {
  +                // Implemented by bean
  +                map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  +             }
  +             else
  +             {
                  // Implemented by container
                  map.put(m[i], getClass().getMethod(m[i].getName(), new Class[] { 
MethodInvocation.class }));
  -              }
  -           } catch (NoSuchMethodException e)
  -           {
  -             throw new DeploymentException("Could not find matching method for 
"+m[i], e);
  -           }
  +             }
  +          } catch (NoSuchMethodException e)
  +          {
  +            throw new DeploymentException("Could not find matching method for 
"+m[i], e);
  +          }
         }
         
         beanMapping = map;
  @@ -452,7 +452,7 @@
         return new ContainerInterceptor();
      }
      
  -     // Inner classes -------------------------------------------------
  +    // Inner classes -------------------------------------------------
      // This is the last step before invocation - all interceptors are done
      class ContainerInterceptor
         implements Interceptor
  @@ -470,23 +470,23 @@
         public Object invokeHome(MethodInvocation mi)
            throws Exception
         {
  -              
  -                     //Debug
  -                     System.out.println("Invoking Home "+mi.getMethod().getName());
  -              
  +         
  +            //Debug
  +            System.out.println("Invoking Home "+mi.getMethod().getName());
  +         
            // Invoke and handle exceptions
            Method m = (Method)homeMapping.get(mi.getMethod());
            
  -                     try
  +            try
            {
               return m.invoke(EntityContainer.this, new Object[] { mi.getArguments() 
});
            } catch (InvocationTargetException e)
            {
  -                             //Debug
  -                             e.printStackTrace();
  -                             System.out.println("Home Exception seen  
"+e.getMessage());
  -                             
  -                             Throwable ex = e.getTargetException();
  +                //Debug
  +                e.printStackTrace();
  +                System.out.println("Home Exception seen  "+e.getMessage());
  +                
  +                Throwable ex = e.getTargetException();
               if (ex instanceof Exception)
                  throw (Exception)ex;
               else
  @@ -499,7 +499,7 @@
         {
            // Get method
            Method m = (Method)beanMapping.get(mi.getMethod());
  -              
  +         
            // Select instance to invoke (container or bean)
            if (m.getDeclaringClass().equals(EntityContainer.class))
            {
  @@ -510,9 +510,9 @@
               } catch (InvocationTargetException e)
               {
                  //Debug
  -                                System.out.println("Bean Exception seen  
"+e.getMessage());
  -                                     
  -                                Throwable ex = e.getTargetException();
  +                   System.out.println("Bean Exception seen  "+e.getMessage());
  +                    
  +                   Throwable ex = e.getTargetException();
                  if (ex instanceof Exception)
                     throw (Exception)ex;
                  else
  
  
  
  1.11      +125 -125  jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java
  
  Index: StatefulSessionContainer.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StatefulSessionContainer.java     2000/06/16 13:10:20     1.10
  +++ StatefulSessionContainer.java     2000/06/20 09:08:49     1.11
  @@ -31,11 +31,11 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.10 $
  + *   @version $Revision: 1.11 $
    */
   public class StatefulSessionContainer
      extends Container
  -     implements ContainerInvokerContainer, InstancePoolContainer
  +    implements ContainerInvokerContainer, InstancePoolContainer
   {
      // Constants -----------------------------------------------------
       
  @@ -51,13 +51,13 @@
      
      // This is the first interceptor in the chain. The last interceptor must be 
provided by the container itself
      protected Interceptor interceptor;
  -     
  +    
      // This is the instancepool that is to be used
      protected InstancePool instancePool;
  -     
  +    
      // This is the persistence manager for this container
      protected StatefulSessionPersistenceManager persistenceManager;
  -     
  +    
      protected InstanceCache instanceCache;
      
      // Static --------------------------------------------------------
  @@ -68,17 +68,17 @@
      public void setContainerInvoker(ContainerInvoker ci) 
      { 
         if (ci == null) 
  -             throw new IllegalArgumentException("Null invoker");
  -             
  +        throw new IllegalArgumentException("Null invoker");
  +        
         this.containerInvoker = ci; 
         ci.setContainer(this);
      }
   
      public ContainerInvoker getContainerInvoker() 
      { 
  -     return containerInvoker; 
  +    return containerInvoker; 
      }
  -     
  +    
      public void setInstanceCache(InstanceCache ic)
      { 
         this.instanceCache = ic; 
  @@ -93,17 +93,17 @@
      public void setInstancePool(InstancePool ip) 
      { 
         if (ip == null)
  -             throw new IllegalArgumentException("Null pool");
  -             
  +        throw new IllegalArgumentException("Null pool");
  +        
         this.instancePool = ip; 
         ip.setContainer(this);
      }
   
      public InstancePool getInstancePool() 
      { 
  -     return instancePool; 
  +    return instancePool; 
      }
  -     
  +    
      public StatefulSessionPersistenceManager getPersistenceManager() 
      { 
         return persistenceManager; 
  @@ -135,9 +135,9 @@
      
      public Interceptor getInterceptor() 
      { 
  -     return interceptor; 
  +    return interceptor; 
      }
  -     
  +    
      public Class getHomeClass()
      {
         return homeInterface;
  @@ -147,40 +147,40 @@
      {
         return remoteInterface;
      }
  -     
  +    
      // Container implementation --------------------------------------
      public void init()
         throws Exception
      {
  -       // Associate thread with classloader
  +      // Associate thread with classloader
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClassLoader());
         
  -       // Acquire classes from CL
  -       homeInterface = classLoader.loadClass(metaData.getHome());
  -       remoteInterface = classLoader.loadClass(metaData.getRemote());
  -               
  -       // Call default init
  +      // Acquire classes from CL
  +      homeInterface = classLoader.loadClass(metaData.getHome());
  +      remoteInterface = classLoader.loadClass(metaData.getRemote());
  +          
  +      // Call default init
        super.init();
  -       
  -       // Map the bean methods
  -       setupBeanMapping();
  -       
  -       // Map the home methods
  +      
  +      // Map the bean methods
  +      setupBeanMapping();
  +      
  +      // Map the home methods
        setupHomeMapping();
         
        // Init container invoker
        containerInvoker.init();
  -       
  -       // Init instance cache
  +      
  +      // Init instance cache
        instanceCache.init();
  -             
  +        
        // Initialize pool 
        instancePool.init();
  -       
  +      
        // Init persistence
        persistenceManager.init();
  -     
  +    
        // Initialize the interceptor by calling the chain
        Interceptor in = interceptor;
        while (in != null)
  @@ -189,7 +189,7 @@
           in.init();
           in = in.getNext();
        }
  -       
  +      
        // Reset classloader  
        Thread.currentThread().setContextClassLoader(oldCl);
      }
  @@ -197,11 +197,11 @@
      public void start()
         throws Exception
      {
  -       // Associate thread with classloader
  +      // Associate thread with classloader
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClassLoader());
         
  -       // Call default start
  +      // Call default start
         super.start();
         
         // Start container invoker
  @@ -212,96 +212,96 @@
         
         // Start pool 
         instancePool.start();
  -             
  +        
         // Start persistence
         persistenceManager.start();
         
  -             // Start all interceptors in the chain          
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                in.start();
  -                in = in.getNext();
  -             }
  -             
  -             // Reset classloader
  +        // Start all interceptors in the chain      
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +           in.start();
  +           in = in.getNext();
  +        }
  +        
  +        // Reset classloader
         Thread.currentThread().setContextClassLoader(oldCl);
         
      }
      
  -     public void stop() 
  -     {
  -             // Associate thread with classloader
  -             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -             Thread.currentThread().setContextClassLoader(getClassLoader());
  -
  -             // Call default stop
  -             super.stop();
  -
  -             // Stop container invoker
  -             containerInvoker.stop();
  -
  -             // Stop instance cache
  -             instanceCache.stop();
  -
  -             // Stop pool 
  -             instancePool.stop();
  -             
  -             // Stop persistence
  -             persistenceManager.stop();
  -
  -             // Stop the instance pool
  -             instancePool.stop();
  -
  -             // Stop all interceptors in the chain           
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                     in.stop();
  -                     in = in.getNext();
  -             }
  +    public void stop() 
  +    {
  +        // Associate thread with classloader
  +        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(getClassLoader());
  +
  +        // Call default stop
  +        super.stop();
  +
  +        // Stop container invoker
  +        containerInvoker.stop();
  +
  +        // Stop instance cache
  +        instanceCache.stop();
  +
  +        // Stop pool 
  +        instancePool.stop();
  +        
  +        // Stop persistence
  +        persistenceManager.stop();
  +
  +        // Stop the instance pool
  +        instancePool.stop();
  +
  +        // Stop all interceptors in the chain       
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +            in.stop();
  +            in = in.getNext();
  +        }
   
  -             // Reset classloader
  -             Thread.currentThread().setContextClassLoader(oldCl);
  +        // Reset classloader
  +        Thread.currentThread().setContextClassLoader(oldCl);
      }
      
       public void destroy()
      {
  -        // Associate thread with classloader
  -        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -        Thread.currentThread().setContextClassLoader(getClassLoader());
  -        
  -        // Call default destroy
  -        super.destroy();
  -        
  -        // Destroy container invoker
  -        containerInvoker.destroy();
  -        
  -        // Destroy instance cache
  -        instanceCache.destroy();
  -        
  -        // Destroy pool 
  -        instancePool.destroy();
  -             
  -        // Destroy persistence
  -        persistenceManager.destroy();
  -        
  -        // Destroy all the interceptors in the chain         
  -        Interceptor in = interceptor;
  -        while (in != null)
  -        {
  -           in.destroy();
  -           in = in.getNext();
  -        }
  -             
  -        // Reset classloader
  -        Thread.currentThread().setContextClassLoader(oldCl);
  +       // Associate thread with classloader
  +       ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +       Thread.currentThread().setContextClassLoader(getClassLoader());
  +       
  +       // Call default destroy
  +       super.destroy();
  +       
  +       // Destroy container invoker
  +       containerInvoker.destroy();
  +       
  +       // Destroy instance cache
  +       instanceCache.destroy();
  +       
  +       // Destroy pool 
  +       instancePool.destroy();
  +        
  +       // Destroy persistence
  +       persistenceManager.destroy();
  +       
  +       // Destroy all the interceptors in the chain     
  +       Interceptor in = interceptor;
  +       while (in != null)
  +       {
  +          in.destroy();
  +          in = in.getNext();
  +       }
  +        
  +       // Reset classloader
  +       Thread.currentThread().setContextClassLoader(oldCl);
      }
      
      public Object invokeHome(MethodInvocation mi)
         throws Exception
      {
  -        return getInterceptor().invokeHome(mi);
  +       return getInterceptor().invokeHome(mi);
      }
   
      /**
  @@ -344,7 +344,7 @@
      public EJBHome getEJBHome(MethodInvocation mi)
         throws java.rmi.RemoteException
      {
  -        
  +       
         return containerInvoker.getEJBHome();
      }
      
  @@ -358,34 +358,34 @@
      public EJBObject createHome(MethodInvocation mi)
         throws java.rmi.RemoteException, CreateException
      {
  -       getPersistenceManager().createSession(mi.getMethod(), mi.getArguments(), 
(StatefulSessionEnterpriseContext)mi.getEnterpriseContext());
  +      getPersistenceManager().createSession(mi.getMethod(), mi.getArguments(), 
(StatefulSessionEnterpriseContext)mi.getEnterpriseContext());
        return 
((StatefulSessionEnterpriseContext)mi.getEnterpriseContext()).getEJBObject();
      }
   
      // EJBHome implementation ----------------------------------------
      public void removeHome(Handle handle)
  -     throws java.rmi.RemoteException, RemoveException
  +    throws java.rmi.RemoteException, RemoveException
      {
  -     // TODO
  +    // TODO
      }
      
      public void removeHome(Object primaryKey)
  -     throws java.rmi.RemoteException, RemoveException
  +    throws java.rmi.RemoteException, RemoveException
      {
  -     // TODO
  +    // TODO
      }
      
      public EJBMetaData getEJBMetaDataHome()
  -     throws java.rmi.RemoteException
  +    throws java.rmi.RemoteException
      {
  -     return getContainerInvoker().getEJBMetaData();
  +    return getContainerInvoker().getEJBMetaData();
      }
      
      public HomeHandle getHomeHandleHome()
  -     throws java.rmi.RemoteException   
  +    throws java.rmi.RemoteException   
      {
  -     // TODO
  -     return null;
  +    // TODO
  +    return null;
      }
         
      // Private -------------------------------------------------------
  @@ -398,7 +398,7 @@
         for (int i = 0; i < m.length; i++)
         {
            // Implemented by container
  -         map.put(m[i], getClass().getMethod(m[i].getName()+"Home", new Class[] { 
MethodInvocation.class }));
  +         map.put(m[i], getClass().getMethod(m[i].getName()+"Home", 
m[i].getParameterTypes()));
         }
         
         homeMapping = map;
  @@ -412,20 +412,20 @@
         Method[] m = remoteInterface.getMethods();
         for (int i = 0; i < m.length; i++)
         {
  -         if (!m[i].getDeclaringClass().equals(EJBObject.class))
  +         if (!m[i].getDeclaringClass().getName().equals(EJB_OBJECT))
            {
               // Implemented by bean
               map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  -              
  -              }
  +         
  +         }
            else
            {
               try
               {
                  // Implemented by container
  -               map.put(m[i], getClass().getMethod(m[i].getName(), new Class[] { 
Method.class, Object[].class , StatefulSessionEnterpriseContext.class}));
  +               map.put(m[i], getClass().getMethod(m[i].getName(), new Class[] { 
MethodInvocation.class }));
               
  -                     } catch (NoSuchMethodException e)
  +            } catch (NoSuchMethodException e)
               {
                  System.out.println(m[i].getName() + " in bean has not been mapped");
               }
  
  
  
  1.8       +424 -424  jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java
  
  Index: StatelessSessionContainer.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StatelessSessionContainer.java    2000/06/16 13:10:20     1.7
  +++ StatelessSessionContainer.java    2000/06/20 09:08:50     1.8
  @@ -26,434 +26,434 @@
   *   @see <related>
   *   @author Rickard �berg ([EMAIL PROTECTED])
   *   @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
  -*   @version $Revision: 1.7 $
  +*   @version $Revision: 1.8 $
   */
   public class StatelessSessionContainer
  -     extends Container
  -     implements ContainerInvokerContainer, InstancePoolContainer
  +    extends Container
  +    implements ContainerInvokerContainer, InstancePoolContainer
   {
  -     // Constants -----------------------------------------------------
  -     
  -     // Attributes ----------------------------------------------------
  -     // These are the mappings between the home interface methods and the container 
methods
  -     protected Map homeMapping;
  -     
  -     // These are the mappings between the remote interface methods and the bean 
methods
  -     protected Map beanMapping;
  -     
  -     // This is the container invoker for this container
  -     protected ContainerInvoker containerInvoker;
  -     
  -     // This is the instancepool that is to be used
  -     protected InstancePool instancePool;
  -     
  -     // This is the first interceptor in the chain. The last interceptor must be 
provided by the container itself
  -     protected Interceptor interceptor;
  -     
  -     // Static --------------------------------------------------------
  -     
  -     // Constructors --------------------------------------------------
  -     
  -     // Public --------------------------------------------------------
  -     public void setContainerInvoker(ContainerInvoker ci) 
  -     { 
  -             if (ci == null)
  -                     throw new IllegalArgumentException("Null invoker");
  -             
  -             this.containerInvoker = ci; 
  -             ci.setContainer(this);
  -     }
  -     
  -     public ContainerInvoker getContainerInvoker() 
  -     { 
  -             return containerInvoker; 
  -     }
  -     
  -     public void setInstancePool(InstancePool ip) 
  -     { 
  -        if (ip == null)
  -             throw new IllegalArgumentException("Null pool");
  -                     
  -        this.instancePool = ip; 
  -        ip.setContainer(this);
  -     }
  +    // Constants -----------------------------------------------------
  +    
  +    // Attributes ----------------------------------------------------
  +    // These are the mappings between the home interface methods and the container 
methods
  +    protected Map homeMapping;
  +    
  +    // These are the mappings between the remote interface methods and the bean 
methods
  +    protected Map beanMapping;
  +    
  +    // This is the container invoker for this container
  +    protected ContainerInvoker containerInvoker;
  +    
  +    // This is the instancepool that is to be used
  +    protected InstancePool instancePool;
  +    
  +    // This is the first interceptor in the chain. The last interceptor must be 
provided by the container itself
  +    protected Interceptor interceptor;
  +    
  +    // Static --------------------------------------------------------
  +    
  +    // Constructors --------------------------------------------------
  +    
  +    // Public --------------------------------------------------------
  +    public void setContainerInvoker(ContainerInvoker ci) 
  +    { 
  +        if (ci == null)
  +            throw new IllegalArgumentException("Null invoker");
  +        
  +        this.containerInvoker = ci; 
  +        ci.setContainer(this);
  +    }
  +    
  +    public ContainerInvoker getContainerInvoker() 
  +    { 
  +        return containerInvoker; 
  +    }
  +    
  +    public void setInstancePool(InstancePool ip) 
  +    { 
  +       if (ip == null)
  +        throw new IllegalArgumentException("Null pool");
  +            
  +       this.instancePool = ip; 
  +       ip.setContainer(this);
  +    }
   
  -     public InstancePool getInstancePool() 
  -     { 
  -             return instancePool; 
  -     }
  -     
  -     public void addInterceptor(Interceptor in) 
  -     { 
  -        if (interceptor == null)
  -        {
  -           interceptor = in;
  -        } else
  -        {
  -           
  -           Interceptor current = interceptor;
  -           while ( current.getNext() != null)
  -           {
  -              current = current.getNext();
  -           }
  -              
  -           current.setNext(in);
  -        }
  -     }
  -     
  -     public Interceptor getInterceptor() 
  -     { 
  -             return interceptor; 
  -     }
  -     
  -     public Class getHomeClass()
  -     {
  -        return homeInterface;
  -     }
  -     
  -     public Class getRemoteClass()
  -     {
  -        return remoteInterface;
  -     }
  -     
  -     // Container implementation --------------------------------------
  -     public void init()
  -             throws Exception
  -     {
  -             // Associate thread with classloader
  -             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -             Thread.currentThread().setContextClassLoader(getClassLoader());
  -             
  -             // Acquire classes from CL
  -             homeInterface = classLoader.loadClass(metaData.getHome());
  -             remoteInterface = classLoader.loadClass(metaData.getRemote());
  -             
  -             // Call default init
  -             super.init();
  -             
  -             // Map the bean methods
  -             setupBeanMapping();
  -             
  -             // Map the home methods
  -             setupHomeMapping();
  -             
  -             // Initialize pool 
  -             instancePool.init();
  -             
  -             // Init container invoker
  -             containerInvoker.init();                
  -             
  -             // Initialize the interceptor by calling the chain
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                in.setContainer(this);
  -                in.init();
  -                in = in.getNext();
  -             }
  -             
  -             // Reset classloader  
  -             Thread.currentThread().setContextClassLoader(oldCl);
  -     }
  -     
  -     public void start()
  -             throws Exception
  -     {
  -             // Associate thread with classloader
  -             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -             Thread.currentThread().setContextClassLoader(getClassLoader());
  -             
  -             // Call default start
  -             super.start();
  -             
  -             // Start container invoker
  -             containerInvoker.start();
  -             
  -             // Start the instance pool
  -             instancePool.start();
  -             
  -             // Start all interceptors in the chain          
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                in.start();
  -                in = in.getNext();
  -             }
  -             
  -             // Reset classloader
  -             Thread.currentThread().setContextClassLoader(oldCl);
  -     }
  -     
  -     public void stop()
  -     {
  -             // Associate thread with classloader
  -             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -             Thread.currentThread().setContextClassLoader(getClassLoader());
  -             
  -             // Call default stop
  -             super.stop();
  -             
  -             // Stop container invoker
  -             containerInvoker.stop();
  -             
  -             // Stop the instance pool
  -             instancePool.stop();
  -             
  -             // Stop all interceptors in the chain           
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                in.stop();
  -                in = in.getNext();
  -             }
  -             
  -             // Reset classloader
  -             Thread.currentThread().setContextClassLoader(oldCl);
  -     }
  -     
  -     public void destroy()
  -     {
  -             // Associate thread with classloader
  -             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  -             Thread.currentThread().setContextClassLoader(getClassLoader());
  -             
  -             // Call default destroy
  -             super.destroy();
  -             
  -             // Destroy container invoker
  -             containerInvoker.destroy();
  -             
  -             // Destroy the pool
  -             instancePool.destroy();
  -             
  -             // Destroy all the interceptors in the chain            
  -             Interceptor in = interceptor;
  -             while (in != null)
  -             {
  -                in.destroy();
  -                in = in.getNext();
  -             }
  -             
  -             // Reset classloader
  -             Thread.currentThread().setContextClassLoader(oldCl);
  -     }
  -     
  -     public Object invokeHome(MethodInvocation mi)
  -             throws Exception
  -     {
  -             return getInterceptor().invokeHome(mi);
  -     }
  -     
  -     /**
  -     *   This method does invocation interpositioning of tx and security, 
  -     *   retrieves the instance from an object table, and invokes the method
  -     *   on the particular instance
  -     *
  -     * @param   id  
  -     * @param   m  
  -     * @param   args  
  -     * @return     
  -     * @exception   Exception  
  -     */
  -     public Object invoke(MethodInvocation mi)
  -     throws Exception
  -     {
  -             // Invoke through interceptors
  -             return getInterceptor().invoke(mi);
  -     }
  -     
  -     // EJBObject implementation --------------------------------------
  -     public void remove(MethodInvocation mi)
  -             throws java.rmi.RemoteException, RemoveException
  -     {
  -             //TODO
  -     }
  -     
  -     public Handle getHandle(MethodInvocation mi)
  -             throws java.rmi.RemoteException
  -     {
  -             // TODO
  -             return null;
  -     }
  -     
  -     public Object getPrimaryKey(MethodInvocation mi)
  -             throws java.rmi.RemoteException
  -     {
  -             // TODO
  -             return null;
  -     }
  -     
  -     public EJBHome getEJBHome(MethodInvocation mi)
  -             throws java.rmi.RemoteException
  -     {
  -             return containerInvoker.getEJBHome();
  -     }
  -     
  -     public boolean isIdentical(MethodInvocation mi)
  -             throws java.rmi.RemoteException
  -     {
  -             return false; // TODO
  -     }
  -     
  -     // EJBHome implementation ----------------------------------------
  -     public EJBObject createHome()
  -             throws java.rmi.RemoteException, CreateException
  -     {
  -             Object obj = containerInvoker.getStatelessSessionEJBObject();
  -             return (EJBObject)obj;
  -     }
  -     
  -     public void removeHome(Handle handle)
  -             throws java.rmi.RemoteException, RemoveException
  -     {
  -             // TODO
  -     }
  -     
  -     public void removeHome(Object primaryKey)
  -             throws java.rmi.RemoteException, RemoveException
  -     {
  -             // TODO
  -     }
  -     
  -     public EJBMetaData getEJBMetaDataHome()
  -             throws java.rmi.RemoteException
  -     {
  -             // TODO
  -             return null;
  -     }
  -     
  -     public HomeHandle getHomeHandleHome()
  -             throws java.rmi.RemoteException   
  -     {
  -             // TODO
  -             return null;
  -     }
  -     
  -     // Protected  ----------------------------------------------------
  -     protected void setupHomeMapping()
  -             throws NoSuchMethodException
  -     {
  -             Map map = new HashMap();
  -             
  -             Method[] m = homeInterface.getMethods();
  -             for (int i = 0; i < m.length; i++)
  -             {
  -                     // Implemented by container
  -//                   System.out.println("Mapping "+m[i].getName());
  -                     map.put(m[i], getClass().getMethod(m[i].getName()+"Home", 
m[i].getParameterTypes()));
  -             }
  -             
  -             homeMapping = map;
  -     }
  -     
  -     protected void setupBeanMapping()
  -             throws NoSuchMethodException
  -     {
  -             Map map = new HashMap();
  -             Method[] m = remoteInterface.getMethods();
  -             for (int i = 0; i < m.length; i++)
  -             {
  -                     if (!m[i].getDeclaringClass().equals(EJBObject.class))
  -                     {
  -                             // Implemented by bean
  -                             map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  -                             //System.out.println("Mapped "+m[i].getName()+" 
"+m[i].hashCode()+"to "+map.get(m[i]));
  -                     }
  -                     else
  -                     {
  -                             try
  -                             {
  -                                     // Implemented by container
  -                                     //System.out.println("Mapped Container method 
"+m[i].getName() +" HASH "+m[i].hashCode());
  -                                     map.put(m[i], 
getClass().getMethod(m[i].getName(), new Class[] { MethodInvocation.class }));
  -                                     
  -                                     
  -                             } catch (NoSuchMethodException e)
  -                             {
  -                                     e.printStackTrace();
  -                                     System.out.println(m[i].getName() + " in bean 
has not been mapped");
  -                                     
  -                             }
  -                     }
  -             }
  -             
  -             beanMapping = map;
  -     }
  -     
  -     Interceptor createContainerInterceptor()
  -     {
  -             return new ContainerInterceptor();
  -     }
  -     
  -     // This is the last step before invocation - all interceptors are done
  -     class ContainerInterceptor
  -     implements Interceptor
  -     {
  -             public void setContainer(Container con) {}
  -             
  -             public void setNext(Interceptor interceptor) {}
  -             public Interceptor getNext() { return null; }
  -             
  -             public void init() {}
  -             public void start() {}
  -             public void stop() {}
  -             public void destroy() {}
  -             
  -             public Object invokeHome(MethodInvocation mi)
  -                     throws Exception
  -             {
  -                     Method m = (Method)homeMapping.get(mi.getMethod());
  -                     try
  -                     {
  -                        return m.invoke(StatelessSessionContainer.this, 
mi.getArguments());
  -                     } catch (InvocationTargetException e)
  -                     {
  -                             //Debug
  -                             e.printStackTrace();
  -                             System.out.println("Home Exception seen  
"+e.getMessage());
  -                             
  -                             Throwable ex = e.getTargetException();
  -                        if (ex instanceof Exception)
  -                           throw (Exception)ex;
  -                        else
  -                           throw (Error)ex;
  -                     }
  -             }
  -             
  -             public Object invoke(MethodInvocation mi)
  -                     throws Exception
  -             {
  -                     // Get method and instance to invoke upon
  -                     Method m = (Method)beanMapping.get(mi.getMethod());
  -                     
  -                     //If we have a method that needs to be done by the container 
(EJBObject methods)
  -                     if 
(m.getDeclaringClass().equals(StatelessSessionContainer.class)) 
  -                     {
  -                     try 
  -                             {
  -                                     return 
m.invoke(StatelessSessionContainer.this, new Object[] { mi });
  -                             } catch (InvocationTargetException e) 
  -                             {
  -                             Throwable ex = e.getTargetException();
  +    public InstancePool getInstancePool() 
  +    { 
  +        return instancePool; 
  +    }
  +    
  +    public void addInterceptor(Interceptor in) 
  +    { 
  +       if (interceptor == null)
  +       {
  +          interceptor = in;
  +       } else
  +       {
  +          
  +          Interceptor current = interceptor;
  +          while ( current.getNext() != null)
  +          {
  +             current = current.getNext();
  +          }
  +             
  +          current.setNext(in);
  +       }
  +    }
  +    
  +    public Interceptor getInterceptor() 
  +    { 
  +        return interceptor; 
  +    }
  +    
  +    public Class getHomeClass()
  +    {
  +       return homeInterface;
  +    }
  +    
  +    public Class getRemoteClass()
  +    {
  +       return remoteInterface;
  +    }
  +    
  +    // Container implementation --------------------------------------
  +    public void init()
  +        throws Exception
  +    {
  +        // Associate thread with classloader
  +        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(getClassLoader());
  +        
  +        // Acquire classes from CL
  +        homeInterface = classLoader.loadClass(metaData.getHome());
  +        remoteInterface = classLoader.loadClass(metaData.getRemote());
  +        
  +        // Call default init
  +        super.init();
  +        
  +        // Map the bean methods
  +        setupBeanMapping();
  +        
  +        // Map the home methods
  +        setupHomeMapping();
  +        
  +        // Initialize pool 
  +        instancePool.init();
  +        
  +        // Init container invoker
  +        containerInvoker.init();        
  +        
  +        // Initialize the interceptor by calling the chain
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +           in.setContainer(this);
  +           in.init();
  +           in = in.getNext();
  +        }
  +        
  +        // Reset classloader  
  +        Thread.currentThread().setContextClassLoader(oldCl);
  +    }
  +    
  +    public void start()
  +        throws Exception
  +    {
  +        // Associate thread with classloader
  +        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(getClassLoader());
  +        
  +        // Call default start
  +        super.start();
  +        
  +        // Start container invoker
  +        containerInvoker.start();
  +        
  +        // Start the instance pool
  +        instancePool.start();
  +        
  +        // Start all interceptors in the chain      
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +           in.start();
  +           in = in.getNext();
  +        }
  +        
  +        // Reset classloader
  +        Thread.currentThread().setContextClassLoader(oldCl);
  +    }
  +    
  +    public void stop()
  +    {
  +        // Associate thread with classloader
  +        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(getClassLoader());
  +        
  +        // Call default stop
  +        super.stop();
  +        
  +        // Stop container invoker
  +        containerInvoker.stop();
  +        
  +        // Stop the instance pool
  +        instancePool.stop();
  +        
  +        // Stop all interceptors in the chain       
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +           in.stop();
  +           in = in.getNext();
  +        }
  +        
  +        // Reset classloader
  +        Thread.currentThread().setContextClassLoader(oldCl);
  +    }
  +    
  +    public void destroy()
  +    {
  +        // Associate thread with classloader
  +        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +        Thread.currentThread().setContextClassLoader(getClassLoader());
  +        
  +        // Call default destroy
  +        super.destroy();
  +        
  +        // Destroy container invoker
  +        containerInvoker.destroy();
  +        
  +        // Destroy the pool
  +        instancePool.destroy();
  +        
  +        // Destroy all the interceptors in the chain        
  +        Interceptor in = interceptor;
  +        while (in != null)
  +        {
  +           in.destroy();
  +           in = in.getNext();
  +        }
  +        
  +        // Reset classloader
  +        Thread.currentThread().setContextClassLoader(oldCl);
  +    }
  +    
  +    public Object invokeHome(MethodInvocation mi)
  +        throws Exception
  +    {
  +        return getInterceptor().invokeHome(mi);
  +    }
  +    
  +    /**
  +    *   This method does invocation interpositioning of tx and security, 
  +    *   retrieves the instance from an object table, and invokes the method
  +    *   on the particular instance
  +    *
  +    * @param   id  
  +    * @param   m  
  +    * @param   args  
  +    * @return     
  +    * @exception   Exception  
  +    */
  +    public Object invoke(MethodInvocation mi)
  +    throws Exception
  +    {
  +        // Invoke through interceptors
  +        return getInterceptor().invoke(mi);
  +    }
  +    
  +    // EJBObject implementation --------------------------------------
  +    public void remove(MethodInvocation mi)
  +        throws java.rmi.RemoteException, RemoveException
  +    {
  +        //TODO
  +    }
  +    
  +    public Handle getHandle(MethodInvocation mi)
  +        throws java.rmi.RemoteException
  +    {
  +        // TODO
  +        return null;
  +    }
  +    
  +    public Object getPrimaryKey(MethodInvocation mi)
  +        throws java.rmi.RemoteException
  +    {
  +        // TODO
  +        return null;
  +    }
  +    
  +    public EJBHome getEJBHome(MethodInvocation mi)
  +        throws java.rmi.RemoteException
  +    {
  +        return containerInvoker.getEJBHome();
  +    }
  +    
  +    public boolean isIdentical(MethodInvocation mi)
  +        throws java.rmi.RemoteException
  +    {
  +        return false; // TODO
  +    }
  +    
  +    // EJBHome implementation ----------------------------------------
  +    public EJBObject createHome()
  +        throws java.rmi.RemoteException, CreateException
  +    {
  +        Object obj = containerInvoker.getStatelessSessionEJBObject();
  +        return (EJBObject)obj;
  +    }
  +    
  +    public void removeHome(Handle handle)
  +        throws java.rmi.RemoteException, RemoveException
  +    {
  +        // TODO
  +    }
  +    
  +    public void removeHome(Object primaryKey)
  +        throws java.rmi.RemoteException, RemoveException
  +    {
  +        // TODO
  +    }
  +    
  +    public EJBMetaData getEJBMetaDataHome()
  +        throws java.rmi.RemoteException
  +    {
  +        // TODO
  +        return null;
  +    }
  +    
  +    public HomeHandle getHomeHandleHome()
  +        throws java.rmi.RemoteException   
  +    {
  +        // TODO
  +        return null;
  +    }
  +    
  +    // Protected  ----------------------------------------------------
  +    protected void setupHomeMapping()
  +        throws NoSuchMethodException
  +    {
  +        Map map = new HashMap();
  +        
  +        Method[] m = homeInterface.getMethods();
  +        for (int i = 0; i < m.length; i++)
  +        {
  +            // Implemented by container
  +//          System.out.println("Mapping "+m[i].getName());
  +            map.put(m[i], getClass().getMethod(m[i].getName()+"Home", 
m[i].getParameterTypes()));
  +        }
  +        
  +        homeMapping = map;
  +    }
  +    
  +    protected void setupBeanMapping()
  +        throws NoSuchMethodException
  +    {
  +        Map map = new HashMap();
  +        Method[] m = remoteInterface.getMethods();
  +        for (int i = 0; i < m.length; i++)
  +        {
  +            if (!m[i].getDeclaringClass().getName().equals(EJB_OBJECT))
  +            {
  +                // Implemented by bean
  +                map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  +                //System.out.println("Mapped "+m[i].getName()+" 
"+m[i].hashCode()+"to "+map.get(m[i]));
  +            }
  +            else
  +            {
  +                try
  +                {
  +                    // Implemented by container
  +                    //System.out.println("Mapped Container method "+m[i].getName() 
+" HASH "+m[i].hashCode());
  +                    map.put(m[i], getClass().getMethod(m[i].getName(), new Class[] 
{ MethodInvocation.class }));
  +                    
  +                    
  +                } catch (NoSuchMethodException e)
  +                {
  +                    e.printStackTrace();
  +                    System.out.println(m[i].getName() + " in bean has not been 
mapped");
  +                    
  +                }
  +            }
  +        }
  +        
  +        beanMapping = map;
  +    }
  +    
  +    Interceptor createContainerInterceptor()
  +    {
  +        return new ContainerInterceptor();
  +    }
  +    
  +    // This is the last step before invocation - all interceptors are done
  +    class ContainerInterceptor
  +    implements Interceptor
  +    {
  +        public void setContainer(Container con) {}
  +        
  +        public void setNext(Interceptor interceptor) {}
  +        public Interceptor getNext() { return null; }
  +        
  +        public void init() {}
  +        public void start() {}
  +        public void stop() {}
  +        public void destroy() {}
  +        
  +        public Object invokeHome(MethodInvocation mi)
  +            throws Exception
  +        {
  +            Method m = (Method)homeMapping.get(mi.getMethod());
  +            try
  +            {
  +               return m.invoke(StatelessSessionContainer.this, mi.getArguments());
  +            } catch (InvocationTargetException e)
  +            {
  +                //Debug
  +                e.printStackTrace();
  +                System.out.println("Home Exception seen  "+e.getMessage());
  +                
  +                Throwable ex = e.getTargetException();
  +               if (ex instanceof Exception)
  +                  throw (Exception)ex;
  +               else
  +                  throw (Error)ex;
  +            }
  +        }
  +        
  +        public Object invoke(MethodInvocation mi)
  +            throws Exception
  +        {
  +            // Get method and instance to invoke upon
  +            Method m = (Method)beanMapping.get(mi.getMethod());
  +            
  +            //If we have a method that needs to be done by the container (EJBObject 
methods)
  +            if (m.getDeclaringClass().equals(StatelessSessionContainer.class)) 
  +            {
  +                try 
  +                {
  +                    return m.invoke(StatelessSessionContainer.this, new Object[] { 
mi });
  +                } catch (InvocationTargetException e) 
  +                {
  +                Throwable ex = e.getTargetException();
                  
  -                             if (ex instanceof Exception) throw (Exception)ex;
  -                     else throw (Error)ex;
  -             }
  -                     } else // we have a method that needs to be done by a bean 
instance
  -                     {
  -                             // Invoke and handle exceptions
  -             try 
  -                             {
  -                             return 
m.invoke(mi.getEnterpriseContext().getInstance(), mi.getArguments());
  -                             } catch (InvocationTargetException e) 
  -                             {
  -                                     Throwable ex = e.getTargetException();
  -                             
  -                                     if (ex instanceof Exception) throw 
(Exception)ex;
  -                             else throw (Error)ex;
  -             }
  -             }
  -             }
  -     }
  +                if (ex instanceof Exception) throw (Exception)ex;
  +                    else throw (Error)ex;
  +            }
  +            } else // we have a method that needs to be done by a bean instance
  +            {
  +                // Invoke and handle exceptions
  +            try 
  +                {
  +                return m.invoke(mi.getEnterpriseContext().getInstance(), 
mi.getArguments());
  +                } catch (InvocationTargetException e) 
  +                {
  +                    Throwable ex = e.getTargetException();
  +                    
  +                    if (ex instanceof Exception) throw (Exception)ex;
  +                    else throw (Error)ex;
  +            }
  +        }
  +        }
  +    }
   }
   
  
  
  

Reply via email to