User: oberg   
  Date: 00/06/21 04:51:30

  Modified:    src/main/org/jboss/ejb Container.java ContainerFactory.java
                        EntityContainer.java StatefulSessionContainer.java
                        StatelessSessionContainer.java
  Log:
  Added some stateful container files
  
  Revision  Changes    Path
  1.17      +1 -4      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Container.java    2000/06/21 07:46:21     1.16
  +++ Container.java    2000/06/21 11:51:29     1.17
  @@ -63,15 +63,12 @@
    *   @see ContainerFactory
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
  - *   @version $Revision: 1.16 $
  + *   @version $Revision: 1.17 $
    */
   public abstract class Container
   {
      // Constants -----------------------------------------------------
   
  -   // This is used in Class name comparisons
  -   protected static final String EJB_OBJECT = "javax.ejb.EJBObject";
  -    
      // Attributes ----------------------------------------------------
       
       // This is the application that this container is a part of
  
  
  
  1.22      +10 -1     jboss/src/main/org/jboss/ejb/ContainerFactory.java
  
  Index: ContainerFactory.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ContainerFactory.java     2000/06/16 13:10:19     1.21
  +++ ContainerFactory.java     2000/06/21 11:51:29     1.22
  @@ -66,7 +66,7 @@
   *   @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
   *   @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>
   *
  -*   @version $Revision: 1.21 $
  +*   @version $Revision: 1.22 $
   */
   public class ContainerFactory
        extends org.jboss.util.ServiceMBeanSupport
  @@ -259,6 +259,9 @@
                                                // Set metadata
                                                container.setMetaData(bean);
                                                
  +                                             // Set transaction manager
  +                                             
container.setTransactionManager((TransactionManager)new 
InitialContext().lookup("TransactionManager"));
  +                                             
                                                // Get container configuration
                                                ContainerConfiguration conf = 
bean.getContainerConfiguration();
                                                
  @@ -307,6 +310,9 @@
                                                // Set metadata
                                                container.setMetaData(bean);
                                                
  +                                             // Set transaction manager
  +                                             
container.setTransactionManager((TransactionManager)new 
InitialContext().lookup("TransactionManager"));
  +                                             
                                                // Get container configuration
                                                ContainerConfiguration conf = 
bean.getContainerConfiguration();
                                                
  @@ -354,6 +360,9 @@
                                        
                                        // Set metadata
                                        container.setMetaData(bean);
  +                                     
  +                                     // Set transaction manager
  +                                     
container.setTransactionManager((TransactionManager)new 
InitialContext().lookup("TransactionManager"));
                                        
                                        // Get container configuration
                                        ContainerConfiguration conf = 
bean.getContainerConfiguration();
  
  
  
  1.11      +6 -17     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EntityContainer.java      2000/06/20 09:08:49     1.10
  +++ EntityContainer.java      2000/06/21 11:51:29     1.11
  @@ -33,7 +33,7 @@
    *   @see EntityEnterpriseContext
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  - *   @version $Revision: 1.10 $
  + *   @version $Revision: 1.11 $
    */
   public class EntityContainer
      extends Container
  @@ -428,7 +428,7 @@
         {
               try
               {
  -             if (!m[i].getDeclaringClass().getName().equals(EJB_OBJECT))
  +             if (!m[i].getDeclaringClass().getName().equals("javax.ejb.EJBObject"))
                {
                   // Implemented by bean
                   map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  @@ -470,23 +470,15 @@
         public Object invokeHome(MethodInvocation mi)
            throws Exception
         {
  -         
  -            //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() 
});
  +            return m.invoke(EntityContainer.this, new Object[] { mi });
            } catch (InvocationTargetException e)
            {
  -                //Debug
  -                e.printStackTrace();
  -                System.out.println("Home Exception seen  "+e.getMessage());
  -                
  -                Throwable ex = e.getTargetException();
  +                             Throwable ex = e.getTargetException();
               if (ex instanceof Exception)
                  throw (Exception)ex;
               else
  @@ -509,10 +501,7 @@
                  return m.invoke(EntityContainer.this, new Object[] { mi });
               } catch (InvocationTargetException e)
               {
  -               //Debug
  -                   System.out.println("Bean Exception seen  "+e.getMessage());
  -                    
  -                   Throwable ex = e.getTargetException();
  +                                     Throwable ex = e.getTargetException();
                  if (ex instanceof Exception)
                     throw (Exception)ex;
                  else
  
  
  
  1.13      +11 -27    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StatefulSessionContainer.java     2000/06/21 07:46:21     1.12
  +++ StatefulSessionContainer.java     2000/06/21 11:51:30     1.13
  @@ -31,7 +31,7 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.12 $
  + *   @version $Revision: 1.13 $
    */
   public class StatefulSessionContainer
      extends Container
  @@ -363,29 +363,22 @@
      }
   
      // EJBHome implementation ----------------------------------------
  -   public void removeHome(Handle handle)
  +   public void removeHome(MethodInvocation mi)
       throws java.rmi.RemoteException, RemoveException
      {
  -    // TODO
  -   }
  -   
  -   public void removeHome(Object primaryKey)
  -    throws java.rmi.RemoteException, RemoveException
  -   {
  -    // TODO
  -   }
  +             throw new Error("Not Yet Implemented");
  +     }
      
  -   public EJBMetaData getEJBMetaDataHome()
  +   public EJBMetaData getEJBMetaDataHome(MethodInvocation mi)
       throws java.rmi.RemoteException
      {
  -    return getContainerInvoker().getEJBMetaData();
  +        return getContainerInvoker().getEJBMetaData();
      }
      
  -   public HomeHandle getHomeHandleHome()
  -    throws java.rmi.RemoteException   
  +   public HomeHandle getHomeHandleHome(MethodInvocation mi)
  +        throws java.rmi.RemoteException   
      {
  -    // TODO
  -    return null;
  +        throw new Error("Not Yet Implemented");
      }
         
      // Private -------------------------------------------------------
  @@ -400,15 +393,7 @@
            try
            {
               // Implemented by container
  -            if (m[i].getName().equals("create"))
  -            {
  -               map.put(m[i], getClass().getMethod("createHome", new Class[] { 
MethodInvocation.class }));
  -            }
  -            else
  -            {
  -               map.put(m[i], getClass().getMethod(m[i].getName()+"Home", 
m[i].getParameterTypes()));
  -            
  -            }
  +            map.put(m[i], getClass().getMethod(m[i].getName()+"Home", new Class[] { 
MethodInvocation.class }));
            } catch (NoSuchMethodException e)
            {
               System.out.println(m[i].getName() + " in bean has not been mapped");
  @@ -428,11 +413,10 @@
         {
            try
            {
  -            if (!m[i].getDeclaringClass().getName().equals(EJB_OBJECT))
  +            if (!m[i].getDeclaringClass().getName().equals("javax.ejb.EJBObject"))
               {
                   // Implemented by bean
                   map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  -         
               }
               else
               {
  
  
  
  1.9       +11 -15    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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StatelessSessionContainer.java    2000/06/20 09:08:50     1.8
  +++ StatelessSessionContainer.java    2000/06/21 11:51:30     1.9
  @@ -26,7 +26,7 @@
   *   @see <related>
   *   @author Rickard �berg ([EMAIL PROTECTED])
   *   @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
  -*   @version $Revision: 1.8 $
  +*   @version $Revision: 1.9 $
   */
   public class StatelessSessionContainer
       extends Container
  @@ -353,7 +353,7 @@
           Method[] m = remoteInterface.getMethods();
           for (int i = 0; i < m.length; i++)
           {
  -            if (!m[i].getDeclaringClass().getName().equals(EJB_OBJECT))
  +            if (!m[i].getDeclaringClass().getName().equals("javax.ejb.EJBObject"))
               {
                   // Implemented by bean
                   map.put(m[i], beanClass.getMethod(m[i].getName(), 
m[i].getParameterTypes()));
  @@ -408,10 +408,6 @@
                  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;
  @@ -434,25 +430,25 @@
                       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;
  -            }
  +                     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 
  +                         try 
                   {
  -                return m.invoke(mi.getEnterpriseContext().getInstance(), 
mi.getArguments());
  +                 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