User: docodan 
  Date: 01/06/04 13:46:42

  Modified:    src/main/org/jboss/ejb/plugins BMPPersistenceManager.java
                        CMPPersistenceManager.java
  Log:
  Added support for local interfaces.
  
  Revision  Changes    Path
  1.22      +21 -2     jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java
  
  Index: BMPPersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- BMPPersistenceManager.java        2001/01/10 20:48:24     1.21
  +++ BMPPersistenceManager.java        2001/06/04 20:46:42     1.22
  @@ -36,7 +36,7 @@
   *   @see <related>
   *   @author Rickard �berg ([EMAIL PROTECTED])
   *  @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  -*   @version $Revision: 1.21 $
  +*   @version $Revision: 1.22 $
   */
   public class BMPPersistenceManager
   implements EntityPersistenceManager
  @@ -76,7 +76,22 @@
         ejbRemove = EntityBean.class.getMethod("ejbRemove", new Class[0]);
   
         // Create cache of create methods
  -      Method[] methods = con.getHomeClass().getMethods();
  +      if (con.getHomeClass() != null)
  +      {
  +         Method[] methods = con.getHomeClass().getMethods();
  +         createMethodCache( methods );
  +      }
  +      if (con.getLocalHomeClass() != null)
  +      {
  +         Method[] methods = con.getLocalHomeClass().getMethods();
  +         createMethodCache( methods );
  +      }
  +
  +   }
  +   
  +   private void createMethodCache( Method[] methods )
  +      throws NoSuchMethodException
  +   {
         for (int i = 0; i < methods.length; i++)
         {
            if (methods[i].getName().equals("create"))
  @@ -165,7 +180,11 @@
         con.getInstanceCache().insert(ctx);
   
         // Create EJBObject
  +        // Create EJBObject
  +     if (con.getContainerInvoker() != null)
         ctx.setEJBObject(con.getContainerInvoker().getEntityEJBObject(cacheKey));
  +     if (con.getLocalHomeClass() != null)
  +      
ctx.setEJBLocalObject(con.getLocalContainerInvoker().getEntityEJBLocalObject(cacheKey));
   
         try
         {
  
  
  
  1.20      +30 -12    jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java
  
  Index: CMPPersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CMPPersistenceManager.java        2001/05/27 00:49:15     1.19
  +++ CMPPersistenceManager.java        2001/06/04 20:46:42     1.20
  @@ -46,7 +46,7 @@
   *
   *   @see <related>
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  -*   @version $Revision: 1.19 $
  +*   @version $Revision: 1.20 $
   */
   public class CMPPersistenceManager
   implements EntityPersistenceManager {
  @@ -95,19 +95,34 @@
           ejbPassivate = EntityBean.class.getMethod("ejbPassivate", new Class[0]);
           ejbRemove = EntityBean.class.getMethod("ejbRemove", new Class[0]);
   
  -             // Create cache of create methods
  -         Method[] methods = con.getHomeClass().getMethods();
  -         for (int i = 0; i < methods.length; i++)
  -         {
  -                     if (methods[i].getName().equals("create"))
  -                     {
  -                             createMethods.put(methods[i], 
con.getBeanClass().getMethod("ejbCreate", methods[i].getParameterTypes()));
  -                             postCreateMethods.put(methods[i], 
con.getBeanClass().getMethod("ejbPostCreate", methods[i].getParameterTypes()));
  -                     }
  -         }
  +         if (con.getHomeClass() != null)
  +         {
  +            Method[] methods = con.getHomeClass().getMethods();
  +            createMethodCache( methods );
  +         }
  +         if (con.getLocalHomeClass() != null)
  +         {
  +            Method[] methods = con.getLocalHomeClass().getMethods();
  +            createMethodCache( methods );
  +         }     
   
          store.init();
       }
  +    
  +    private void createMethodCache( Method[] methods )
  +      throws NoSuchMethodException
  +    {
  +     // Create cache of create methods
  +      for (int i = 0; i < methods.length; i++)
  +      {
  +                  if (methods[i].getName().equals("create"))
  +                  {
  +                          createMethods.put(methods[i], 
con.getBeanClass().getMethod("ejbCreate", methods[i].getParameterTypes()));
  +                          postCreateMethods.put(methods[i], 
con.getBeanClass().getMethod("ejbPostCreate", methods[i].getParameterTypes()));
  +                  }
  +      }
  +       
  +    }
   
       public void start()
       throws Exception {
  @@ -227,7 +242,10 @@
                con.getInstanceCache().insert(ctx);
   
           // Create EJBObject
  -        ctx.setEJBObject(con.getContainerInvoker().getEntityEJBObject(cacheKey));
  +        if (con.getContainerInvoker() != null)
  +         ctx.setEJBObject(con.getContainerInvoker().getEntityEJBObject(cacheKey));
  +        if (con.getLocalHomeClass() != null)
  +         
ctx.setEJBLocalObject(con.getLocalContainerInvoker().getEntityEJBLocalObject(cacheKey));
   
                try
                {
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to