User: user57  
  Date: 02/02/14 22:15:51

  Modified:    src/main/org/jboss/test/cts/ejb BmpCallbackBean.java
                        CtsBmpBean.java CtsCmpBean.java
                        StatefulSessionBean.java StatelessSessionBean.java
  Log:
   o replaced most System.out usage with Log4j.  should really introduce
     some base classes to make this mess more maintainable...
  
  Revision  Changes    Path
  1.2       +12 -10    jbosstest/src/main/org/jboss/test/cts/ejb/BmpCallbackBean.java
  
  Index: BmpCallbackBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/cts/ejb/BmpCallbackBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BmpCallbackBean.java      18 Feb 2001 16:04:43 -0000      1.1
  +++ BmpCallbackBean.java      15 Feb 2002 06:15:51 -0000      1.2
  @@ -15,6 +15,8 @@
   public class BmpCallbackBean
      implements EntityBean
   {
  +   org.apache.log4j.Category log = 
org.apache.log4j.Category.getInstance(getClass());
  +   
       EntityContext ctx;
   
      /**
  @@ -37,7 +39,7 @@
         throws CreateException, DuplicateKeyException, EJBException,
                RemoteException
      {
  -      System.out.println("entry ejbCreate");
  +      log.debug("entry ejbCreate");
   
         return new AccountPK(pk.getKey());
      }
  @@ -59,7 +61,7 @@
      public AccountPK ejbFindByPrimaryKey (AccountPK pk)
         throws FinderException, EJBException, RemoteException
      {
  -      System.out.println("entry ejbFindByPrimaryKey");
  +      log.debug("entry ejbFindByPrimaryKey");
   
         return new AccountPK(pk.getKey());
      }
  @@ -82,7 +84,7 @@
         throws CreateException, DuplicateKeyException, EJBException,
                RemoteException
      {
  -      System.out.println("ejbPostCreate (AccountPK, String) called");
  +      log.debug("ejbPostCreate (AccountPK, String) called");
      }
   
      /**
  @@ -97,7 +99,7 @@
      public void ejbLoad ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbLoad () called");
  +      log.debug("ejbLoad () called");
      }
   
      /**
  @@ -112,7 +114,7 @@
      public void ejbStore ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbStore () called");
  +      log.debug("ejbStore () called");
   
      }
   
  @@ -128,7 +130,7 @@
      public void ejbRemove ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbRemove () called");
  +      log.debug("ejbRemove () called");
      }
   
      /**
  @@ -143,7 +145,7 @@
      public void ejbActivate ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbActivate () called");
  +      log.debug("ejbActivate () called");
      }
   
      /**
  @@ -158,7 +160,7 @@
      public void ejbPassivate ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbPassivate () called");
  +      log.debug("ejbPassivate () called");
      }
   
      /**
  @@ -175,7 +177,7 @@
      public void setEntityContext (EntityContext ctx)
         throws EJBException, RemoteException
      {
  -      System.out.println("setEntityContext (\"" + ctx.getPrimaryKey()
  +      log.debug("setEntityContext (\"" + ctx.getPrimaryKey()
                            + "\") called");
   
         this.ctx = ctx;
  @@ -194,7 +196,7 @@
      public void unsetEntityContext ()
         throws EJBException, RemoteException
      {
  -      System.out.println("unsetEntityContext () called");
  +      log.debug("unsetEntityContext () called");
   
         ctx = null;
      }
  
  
  
  1.6       +23 -21    jbosstest/src/main/org/jboss/test/cts/ejb/CtsBmpBean.java
  
  Index: CtsBmpBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cts/ejb/CtsBmpBean.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CtsBmpBean.java   6 Mar 2001 20:41:05 -0000       1.5
  +++ CtsBmpBean.java   15 Feb 2002 06:15:51 -0000      1.6
  @@ -32,13 +32,15 @@
    *  If the table used for persistence here does not exist, ejbFindAll()
    *  will create it.
    *
  - *  @author $Author: osh $
  - *  @version $Revision: 1.5 $
  + *  @author $Author: user57 $
  + *  @version $Revision: 1.6 $
    */
   
   public class CtsBmpBean
      implements EntityBean
   {
  +   org.apache.log4j.Category log = 
org.apache.log4j.Category.getInstance(getClass());
  +   
      private static final String TABLE_NAME = "BMP_BEAN_TBL";
      EntityContext               ctx        = null;
      DataSource                  ds         = null;
  @@ -63,7 +65,7 @@
      public AccountPK ejbCreate(AccountPK pk, String personsName)
         throws CreateException, DuplicateKeyException
      {
  -      System.out.println("entry ejbCreate(\"" + pk.getKey() + "\", " +
  +      log.debug("entry ejbCreate(\"" + pk.getKey() + "\", " +
                                            "\"" + personsName + "\")");
   
         sendMsg(ContainerMBox.EJB_CREATE_MSG);
  @@ -114,7 +116,7 @@
         this.accountNumber = pk.getKey();
         this.personsName   = personsName;
   
  -      System.out.println("Created \"" + accountNumber + "\".");
  +      log.debug("Created \"" + accountNumber + "\".");
   
         return pk;
      }
  @@ -124,7 +126,7 @@
       */
      public void ejbPostCreate(AccountPK pk, String personsName)
      {
  -      System.out.println("ejbPostCreate(AccountPK, String) called");
  +      log.debug("ejbPostCreate(AccountPK, String) called");
   
         sendMsg(ContainerMBox.EJB_POST_CREATE_MSG);
      }
  @@ -142,7 +144,7 @@
      public AccountPK ejbFindByPrimaryKey(AccountPK pk)
         throws FinderException
      {
  -      System.out.println("entry ejbFindByPrimaryKey");
  +      log.debug("entry ejbFindByPrimaryKey");
   
         try {
           Connection con = ds.getConnection();
  @@ -185,7 +187,7 @@
      public Collection ejbFindAll()
         throws FinderException
      {
  -      System.out.println("entry ejbFindAll");
  +      log.debug("entry ejbFindAll");
   
         ensureTableExists();
   
  @@ -227,7 +229,7 @@
      public Collection ejbFindByPersonsName(String guysName)
         throws FinderException
      {
  -      System.out.println("entry ejbFindByPersonsName(\"" + guysName + "\").");
  +      log.debug("entry ejbFindByPersonsName(\"" + guysName + "\").");
   
         Collection result = new java.util.LinkedList();
         try {
  @@ -265,7 +267,7 @@
       */
      public void ejbLoad()
      {
  -      System.out.println("ejbLoad(\"" +
  +      log.debug("ejbLoad(\"" +
                            ((AccountPK)ctx.getPrimaryKey()).getKey() +
                            "\") called");
   
  @@ -303,7 +305,7 @@
            throw new EJBException(e);
         }
   
  -      System.out.println("ejbLoad(\"" +
  +      log.debug("ejbLoad(\"" +
                            ((AccountPK)ctx.getPrimaryKey()).getKey() +
                            "\") returning");
   
  @@ -314,7 +316,7 @@
       */
      public void ejbStore()
      {
  -      System.out.println("ejbStore(\"" + accountNumber + "\") called");
  +      log.debug("ejbStore(\"" + accountNumber + "\") called");
   //Thread.currentThread().dumpStack();
   
         sendMsg(ContainerMBox.EJB_STORE_MSG);
  @@ -344,7 +346,7 @@
            throw new EJBException(e);
         }
   
  -      System.out.println("ejbStore(\"" + accountNumber + "\") returning");
  +      log.debug("ejbStore(\"" + accountNumber + "\") returning");
      }
   
      /**
  @@ -352,7 +354,7 @@
       */
      public void ejbRemove()
      {
  -      System.out.println("ejbRemove(\"" + accountNumber + "\") called");
  +      log.debug("ejbRemove(\"" + accountNumber + "\") called");
   
         sendMsg(ContainerMBox.EJB_REMOVE_MSG);
   
  @@ -379,7 +381,7 @@
            throw new EJBException(e);
         }
   
  -      System.out.println("Removed \"" + accountNumber + "\".");
  +      log.debug("Removed \"" + accountNumber + "\".");
      }
   
      /**
  @@ -387,7 +389,7 @@
       */
      public void ejbActivate()
      {
  -      System.out.println("ejbActivate() called");
  +      log.debug("ejbActivate() called");
   
         sendMsg(ContainerMBox.EJB_ACTIVATE_MSG);
      }
  @@ -397,7 +399,7 @@
       */
      public void ejbPassivate()
      {
  -      System.out.println("ejbPassivate() called");
  +      log.debug("ejbPassivate() called");
   
         sendMsg(ContainerMBox.EJB_PASSIVATE_MSG);
   
  @@ -418,7 +420,7 @@
       */
      public void setEntityContext(EntityContext ctx)
      {
  -      System.out.println("setEntityContext(\"" + ctx.getPrimaryKey()
  +      log.debug("setEntityContext(\"" + ctx.getPrimaryKey()
                            + "\") called");
   
         sendMsg(ContainerMBox.SET_ENTITY_CONTEXT_MSG);
  @@ -442,7 +444,7 @@
       */
      public void unsetEntityContext()
      {
  -      System.out.println("unsetEntityContext() called");
  +      log.debug("unsetEntityContext() called");
   
         sendMsg(ContainerMBox.UNSET_ENTITY_CONTEXT_MSG);
   
  @@ -501,7 +503,7 @@
       */
      private void initializeDatabaseTable()
      {
  -      System.out.println("Initializing DATABASE tables for BMP test...");
  +      log.debug("Initializing DATABASE tables for BMP test...");
    
         try {
            Connection con = ds.getConnection();
  @@ -511,7 +513,7 @@
               s = con.createStatement();
               try {
                  s.executeUpdate("DROP TABLE " + TABLE_NAME);
  -               System.out.println("Dropped old table.");
  +               log.debug("Dropped old table.");
               } catch (SQLException e) {
                  // Ignore: Presume the table didn't exist.
               } finally {
  @@ -523,7 +525,7 @@
                  s.executeUpdate("CREATE TABLE " + TABLE_NAME + " " +
                                  "(accountNumber VARCHAR(25)," +
                                  " name VARCHAR(200))");
  -               System.out.println("Created new table.");
  +               log.debug("Created new table.");
               } finally {
                  s.close();
               }
  @@ -536,7 +538,7 @@
            throw new EJBException(e);
         }
    
  -      System.out.println("Initialized DATABASE tables for BMP test.");
  +      log.debug("Initialized DATABASE tables for BMP test.");
      }
   
      /**
  
  
  
  1.2       +12 -10    jbosstest/src/main/org/jboss/test/cts/ejb/CtsCmpBean.java
  
  Index: CtsCmpBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cts/ejb/CtsCmpBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CtsCmpBean.java   18 Feb 2001 16:04:44 -0000      1.1
  +++ CtsCmpBean.java   15 Feb 2002 06:15:51 -0000      1.2
  @@ -13,6 +13,8 @@
   public class CtsCmpBean
      implements EntityBean
   {
  +   org.apache.log4j.Category log = 
org.apache.log4j.Category.getInstance(getClass());
  +   
      EntityContext               ctx        = null;
      DataSource                  ds         = null;
   
  @@ -41,7 +43,7 @@
         throws CreateException, DuplicateKeyException, EJBException,
                RemoteException
      {
  -      System.out.println("entry ejbCreate");
  +      log.debug("entry ejbCreate");
   
         return new AccountPK(accountNumber);
      }
  @@ -63,7 +65,7 @@
      public AccountPK ejbFindByPrimaryKey (AccountPK pk)
         throws FinderException, EJBException, RemoteException
      {
  -      System.out.println("entry ejbFindByPrimaryKey");
  +      log.debug("entry ejbFindByPrimaryKey");
   
         return pk;
      }
  @@ -87,7 +89,7 @@
         throws CreateException, DuplicateKeyException, EJBException,
                RemoteException
      {
  -      System.out.println("ejbPostCreate (AccountPK, String) called");
  +      log.debug("ejbPostCreate (AccountPK, String) called");
      }
   
      /**
  @@ -102,7 +104,7 @@
      public void ejbLoad ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbLoad () called");
  +      log.debug("ejbLoad () called");
   
      }
   
  @@ -118,7 +120,7 @@
      public void ejbStore ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbStore () called");
  +      log.debug("ejbStore () called");
   
      }
   
  @@ -134,7 +136,7 @@
      public void ejbRemove ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbRemove () called");
  +      log.debug("ejbRemove () called");
   
      }
   
  @@ -150,7 +152,7 @@
      public void ejbActivate ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbActivate () called");
  +      log.debug("ejbActivate () called");
      }
   
      /**
  @@ -165,7 +167,7 @@
      public void ejbPassivate ()
         throws EJBException, RemoteException
      {
  -      System.out.println("ejbPassivate () called");
  +      log.debug("ejbPassivate () called");
      }
   
      /**
  @@ -182,7 +184,7 @@
      public void setEntityContext (EntityContext ctx)
         throws EJBException, RemoteException
      {
  -      System.out.println("setEntityContext (\"" + ctx.getPrimaryKey()
  +      log.debug("setEntityContext (\"" + ctx.getPrimaryKey()
                            + "\") called");
   
         this.ctx = ctx;
  @@ -211,7 +213,7 @@
      public void unsetEntityContext ()
         throws EJBException, RemoteException
      {
  -      System.out.println("unsetEntityContext () called");
  +      log.debug("unsetEntityContext () called");
   
         ctx = null;
      }
  
  
  
  1.13      +13 -11    
jbosstest/src/main/org/jboss/test/cts/ejb/StatefulSessionBean.java
  
  Index: StatefulSessionBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/cts/ejb/StatefulSessionBean.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StatefulSessionBean.java  17 Jun 2001 16:47:51 -0000      1.12
  +++ StatefulSessionBean.java  15 Feb 2002 06:15:51 -0000      1.13
  @@ -15,14 +15,16 @@
   /**
    *
    *   @see <related>
  - *   @author $Author: sparre $
  - *   @version $Revision: 1.12 $
  + *   @author $Author: user57 $
  + *   @version $Revision: 1.13 $
    */
   
   public class StatefulSessionBean
      extends SessionSupport
      implements SessionSynchronization
   {
  +   org.apache.log4j.Category log = 
org.apache.log4j.Category.getInstance(getClass());
  +   
      private int counter;
   
      /**
  @@ -46,7 +48,7 @@
   
      public void afterBegin ()
      {
  -      System.out.println("Calling afterBegin( )...");
  +      log.debug("Calling afterBegin( )...");
      }
   
      /**
  @@ -59,8 +61,8 @@
   
      public void afterCompletion (boolean isCommited)
      {
  -      System.out.println("Calling afterCompletion( )");
  -      System.out.println("isCommited = " + isCommited);
  +      log.debug("Calling afterCompletion( )");
  +      log.debug("isCommited = " + isCommited);
      }
   
      /**
  @@ -71,7 +73,7 @@
   
      public void beforeCompletion ()
      {
  -      System.out.println("Calling beforeCompletion( )...");
  +      log.debug("Calling beforeCompletion( )...");
      }
   
      /**
  @@ -150,15 +152,15 @@
      {
         BeanContextInfo ctx = new BeanContextInfo();
   
  -      System.out.println("Getting EJBObject..");
  +      log.debug("Getting EJBObject..");
         Class remoteInterface = sessionCtx.getEJBObject().getClass();
         ctx.remoteInterface = remoteInterface.getName();
   
  -      System.out.println("Getting EJBHome...");
  +      log.debug("Getting EJBHome...");
         Class homeInterface = sessionCtx.getEJBHome().getClass();
         ctx.homeInterface = homeInterface.getName();
   
  -      System.out.println("calling setRollbackOnly( ) on context");
  +      log.debug("calling setRollbackOnly( ) on context");
         sessionCtx.setRollbackOnly();
         ctx.isRollbackOnly = new Boolean(sessionCtx.getRollbackOnly());
   
  @@ -186,7 +188,7 @@
           } 
           catch (CreateException crex) 
           {
  -           System.out.println("Loopback CreateException: " + crex);
  +           log.debug("Loopback CreateException: " + crex);
              throw new EJBException(crex);
           }
           sessionBean.loopbackTest(sessionCtx.getEJBObject());
  @@ -194,7 +196,7 @@
         }
         catch (javax.naming.NamingException nex)
         {
  -         System.out.println("Could not locate bean instance");
  +         log.debug("Could not locate bean instance");
            throw new EJBException(nex);
         }
      }
  
  
  
  1.8       +4 -3      
jbosstest/src/main/org/jboss/test/cts/ejb/StatelessSessionBean.java
  
  Index: StatelessSessionBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/cts/ejb/StatelessSessionBean.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StatelessSessionBean.java 15 Feb 2001 02:29:48 -0000      1.7
  +++ StatelessSessionBean.java 15 Feb 2002 06:15:51 -0000      1.8
  @@ -21,7 +21,8 @@
   public class StatelessSessionBean
      extends SessionSupport
   {
  -
  +   org.apache.log4j.Category log = 
org.apache.log4j.Category.getInstance(getClass());
  +   
      /**
       * Method ejbCreate
       *
  @@ -80,14 +81,14 @@
           } 
           catch (CreateException ex) 
           {
  -           System.out.println("Loopback CreateException: " + ex);
  +           log.debug("Loopback CreateException: " + ex);
              throw new EJBException(ex);
           } 
           sessionBean.loopbackTest(sessionCtx.getEJBObject());
         }
         catch (javax.naming.NamingException nex)
         {
  -         System.out.println("Could not locate bean instance");
  +         log.debug("Could not locate bean instance");
         }
      }
   
  
  
  

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

Reply via email to