db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: jakarta-ojb/src/ejb/org/apache/ojb/ejb AllTests.java ArticleManagerODMGBean.java ArticleManagerPBBean.java BeanConstants.java ODMGBaseBeanImpl.java ODMGClient.java ODMGSessionBean.java PBBaseBeanImpl.java PBClient.java PBSessionBean.java PersonArticleClient.java PersonArticleClientODMG.java PersonArticleManagerODMGBean.java PersonArticleManagerPBBean.java PersonManagerODMGBean.java PersonManagerPBBean.java SessionBeanImpl.java StressTestClient.java VOHelper.java
Date Fri, 10 Jan 2003 11:33:11 GMT
arminw      2003/01/10 03:33:11

  Modified:    src/ejb/org/apache/ojb/ejb AllTests.java
                        ArticleManagerODMGBean.java
                        ArticleManagerPBBean.java BeanConstants.java
                        ODMGBaseBeanImpl.java ODMGClient.java
                        ODMGSessionBean.java PBBaseBeanImpl.java
                        PBClient.java PBSessionBean.java
                        PersonArticleClient.java
                        PersonArticleClientODMG.java
                        PersonArticleManagerODMGBean.java
                        PersonArticleManagerPBBean.java
                        PersonManagerODMGBean.java PersonManagerPBBean.java
                        SessionBeanImpl.java StressTestClient.java
                        VOHelper.java
  Log:
  update and simplify ejb examples
  
  Revision  Changes    Path
  1.3       +4 -4      jakarta-ojb/src/ejb/org/apache/ojb/ejb/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/AllTests.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AllTests.java	9 Oct 2002 11:44:27 -0000	1.2
  +++ AllTests.java	10 Jan 2003 11:33:09 -0000	1.3
  @@ -54,8 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import junit.framework.TestSuite;
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
   /**
    * The facade to all TestCases in this package.
  @@ -68,9 +68,9 @@
       /**
        * runs the suite in a junit.textui.TestRunner.
        */
  -     public static void main(String[] args)
  +    public static void main(String[] args)
       {
  -        String[] arr = { AllTests.class.getName()};
  +        String[] arr = {AllTests.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  
  
  
  1.4       +23 -29    jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerODMGBean.java
  
  Index: ArticleManagerODMGBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerODMGBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArticleManagerODMGBean.java	26 Dec 2002 19:36:06 -0000	1.3
  +++ ArticleManagerODMGBean.java	10 Jan 2003 11:33:10 -0000	1.4
  @@ -54,14 +54,14 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.OJBRuntimeException;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.odmg.OQLQuery;
   
  -import javax.ejb.SessionBean;
   import javax.ejb.EJBException;
  +import javax.ejb.SessionBean;
   import java.util.Collection;
   
   /**
  @@ -89,12 +89,6 @@
    * @ejb:transaction
    * 		type="Required"
    *
  - * @ejb:env-entry
  - * 		name="ojb.jcdAlias"
  - * 		type="java.lang.String"
  - * 		value="default"
  - *
  - *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
  @@ -107,26 +101,26 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Article storeArticle(Article article)
       {
           return (Article) this.storeObject(article);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection storeArticles(Collection articles)
       {
           return this.storeObjects(articles);
       }
   
       /**
  -	 * Simulate a failure store.
  +     * Simulate a failure store.
        *
        * @ejb:interface-method
  -	 */
  +     */
       public Article failureStore(Article article)
       {
           storeArticle(article);
  @@ -135,54 +129,54 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deleteArticle(Article article)
       {
           this.deleteObject(article);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deleteArticles(Collection articles)
       {
           this.deleteObjects(articles);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public int countArticles()
       {
           return this.getCount(Article.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getAllArticles()
       {
           return this.getAllObjects(Article.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getArticles(String articleName)
       {
           OQLQuery query = getImplementation().newOQLQuery();
           try
           {
  -            StringBuffer buf = new StringBuffer("select allObjects from "+Article.class.getName());
  +            StringBuffer buf = new StringBuffer("select allObjects from " + Article.class.getName());
               buf.append(" where articleId not null");
  -            if(articleName != null) buf.append(" and articleName = " + articleName);
  +            if (articleName != null) buf.append(" and articleName = " + articleName);
               query.create(buf.toString());
               return (Collection) query.execute();
           }
           catch (Exception e)
           {
  -            log.error("OQLQuery failed",e);
  +            log.error("OQLQuery failed", e);
               throw new OJBRuntimeException("OQLQuery failed", e);
           }
       }
  
  
  
  1.4       +19 -24    jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerPBBean.java
  
  Index: ArticleManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerPBBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArticleManagerPBBean.java	26 Dec 2002 19:36:06 -0000	1.3
  +++ ArticleManagerPBBean.java	10 Jan 2003 11:33:10 -0000	1.4
  @@ -60,8 +60,8 @@
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
   
  -import javax.ejb.SessionBean;
   import javax.ejb.EJBException;
  +import javax.ejb.SessionBean;
   import java.util.Collection;
   
   /**
  @@ -89,11 +89,6 @@
    * @ejb:transaction
    * 		type="Required"
    *
  - * @ejb:env-entry
  - * 		name="ojb.jcdAlias"
  - * 		type="java.lang.String"
  - * 		value="default"
  - *
    *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
  @@ -105,58 +100,58 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Article storeArticle(Article article)
       {
           return (Article) this.storeObject(article);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection storeArticles(Collection articles)
       {
           return this.storeObjects(articles);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deleteArticle(Article article)
       {
           this.deleteObject(article);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deleteArticles(Collection articles)
       {
           this.deleteObjects(articles);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public int countArticles()
       {
           return this.getCount(Article.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getAllArticles()
       {
           return this.getAllObjects(Article.class);
       }
   
       /**
  -	 * Simulate a failure store.
  +     * Simulate a failure store.
        *
        * @ejb:interface-method
  -	 */
  +     */
       public Article failureStore(Article article)
       {
           storeArticle(article);
  @@ -165,13 +160,13 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getArticles(String articleName)
       {
           PersistenceBroker broker = getBroker();
           Criteria criteria = new Criteria();
  -        if(articleName != null) criteria.addEqualTo("articleName", articleName);
  +        if (articleName != null) criteria.addEqualTo("articleName", articleName);
           Query q = new QueryByCriteria(Article.class, null);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
  
  
  
  1.2       +17 -3     jakarta-ojb/src/ejb/org/apache/ojb/ejb/BeanConstants.java
  
  Index: BeanConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/BeanConstants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanConstants.java	26 Dec 2002 19:36:06 -0000	1.1
  +++ BeanConstants.java	10 Jan 2003 11:33:10 -0000	1.2
  @@ -1,5 +1,6 @@
   package org.apache.ojb.ejb;
   
  +import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.ta.PBFactoryIF;
   
   /**
  @@ -10,8 +11,21 @@
    */
   public class BeanConstants
   {
  -    public static final String JCD_ALIAS = "default";
  -    public static final String ENV_ENTRY_JCD_ALIAS_LOOKUP = "java:comp/env/ojb.jcdAlias";
       public static final String ODMG_FACTORY_LOOKUP = "java:/ojb/defaultODMG";
       public static final String PB_FACTORY_LOOKUP = PBFactoryIF.PBFACTORY_JNDI_NAME;
  +
  +    public static final String DEF_JCD_ALIAS = "default";
  +    public static final String DEF_DATABASE_NAME = "default#sa";
  +
  +    public static final String DEF_REPOSITORY = "repository.xml";
  +    public static final String DEF_USER = "sa";
  +    public static final String DEF_PASSWORD = null;
  +    public static final PBKey DEF_KEY = new PBKey(DEF_JCD_ALIAS, DEF_USER, DEF_PASSWORD);
  +
  +
  +    public static final String FAR_AWAY_JCD_ALIAS = "farAway";
  +    public static final String FAR_AWAY_DATABASE_NAME = "farAway#sa#";
  +    public static final PBKey FAR_AWAY_KEY = new PBKey(FAR_AWAY_JCD_ALIAS, "sa", "");
  +
  +    public static final String DATABASE_REPOSITORY = "repository_database.xml";
   }
  
  
  
  1.4       +23 -50    jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGBaseBeanImpl.java
  
  Index: ODMGBaseBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGBaseBeanImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ODMGBaseBeanImpl.java	26 Dec 2002 19:36:06 -0000	1.3
  +++ ODMGBaseBeanImpl.java	10 Jan 2003 11:33:10 -0000	1.4
  @@ -54,28 +54,25 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.odmg.HasBroker;
  -import org.odmg.Implementation;
  +import org.jboss.ojb.odmg.ODMGFactory;
   import org.odmg.Database;
  -import org.odmg.ODMGException;
  -import org.odmg.Transaction;
  +import org.odmg.Implementation;
   import org.odmg.LockNotGrantedException;
  +import org.odmg.ODMGException;
   import org.odmg.OQLQuery;
  -import org.jboss.ojb.odmg.ODMGFactory;
  +import org.odmg.Transaction;
   
  -import javax.ejb.SessionContext;
  -import javax.ejb.SessionBean;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -import java.util.List;
  -import java.util.Iterator;
   import java.util.Collection;
  +import java.util.Iterator;
   
   /**
    * Base class for using OJB-ODMG api within SessionBeans,
  @@ -100,8 +97,6 @@
   public abstract class ODMGBaseBeanImpl extends SessionBeanImpl
   {
       private Logger log = LoggerFactory.getLogger(ODMGBaseBeanImpl.class);
  -
  -    private String jcdAlias;
       private Implementation odmg;
   
       /**
  @@ -136,7 +131,7 @@
           }
           catch (LockNotGrantedException e)
           {
  -            log.error("Failure while storing object "+object, e);
  +            log.error("Failure while storing object " + object, e);
               throw new OJBRuntimeException("Failure while storing object", e);
           }
           return object;
  @@ -151,8 +146,8 @@
       }
   
       /**
  -	 * Store a collection of objects.
  -	 */
  +     * Store a collection of objects.
  +     */
       public Collection storeObjects(Collection objects)
       {
           try
  @@ -167,15 +162,15 @@
           }
           catch (LockNotGrantedException e)
           {
  -            log.error("Failure while storing objects "+objects, e);
  +            log.error("Failure while storing objects " + objects, e);
               throw new OJBRuntimeException("Failure while storing objects", e);
           }
           return objects;
       }
   
       /**
  -	 * Delete a Collection of objects.
  -	 */
  +     * Delete a Collection of objects.
  +     */
       public void deleteObjects(Collection objects)
       {
           for (Iterator iterator = objects.iterator(); iterator.hasNext();)
  @@ -201,12 +196,12 @@
           OQLQuery query = odmg.newOQLQuery();
           try
           {
  -            query.create("select allObjects from "+target.getName());
  +            query.create("select allObjects from " + target.getName());
               return (Collection) query.execute();
           }
           catch (Exception e)
           {
  -            log.error("OQLQuery failed",e);
  +            log.error("OQLQuery failed", e);
               throw new OJBRuntimeException("OQLQuery failed", e);
           }
       }
  @@ -223,15 +218,6 @@
        */
       private void ojbPrepare()
       {
  -
  -        /*Lookup if a environment entry in Deployment Descriptor exists
  -        e.g.
  -        <env-entry>
  -            <env-entry-name>ojb.jdbcAlias</env-entry-name>
  -            <env-entry-type>java.lang.String</env-entry-type>
  -            <env-entry-value>default</env-entry-value>
  -        </env-entry>
  -        */
           Context context = null;
   
           try
  @@ -243,20 +229,6 @@
               log.error("Could not instantiate InitialContext", e);
               throw new OJBRuntimeException("Could not instantiate InitialContext", e);
           }
  -        try
  -        {
  -            jcdAlias = (String) context.lookup(BeanConstants.ENV_ENTRY_JCD_ALIAS_LOOKUP);
  -            if(log.isDebugEnabled()) log.debug("Found enviroment entry: "+jcdAlias);
  -        }
  -        catch (NamingException e)
  -        {
  -            log.error("ctx.lookup("+BeanConstants.ENV_ENTRY_JCD_ALIAS_LOOKUP+") failed", e);
  -        }
  -        if (jcdAlias == null || jcdAlias.equals(""))
  -        {
  -            jcdAlias = BeanConstants.JCD_ALIAS;
  -        }
  -        log.info("Use OJB jcdAlias name: " + jcdAlias);
   
           ODMGFactory factory = null;
           try
  @@ -265,24 +237,25 @@
           }
           catch (NamingException e)
           {
  -            log.error("ctx.lookup("+BeanConstants.ODMG_FACTORY_LOOKUP+") failed", e);
  +            log.error("ctx.lookup(" + BeanConstants.ODMG_FACTORY_LOOKUP + ") failed", e);
               throw new OJBRuntimeException("Could not lookup ODMG factory instance", e);
           }
           odmg = factory.getInstance();
  -        if(log.isDebugEnabled())
  +        if (log.isDebugEnabled())
               log.debug("Found odmg factory: " + factory + " and get Implementation instance: " + odmg);
   
           Database db = odmg.newDatabase();
           try
           {
  -            if(log.isDebugEnabled()) log.debug("open new database " +
  -                    db + " using jcdAlias name " + jcdAlias);
  -            db.open(jcdAlias, Database.OPEN_READ_WRITE);
  +            if (log.isDebugEnabled())
  +                log.debug("open new database " +
  +                        db + " using databaseName name " + BeanConstants.DEF_DATABASE_NAME);
  +            db.open(BeanConstants.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE);
           }
           catch (ODMGException e)
           {
               log.error("Database open failed", e);
  -            throw new OJBRuntimeException("Unable to open database using ODMG api",e);
  +            throw new OJBRuntimeException("Unable to open database using ODMG api", e);
           }
       }
   
  
  
  
  1.7       +28 -24    jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGClient.java
  
  Index: ODMGClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGClient.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ODMGClient.java	9 Oct 2002 00:13:58 -0000	1.6
  +++ ODMGClient.java	10 Jan 2003 11:33:10 -0000	1.7
  @@ -55,7 +55,7 @@
    */
   
   import junit.framework.TestCase;
  -import org.apache.ojb.broker.Person;
  +import org.apache.ojb.odmg.Article;
   
   import javax.ejb.EJBHome;
   import javax.naming.Context;
  @@ -63,7 +63,11 @@
   import javax.naming.NamingException;
   import javax.rmi.PortableRemoteObject;
   import java.rmi.RemoteException;
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Properties;
   
   /**
    * Test client using the {@link org.apache.ojb.ejb.ODMGSessionBean}.
  @@ -105,23 +109,23 @@
           super.tearDown();
       }
   
  -    // only used when running outside junit
  -    public void start()
  -    {
  -        init();
  -        try
  -        {
  -            testInsertDelete();
  -            testRollback_2();
  -            testRollback_1();
  -            testServerSideMethods();
  -            testStress();
  -        }
  -        catch (Exception e)
  -        {
  -            e.printStackTrace();
  -        }
  -    }
  +//    // only used when running outside junit
  +//    public void start()
  +//    {
  +//        init();
  +//        try
  +//        {
  +//            testInsertDelete();
  +//            testRollback_2();
  +//            testRollback_1();
  +//            testServerSideMethods();
  +//            //testStress();
  +//        }
  +//        catch (Exception e)
  +//        {
  +//            e.printStackTrace();
  +//        }
  +//    }
   
   
       protected void init()
  @@ -261,14 +265,14 @@
           System.out.println("## testStress");
           for (int i = 0; i < 500; i++)
           {
  -            sampleBean.storeObjects(VOHelper.createNewPersonList(1));
  +            sampleBean.storeObjects(VOHelper.createNewArticleList(1));
           }
  -        Collection col = sampleBean.getAllObjects(Person.class);
  +        Collection col = sampleBean.getAllObjects(Article.class);
           for (Iterator iterator = col.iterator(); iterator.hasNext();)
           {
  -            Person person = (Person) iterator.next();
  +            Article article = (Article) iterator.next();
               List del = new ArrayList();
  -            del.add(person);
  +            del.add(article);
               sampleBean.deleteObjects(del);
           }
           System.out.println("");
  
  
  
  1.8       +14 -45    jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGSessionBean.java
  
  Index: ODMGSessionBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGSessionBean.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ODMGSessionBean.java	26 Dec 2002 19:36:06 -0000	1.7
  +++ ODMGSessionBean.java	10 Jan 2003 11:33:10 -0000	1.8
  @@ -55,8 +55,8 @@
    */
   
   import org.apache.ojb.broker.Article;
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.OJBRuntimeException;
  +import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.jboss.ojb.odmg.ODMGFactory;
  @@ -67,7 +67,6 @@
   import org.odmg.OQLQuery;
   import org.odmg.QueryException;
   import org.odmg.Transaction;
  -import org.odmg.QueryInvalidException;
   
   import javax.ejb.EJBException;
   import javax.ejb.SessionBean;
  @@ -78,7 +77,6 @@
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
  -import java.rmi.RemoteException;
   
   /**
    * This is an session bean implementation using odmg implementation.
  @@ -137,10 +135,6 @@
    * @ejb:transaction
    * 		type="Required"
    *
  - * @ejb:env-entry
  - * 		name="ojb.jcdAlias"
  - * 		type="java.lang.String"
  - * 		value="default"
    *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
  @@ -149,7 +143,6 @@
   {
       private Logger log = LoggerFactory.getLogger(ODMGSessionBean.class);
       private SessionContext ctx;
  -    private String jcdAlias;
       private Implementation odmg;
       private Database db;
   
  @@ -160,54 +153,30 @@
       public void ejbCreate()
       {
           log.info("ejbCreate was called");
  -        ojbPrepare();
  -        log.info("obtain new database");
  -        db = odmg.newDatabase();
  -        try
  -        {
  -            log.info("open new database " + db + " using jcdAlias name " + jcdAlias);
  -            db.open(jcdAlias, Database.OPEN_READ_WRITE);
  -        }
  -        catch (ODMGException e)
  -        {
  -            log.error("Database open failed", e);
  -        }
  -        log.info("ejbCreate end");
  -    }
  -
  -    private void ojbPrepare()
  -    {
  -        log.info("ojbPrepare was called");
  -        /*Lookup if a environment entry in Deployment Descriptor exists
  -		e.g.
  -		<env-entry>
  -      		<env-entry-name>ojb.jcdAlias</env-entry-name>
  -      		<env-entry-type>java.lang.String</env-entry-type>
  -      		<env-entry-value>default</env-entry-value>
  -    	</env-entry>
  -		*/
           try
           {
               Context context = new InitialContext();
  -            jcdAlias = (String) context.lookup(BeanConstants.ENV_ENTRY_JCD_ALIAS_LOOKUP);
  -
               ODMGFactory factory = (ODMGFactory) context.lookup(BeanConstants.ODMG_FACTORY_LOOKUP);
               odmg = factory.getInstance();
               log.info("Found odmg factory: " + factory + " and get Implementation instance: " + odmg);
           }
           catch (NamingException e)
           {
  -            log.error("Lookup for ojb jcdAlias name or ODMGFactory failed", e);
  +            log.error("Lookup for ODMGFactory failed", e);
  +        }
  +        db = odmg.newDatabase();
  +        try
  +        {
  +            log.info("open new database " + db + " using databaseName name " + BeanConstants.DEF_DATABASE_NAME);
  +            db.open(BeanConstants.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE);
           }
  -        if (jcdAlias == null || jcdAlias.equals(""))
  +        catch (ODMGException e)
           {
  -            log.info("No enviroment entry for jcdAlias name was found, use default");
  -            jcdAlias = BeanConstants.JCD_ALIAS;
  +            log.error("Database open failed", e);
           }
  -        log.info("Use jcdAlias name: " + jcdAlias);
  +        log.info("ejbCreate end");
       }
   
  -
       /**
        * @ejb:interface-method
        */
  @@ -353,12 +322,12 @@
           OQLQuery query = odmg.newOQLQuery();
           try
           {
  -            query.create("select allObjects from "+target.getName());
  +            query.create("select allObjects from " + target.getName());
               return (Collection) query.execute();
           }
           catch (Exception e)
           {
  -            log.error("OQLQuery failed",e);
  +            log.error("OQLQuery failed", e);
               throw new OJBRuntimeException("OQLQuery failed", e);
           }
       }
  
  
  
  1.3       +27 -49    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBBaseBeanImpl.java
  
  Index: PBBaseBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBBaseBeanImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PBBaseBeanImpl.java	26 Dec 2002 19:36:06 -0000	1.2
  +++ PBBaseBeanImpl.java	10 Jan 2003 11:33:10 -0000	1.3
  @@ -54,24 +54,21 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.broker.PBKey;
  -import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
  +import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.ta.PBFactoryIF;
  +import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  -import javax.ejb.SessionContext;
  -import javax.ejb.SessionBean;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -import java.util.List;
  -import java.util.Iterator;
   import java.util.Collection;
  +import java.util.Iterator;
   
   /**
    * Base class for using OJB-PB api within SessionBeans,
  @@ -112,48 +109,18 @@
       public void ejbCreate()
       {
           if (log.isDebugEnabled()) log.info("ejbCreate was called");
  -        ojbPrepare();
  -    }
  -
  -    /**
  -     * Here we do the initial work for using OJB-PB api
  -     * within a session bean
  -     */
  -    private void ojbPrepare()
  -    {
           Context context = null;
  -        // Lookup if a environment entry for repository exists
  -        String ojbRepository = null;
           try
           {
  -            /*Lookup if a environment entry in Deployment Descriptor exists
  -            e.g.
  -            <env-entry>
  -                <env-entry-name>ojb.jcdAlias</env-entry-name>
  -                <env-entry-type>java.lang.String</env-entry-type>
  -                <env-entry-value>default</env-entry-value>
  -            </env-entry>
  -            */
               context = new InitialContext();
  -            ojbRepository = (String) context.lookup(BeanConstants.ENV_ENTRY_JCD_ALIAS_LOOKUP);
           }
           catch (NamingException e)
           {
  -            log.error("Lookup for ojb jcdAlias name failed", e);
  +            log.error("Create of initial context failed", e);
           }
  -        // no jcdAlias name found in environment, use default one
  -        if (ojbRepository == null || ojbRepository.equals(""))
  -        {
  -            log.info("No enviroment entry for jcdAlias was found, use default");
  -            ojbRepository = BeanConstants.JCD_ALIAS;
  -        }
  -        if(log.isDebugEnabled()) log.debug("Use OJB jcdAlias: "+ojbRepository);
  -        pbKey = new PBKey(ojbRepository);
  -
           // Lookup the PBF implementation
           try
           {
  -            context = new InitialContext();
               pbf = ((PBFactoryIF) context.lookup(BeanConstants.PB_FACTORY_LOOKUP)).getInstance();
           }
           catch (NamingException e)
  @@ -161,6 +128,17 @@
               log.error("Lookup for PersistenceBrokerFactory failed", e);
               throw new PersistenceBrokerException(e);
           }
  +
  +        pbKey = BeanConstants.DEF_KEY;
  +    }
  +
  +    /**
  +     * Here we do the initial work for using OJB-PB api
  +     * within a session bean
  +     */
  +    private void ojbPrepare()
  +    {
  +
       }
   
       /**
  @@ -219,7 +197,7 @@
           }
           finally
           {
  -            if(broker != null) broker.close();
  +            if (broker != null) broker.close();
           }
           return object;
       }
  @@ -237,13 +215,13 @@
           }
           finally
           {
  -            if(broker != null) broker.close();
  +            if (broker != null) broker.close();
           }
       }
   
       /**
  -	 * Store a collection of objects.
  -	 */
  +     * Store a collection of objects.
  +     */
       public Collection storeObjects(Collection objects)
       {
           PersistenceBroker broker = null;
  @@ -255,14 +233,14 @@
           }
           finally
           {
  -            if(broker != null) broker.close();
  +            if (broker != null) broker.close();
           }
           return stored;
       }
   
       /**
  -	 * Delete a Collection of objects.
  -	 */
  +     * Delete a Collection of objects.
  +     */
       public void deleteObjects(Collection objects)
       {
           PersistenceBroker broker = null;
  @@ -273,7 +251,7 @@
           }
           finally
           {
  -            if(broker != null) broker.close();
  +            if (broker != null) broker.close();
           }
       }
   
  
  
  
  1.6       +11 -14    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBClient.java
  
  Index: PBClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBClient.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PBClient.java	9 Oct 2002 00:13:58 -0000	1.5
  +++ PBClient.java	10 Jan 2003 11:33:10 -0000	1.6
  @@ -54,19 +54,16 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
  -import org.apache.ojb.broker.Person;
  +import junit.framework.TestCase;
   
  +import javax.ejb.EJBHome;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -import javax.ejb.EJBHome;
   import javax.rmi.PortableRemoteObject;
  -import java.util.Properties;
  -import java.util.List;
   import java.rmi.RemoteException;
  -
  -import junit.framework.TestCase;
  +import java.util.List;
  +import java.util.Properties;
   
   /**
    * Test client using the {@link org.apache.ojb.ejb.PBSessionBean}.
  @@ -124,7 +121,7 @@
           prop = System.getProperties();
           // id jndi-properties not set as system properties, take jboss jndi
           // properties as default
  -        if(prop.getProperty("java.naming.factory.initial") == null)
  +        if (prop.getProperty("java.naming.factory.initial") == null)
           {
               prop = new Properties();
               prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  @@ -144,7 +141,7 @@
           {
   //            System.err.println("## "+ctx.getEnvironment());
               Object object = PortableRemoteObject.narrow(ctx.lookup(PBSessionHome.JNDI_NAME), EJBHome.class);
  -            bean = (PBSessionRemote)((PBSessionHome)object).create();
  +            bean = (PBSessionRemote) ((PBSessionHome) object).create();
           }
           catch (Exception e)
           {
  @@ -164,8 +161,8 @@
   
           int articlesAfterStore = bean.getArticleCount();
           int personsAfterStore = bean.getPersonCount();
  -        assertEquals("Storing of articles failed", articlesBefore+10, articlesAfterStore);
  -        assertEquals("Storing of persons faile", personsBefore+5, personsAfterStore);
  +        assertEquals("Storing of articles failed", articlesBefore + 10, articlesAfterStore);
  +        assertEquals("Storing of persons faile", personsBefore + 5, personsAfterStore);
   
   
           bean.deleteObjects(articles);
  @@ -173,8 +170,8 @@
   
           int articlesAfterDelete = bean.getArticleCount();
           int personsAfterDelete = bean.getPersonCount();
  -        assertEquals("Deleting of articles failed", articlesAfterStore-10, articlesAfterDelete);
  -        assertEquals("Deleting of persons failed", personsAfterStore-5, personsAfterDelete);
  +        assertEquals("Deleting of articles failed", articlesAfterStore - 10, articlesAfterDelete);
  +        assertEquals("Deleting of persons failed", personsAfterStore - 5, personsAfterDelete);
       }
   
       public void testRollback() throws RemoteException
  
  
  
  1.6       +67 -73    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBSessionBean.java
  
  Index: PBSessionBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBSessionBean.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PBSessionBean.java	26 Dec 2002 19:36:06 -0000	1.5
  +++ PBSessionBean.java	10 Jan 2003 11:33:10 -0000	1.6
  @@ -55,28 +55,27 @@
    */
   
   
  +import org.apache.ojb.broker.Article;
  +import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.Person;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.ta.PBFactoryIF;
  +import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.*;
  -import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
  -import org.apache.ojb.broker.ta.PBFactoryIF;
  -import org.apache.ojb.broker.query.QueryByCriteria;
  -import org.apache.ojb.broker.query.Criteria;
  -import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.odmg.OJB;
  -import org.odmg.Implementation;
  -import org.odmg.Database;
  -import org.odmg.ODMGException;
   
  +import javax.ejb.EJBException;
   import javax.ejb.SessionBean;
   import javax.ejb.SessionContext;
  -import javax.ejb.EJBException;
  -import javax.naming.InitialContext;
   import javax.naming.Context;
  +import javax.naming.InitialContext;
   import javax.naming.NamingException;
   import java.util.Collection;
  -import java.util.List;
   import java.util.Iterator;
  +import java.util.List;
   
   /**
    * This is an session bean implementation using PB-api.
  @@ -107,62 +106,56 @@
    * @ejb:transaction
    * 		type="Required"
    *
  - * @ejb:env-entry
  - * 		name="ojb.jcdAlias"
  - * 		type="java.lang.String"
  - * 		value="default"
  - *
    *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
   public class PBSessionBean implements SessionBean
   {
  -	private Logger log = LoggerFactory.getLogger(PBSessionBean.class);
  -	private SessionContext ctx;
  +    private Logger log = LoggerFactory.getLogger(PBSessionBean.class);
  +    private SessionContext ctx;
       private PBKey pbKey;
       private PersistenceBrokerFactoryIF pbf;
   
  -	public PBSessionBean()
  -	{
  -	}
  +    public PBSessionBean()
  +    {
  +    }
  +
  +    public void ejbActivate()
  +    {/* unused */
  +    }
   
  -	public void ejbActivate(){/* unused */}
  -	public void ejbPassivate(){/* unused */}
  -	public void setSessionContext(SessionContext ctx){this.ctx = ctx;}
  -	public SessionContext getSessionContext(){return ctx;}
  -    public void ejbRemove(){ctx = null;}
  +    public void ejbPassivate()
  +    {/* unused */
  +    }
   
  -	public void ejbCreate()
  -	{
  -		ojbPrepare();
  +    public void setSessionContext(SessionContext ctx)
  +    {
  +        this.ctx = ctx;
       }
   
  -    private void ojbPrepare()
  +    public SessionContext getSessionContext()
       {
  -        log.info("ojbPrepare was called");
  +        return ctx;
  +    }
  +
  +    public void ejbRemove()
  +    {
  +        ctx = null;
  +    }
  +
  +    public void ejbCreate()
  +    {
  +        log.info("ejbCreate was called");
           Context context = null;
  -		// Lookup if a environment entry for jcdAlias name exists
  -        String jcdAlias = null;
           try
           {
               context = new InitialContext();
  -            jcdAlias = (String) context.lookup("java:comp/env/ojb.jcdAlias");
           }
           catch (NamingException e)
           {
  -            log.error("Lookup for ojb repository failed", e);
  +            log.error("Create of InitialContext failed", e);
           }
  -        // no jcdAlias found in environment, use default one
  -        if (jcdAlias == null || jcdAlias.equals(""))
  -		{
  -			log.info("No enviroment entry was found, use 'default' as jcdAlias name");
  -            jcdAlias = BeanConstants.JCD_ALIAS;
  -		}
  -        log.info("Use OJB jcdAlias name: "+jcdAlias);
  -        pbKey = new PBKey(jcdAlias);
  -
  -
           // Lookup the PBF implementation
           try
           {
  @@ -174,6 +167,7 @@
               log.error("Lookup for PersistenceBrokerFactory failed", e);
               throw new PersistenceBrokerException(e);
           }
  +        pbKey = BeanConstants.DEF_KEY;
       }
   
       protected PersistenceBroker getBroker()
  @@ -207,9 +201,9 @@
           return result;
       }
   
  -     /**
  -	 * @ejb:interface-method
  -	 */
  +    /**
  +     * @ejb:interface-method
  +     */
       public Collection getAllObjects(Class target)
       {
           log.info("getAllObjects was called");
  @@ -221,8 +215,8 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public int getArticleCount()
       {
           log.info("getArticleCount was called");
  @@ -230,8 +224,8 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public int getPersonCount()
       {
           log.info("getPersonCount was called");
  @@ -239,8 +233,8 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public List storeObjects(List objects)
       {
           log.info("storeObjects was called");
  @@ -251,8 +245,8 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deleteObjects(List objects)
       {
           log.info("deleteObjects was called");
  @@ -262,8 +256,8 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public boolean allInOne(List articles, List persons)
       {
           log.info("allInOne was called");
  @@ -273,31 +267,31 @@
   
           int personsBefore = getPersonCount();
           int articlesBefore = getArticleCount();
  -        buf.append(sep+"# Start with "+personsBefore+ " persons");
  -        buf.append(sep+"# Start with "+articlesBefore+ " articles");
  +        buf.append(sep + "# Start with " + personsBefore + " persons");
  +        buf.append(sep + "# Start with " + articlesBefore + " articles");
           storeObjects(articles);
           storeObjects(persons);
           int personsAfterStore = getPersonCount();
           int articlesAfterStore = getArticleCount();
  -        buf.append(sep+"# After store: "+personsAfterStore+ " persons");
  -        buf.append(sep+"# After store: "+articlesAfterStore+ " articles");
  +        buf.append(sep + "# After store: " + personsAfterStore + " persons");
  +        buf.append(sep + "# After store: " + articlesAfterStore + " articles");
           deleteObjects(articles);
           deleteObjects(persons);
           int personsAfterDelete = getPersonCount();
           int articlesAfterDelete = getArticleCount();
  -        buf.append(sep+"# After delete: "+personsAfterDelete+ " persons");
  -        buf.append(sep+"# After delete: "+articlesAfterDelete+ " articles");
  -        log.info("## allInOne-Method call: "+buf.toString());
  +        buf.append(sep + "# After delete: " + personsAfterDelete + " persons");
  +        buf.append(sep + "# After delete: " + articlesAfterDelete + " articles");
  +        log.info("## allInOne-Method call: " + buf.toString());
           passedWell = (personsBefore + persons.size()) == personsAfterStore &&
  -                     (articlesBefore + articles.size()) == articlesAfterStore &&
  -                     (personsBefore) == personsAfterDelete &&
  -                     (personsBefore) == personsAfterDelete;
  +                (articlesBefore + articles.size()) == articlesAfterStore &&
  +                (personsBefore) == personsAfterDelete &&
  +                (personsBefore) == personsAfterDelete;
           return passedWell;
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void rollbackTest(List objects)
       {
           log.info("rollbackTest was called");
  
  
  
  1.3       +10 -9     jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleClient.java
  
  Index: PersonArticleClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleClient.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersonArticleClient.java	10 Oct 2002 08:56:30 -0000	1.2
  +++ PersonArticleClient.java	10 Jan 2003 11:33:10 -0000	1.3
  @@ -56,14 +56,14 @@
   
   import junit.framework.TestCase;
   
  +import javax.ejb.EJBHome;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
   import javax.rmi.PortableRemoteObject;
  -import javax.ejb.EJBHome;
   import java.rmi.RemoteException;
  -import java.util.Properties;
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * Test client class using {@link org.apache.ojb.ejb.PersonArticleManagerBean}
  @@ -139,6 +139,7 @@
           assertEquals(articlesBefore, articlesAfter);
           assertEquals(personsBefore, personsAfter);
       }
  +
       public void testNestedStoreDelete() throws Exception
       {
           int personsBefore = bean.personCount();
  @@ -152,8 +153,8 @@
   
           int personsAfterStore = bean.personCount();
           int articlesAfterStore = bean.articleCount();
  -        assertEquals("wrong number of articles after store",articlesBefore+6, articlesAfterStore);
  -        assertEquals("wrong number of persons after store",personsBefore+4, personsAfterStore);
  +        assertEquals("wrong number of articles after store", articlesBefore + 6, articlesAfterStore);
  +        assertEquals("wrong number of persons after store", personsBefore + 4, personsAfterStore);
   
           //delete objects
           bean.deleteArticles(articleList);
  @@ -162,7 +163,7 @@
           int personsAfterDelete = bean.personCount();
           int articlesAfterDelete = bean.articleCount();
           assertEquals("wrong number of articles after delete", articlesBefore, articlesAfterDelete);
  -        assertEquals("wrong number of persons after delete",personsBefore, personsAfterDelete);
  +        assertEquals("wrong number of persons after delete", personsBefore, personsAfterDelete);
   
       }
   
  @@ -192,7 +193,7 @@
           prop = System.getProperties();
           // id jndi-properties not set as system properties, take jboss jndi
           // properties as default
  -        if(prop.getProperty("java.naming.factory.initial") == null)
  +        if (prop.getProperty("java.naming.factory.initial") == null)
           {
               prop = new Properties();
               prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  @@ -212,8 +213,8 @@
           {
               Object object = PortableRemoteObject.narrow(
                       ctx.lookup(PersonArticleManagerPBHome.JNDI_NAME), EJBHome.class);
  -            bean = (PersonArticleManagerPBRemote)((PersonArticleManagerPBHome)object).create();
  -            System.out.println("Bean found: "+bean);
  +            bean = (PersonArticleManagerPBRemote) ((PersonArticleManagerPBHome) object).create();
  +            System.out.println("Bean found: " + bean);
           }
           catch (Exception e)
           {
  
  
  
  1.3       +9 -9      jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleClientODMG.java
  
  Index: PersonArticleClientODMG.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleClientODMG.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersonArticleClientODMG.java	10 Oct 2002 08:56:30 -0000	1.2
  +++ PersonArticleClientODMG.java	10 Jan 2003 11:33:10 -0000	1.3
  @@ -56,14 +56,14 @@
   
   import junit.framework.TestCase;
   
  +import javax.ejb.EJBHome;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
   import javax.rmi.PortableRemoteObject;
  -import javax.ejb.EJBHome;
   import java.rmi.RemoteException;
  -import java.util.Properties;
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * Test client class using {@link org.apache.ojb.ejb.PersonArticleManagerBean}
  @@ -153,8 +153,8 @@
   
           int personsAfterStore = bean.personCount();
           int articlesAfterStore = bean.articleCount();
  -        assertEquals("wrong number of articles after store",articlesBefore+6, articlesAfterStore);
  -        assertEquals("wrong number of persons after store",personsBefore+4, personsAfterStore);
  +        assertEquals("wrong number of articles after store", articlesBefore + 6, articlesAfterStore);
  +        assertEquals("wrong number of persons after store", personsBefore + 4, personsAfterStore);
   
           //delete objects
           bean.deleteArticles(articleList);
  @@ -163,7 +163,7 @@
           int personsAfterDelete = bean.personCount();
           int articlesAfterDelete = bean.articleCount();
           assertEquals("wrong number of articles after delete", articlesBefore, articlesAfterDelete);
  -        assertEquals("wrong number of persons after delete",personsBefore, personsAfterDelete);
  +        assertEquals("wrong number of persons after delete", personsBefore, personsAfterDelete);
   
       }
   
  @@ -193,7 +193,7 @@
           prop = System.getProperties();
           // id jndi-properties not set as system properties, take jboss jndi
           // properties as default
  -        if(prop.getProperty("java.naming.factory.initial") == null)
  +        if (prop.getProperty("java.naming.factory.initial") == null)
           {
               prop = new Properties();
               prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  @@ -213,8 +213,8 @@
           {
               Object object = PortableRemoteObject.narrow(
                       ctx.lookup(PersonArticleManagerODMGHome.JNDI_NAME), EJBHome.class);
  -            bean = (PersonArticleManagerODMGRemote)((PersonArticleManagerODMGHome)object).create();
  -            System.out.println("Bean found: "+bean);
  +            bean = (PersonArticleManagerODMGRemote) ((PersonArticleManagerODMGHome) object).create();
  +            System.out.println("Bean found: " + bean);
           }
           catch (Exception e)
           {
  
  
  
  1.4       +21 -21    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerODMGBean.java
  
  Index: PersonArticleManagerODMGBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerODMGBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersonArticleManagerODMGBean.java	26 Dec 2002 19:36:06 -0000	1.3
  +++ PersonArticleManagerODMGBean.java	10 Jan 2003 11:33:10 -0000	1.4
  @@ -54,18 +54,18 @@
    * <http://www.apache.org/>.
    */
   
  +import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.Article;
   
  -import javax.ejb.SessionBean;
  -import javax.ejb.EJBException;
   import javax.ejb.CreateException;
  +import javax.ejb.EJBException;
  +import javax.ejb.SessionBean;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -import java.util.List;
   import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * Simple example bean do nested bean calls,
  @@ -110,8 +110,8 @@
    */
   public class PersonArticleManagerODMGBean extends SessionBeanImpl implements SessionBean
   {
  -    private static final String PERSON_MANAGER_EJB_REF_NAME="java:comp/env/ejb/ojb/odmg/PersonManager";
  -    private static final String ARTICLE_MANAGER_EJB_REF_NAME="java:comp/env/ejb/ojb/odmg/ArticleManager";
  +    private static final String PERSON_MANAGER_EJB_REF_NAME = "java:comp/env/ejb/ojb/odmg/PersonManager";
  +    private static final String ARTICLE_MANAGER_EJB_REF_NAME = "java:comp/env/ejb/ojb/odmg/ArticleManager";
   
       private Logger log = LoggerFactory.getLogger(PersonArticleManagerODMGBean.class);
   
  @@ -129,12 +129,12 @@
   
   
       /**
  -	 * First stores all articles, persons form
  +     * First stores all articles, persons form
        * the lists using ArticleManager and PersonManager
        * beans after doing that, a Exception will be thrown.
        *
        * @ejb:interface-method
  -	 */
  +     */
       public void nestedRollback(List articles, List persons)
       {
           //store all objects
  @@ -148,12 +148,12 @@
       }
   
       /**
  -	 * First store a list of persons then we
  +     * First store a list of persons then we
        * store the article using a failure store
        * method in ArticleManager.
        *
        * @ejb:interface-method
  -	 */
  +     */
       public void nestedRollback2(Article article, List persons)
       {
           ArticleManagerODMGLocal am = getArticleManager();
  @@ -164,7 +164,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public List storeArticles(List articles)
       {
           return new ArrayList(getArticleManager().storeArticles(articles));
  @@ -172,7 +172,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public void deleteArticles(List articles)
       {
           getArticleManager().deleteArticles(articles);
  @@ -180,7 +180,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public List storePersons(List persons)
       {
           return new ArrayList(getPersonManager().storePersons(persons));
  @@ -188,7 +188,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public void deletePersons(List persons)
       {
           getPersonManager().deletePersons(persons);
  @@ -196,7 +196,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public int articleCount()
       {
           return getArticleManager().countArticles();
  @@ -204,7 +204,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public int personCount()
       {
           return getPersonManager().countPersons();
  @@ -219,12 +219,12 @@
               {
                   context = new InitialContext();
                   am = ((ArticleManagerODMGLocalHome) context.lookup(ARTICLE_MANAGER_EJB_REF_NAME)).create();
  -                log.info("** Found bean: "+am);
  +                log.info("** Found bean: " + am);
                   return am;
               }
               catch (NamingException e)
               {
  -                log.error("Lookup using ejb-ref "+ARTICLE_MANAGER_EJB_REF_NAME+" failed", e);
  +                log.error("Lookup using ejb-ref " + ARTICLE_MANAGER_EJB_REF_NAME + " failed", e);
                   throw new EJBException(e);
               }
               catch (CreateException e)
  @@ -245,12 +245,12 @@
               {
                   context = new InitialContext();
                   pm = ((PersonManagerODMGLocalHome) context.lookup(PERSON_MANAGER_EJB_REF_NAME)).create();
  -                log.info("** Found bean: "+pm);
  +                log.info("** Found bean: " + pm);
                   return pm;
               }
               catch (NamingException e)
               {
  -                log.error("Lookup using ejb-ref "+PERSON_MANAGER_EJB_REF_NAME+" failed", e);
  +                log.error("Lookup using ejb-ref " + PERSON_MANAGER_EJB_REF_NAME + " failed", e);
                   throw new EJBException(e);
               }
               catch (CreateException e)
  
  
  
  1.4       +20 -20    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerPBBean.java
  
  Index: PersonArticleManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerPBBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersonArticleManagerPBBean.java	26 Dec 2002 19:36:06 -0000	1.3
  +++ PersonArticleManagerPBBean.java	10 Jan 2003 11:33:10 -0000	1.4
  @@ -54,18 +54,18 @@
    * <http://www.apache.org/>.
    */
   
  +import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.Article;
   
  -import javax.ejb.EJBException;
   import javax.ejb.CreateException;
  +import javax.ejb.EJBException;
   import javax.ejb.SessionBean;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -import java.util.List;
   import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * Simple example bean for nested bean calls,
  @@ -110,8 +110,8 @@
    */
   public class PersonArticleManagerPBBean extends SessionBeanImpl implements SessionBean
   {
  -    private static final String PERSON_MANAGER_EJB_REF_NAME="java:comp/env/ejb/ojb/broker/PersonManager";
  -    private static final String ARTICLE_MANAGER_EJB_REF_NAME="java:comp/env/ejb/ojb/broker/ArticleManager";
  +    private static final String PERSON_MANAGER_EJB_REF_NAME = "java:comp/env/ejb/ojb/broker/PersonManager";
  +    private static final String ARTICLE_MANAGER_EJB_REF_NAME = "java:comp/env/ejb/ojb/broker/ArticleManager";
   
       private Logger log = LoggerFactory.getLogger(PersonArticleManagerPBBean.class);
       private ArticleManagerPBLocal am;
  @@ -128,12 +128,12 @@
   
   
       /**
  -	 * First stores all articles, persons form
  +     * First stores all articles, persons form
        * the lists using ArticleManager and PersonManager
        * beans after doing that, a Exception will be thrown.
        *
        * @ejb:interface-method
  -	 */
  +     */
       public void nestedRollback(List articles, List persons)
       {
           //store all objects
  @@ -147,12 +147,12 @@
       }
   
       /**
  -	 * First store a list of persons then we
  +     * First store a list of persons then we
        * store the article using a failure store
        * method in ArticleManager.
        *
        * @ejb:interface-method
  -	 */
  +     */
       public void nestedRollback2(Article article, List persons)
       {
           ArticleManagerPBLocal am = getArticleManager();
  @@ -163,7 +163,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public List storeArticles(List articles)
       {
           return new ArrayList(getArticleManager().storeArticles(articles));
  @@ -171,7 +171,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public void deleteArticles(List articles)
       {
           getArticleManager().deleteArticles(articles);
  @@ -179,7 +179,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public List storePersons(List persons)
       {
           return new ArrayList(getPersonManager().storePersons(persons));
  @@ -187,7 +187,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public void deletePersons(List persons)
       {
           getPersonManager().deletePersons(persons);
  @@ -195,7 +195,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public int articleCount()
       {
           return getArticleManager().countArticles();
  @@ -203,7 +203,7 @@
   
       /**
        * @ejb:interface-method
  -	 */
  +     */
       public int personCount()
       {
           return getPersonManager().countPersons();
  @@ -218,12 +218,12 @@
               {
                   context = new InitialContext();
                   am = ((ArticleManagerPBLocalHome) context.lookup(ARTICLE_MANAGER_EJB_REF_NAME)).create();
  -                log.info("** Found bean: "+am);
  +                log.info("** Found bean: " + am);
                   return am;
               }
               catch (NamingException e)
               {
  -                log.error("Lookup using ejb-ref "+ARTICLE_MANAGER_EJB_REF_NAME+" failed", e);
  +                log.error("Lookup using ejb-ref " + ARTICLE_MANAGER_EJB_REF_NAME + " failed", e);
                   throw new EJBException(e);
               }
               catch (CreateException e)
  @@ -244,12 +244,12 @@
               {
                   context = new InitialContext();
                   pm = ((PersonManagerPBLocalHome) context.lookup(PERSON_MANAGER_EJB_REF_NAME)).create();
  -                log.info("** Found bean: "+pm);
  +                log.info("** Found bean: " + pm);
                   return pm;
               }
               catch (NamingException e)
               {
  -                log.error("Lookup using ejb-ref "+PERSON_MANAGER_EJB_REF_NAME+" failed", e);
  +                log.error("Lookup using ejb-ref " + PERSON_MANAGER_EJB_REF_NAME + " failed", e);
                   throw new EJBException(e);
               }
               catch (CreateException e)
  
  
  
  1.3       +20 -25    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerODMGBean.java
  
  Index: PersonManagerODMGBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerODMGBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersonManagerODMGBean.java	26 Dec 2002 19:36:06 -0000	1.2
  +++ PersonManagerODMGBean.java	10 Jan 2003 11:33:10 -0000	1.3
  @@ -54,8 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.OJBRuntimeException;
  +import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.odmg.OQLQuery;
  @@ -88,11 +88,6 @@
    * @ejb:transaction
    * 		type="Required"
    *
  - * @ejb:env-entry
  - * 		name="ojb.jcdAlias"
  - * 		type="java.lang.String"
  - * 		value="default"
  - *
    *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
  @@ -106,71 +101,71 @@
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Person storePerson(Person person)
       {
           return (Person) this.storeObject(person);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection storePersons(Collection persons)
       {
           return this.storeObjects(persons);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deletePerson(Person person)
       {
           this.deleteObject(person);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deletePersons(Collection persons)
       {
           this.deleteObjects(persons);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public int countPersons()
       {
           return this.getCount(Person.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getAllPersons()
       {
           return this.getAllObjects(Person.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getPersons(String firstname, String lastname)
       {
           OQLQuery query = getImplementation().newOQLQuery();
           try
           {
  -            StringBuffer buf = new StringBuffer("select allObjects from "+Person.class.getName());
  +            StringBuffer buf = new StringBuffer("select allObjects from " + Person.class.getName());
               buf.append(" where id not null");
  -            if(firstname != null) buf.append(" and firstname = "+firstname);
  -            if(lastname != null) buf.append(" and lastname = "+lastname);
  +            if (firstname != null) buf.append(" and firstname = " + firstname);
  +            if (lastname != null) buf.append(" and lastname = " + lastname);
               query.create(buf.toString());
               return (Collection) query.execute();
           }
           catch (Exception e)
           {
  -            log.error("OQLQuery failed",e);
  +            log.error("OQLQuery failed", e);
               throw new OJBRuntimeException("OQLQuery failed", e);
           }
       }
  
  
  
  1.3       +19 -25    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerPBBean.java
  
  Index: PersonManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerPBBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersonManagerPBBean.java	26 Dec 2002 19:36:06 -0000	1.2
  +++ PersonManagerPBBean.java	10 Jan 2003 11:33:10 -0000	1.3
  @@ -54,12 +54,11 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.Person;
  +import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
  -import org.apache.ojb.broker.query.Criteria;
  -import org.apache.ojb.broker.query.QueryFactory;
   
   import javax.ejb.SessionBean;
   import java.util.Collection;
  @@ -89,11 +88,6 @@
    * @ejb:transaction
    * 		type="Required"
    *
  - * @ejb:env-entry
  - * 		name="ojb.jcdAlias"
  - * 		type="java.lang.String"
  - * 		value="default"
  - *
    *
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
  @@ -101,62 +95,62 @@
   public class PersonManagerPBBean extends PBBaseBeanImpl implements SessionBean
   {
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Person storePerson(Person person)
       {
           return (Person) this.storeObject(person);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection storePersons(Collection persons)
       {
           return this.storeObjects(persons);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deletePerson(Person person)
       {
           this.deleteObject(person);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public void deletePersons(Collection persons)
       {
           this.deleteObjects(persons);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public int countPersons()
       {
           return this.getCount(Person.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getAllPersons()
       {
           return this.getAllObjects(Person.class);
       }
   
       /**
  -	 * @ejb:interface-method
  -	 */
  +     * @ejb:interface-method
  +     */
       public Collection getPersons(String firstname, String lastname)
       {
           PersistenceBroker broker = getBroker();
           Criteria criteria = new Criteria();
  -        if(firstname != null) criteria.addEqualTo("firstname", firstname);
  -        if(lastname != null) criteria.addEqualTo("firstname", lastname);
  +        if (firstname != null) criteria.addEqualTo("firstname", firstname);
  +        if (lastname != null) criteria.addEqualTo("firstname", lastname);
           Query q = new QueryByCriteria(Person.class, null);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
  
  
  
  1.2       +1 -3      jakarta-ojb/src/ejb/org/apache/ojb/ejb/SessionBeanImpl.java
  
  Index: SessionBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/SessionBeanImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionBeanImpl.java	9 Oct 2002 00:13:58 -0000	1.1
  +++ SessionBeanImpl.java	10 Jan 2003 11:33:10 -0000	1.2
  @@ -55,9 +55,7 @@
    */
   
   import javax.ejb.EJBException;
  -import javax.ejb.SessionBean;
   import javax.ejb.SessionContext;
  -import java.rmi.RemoteException;
   
   /**
    * Base session bean implementation class
  
  
  
  1.5       +29 -44    jakarta-ojb/src/ejb/org/apache/ojb/ejb/StressTestClient.java
  
  Index: StressTestClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/StressTestClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StressTestClient.java	9 Oct 2002 00:13:58 -0000	1.4
  +++ StressTestClient.java	10 Jan 2003 11:33:10 -0000	1.5
  @@ -54,32 +54,18 @@
    * <http://www.apache.org/>.
    */
   
  +import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.util.ObjectModificationDefaultImpl;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
  -import org.apache.ojb.broker.PerformanceArticle;
  -import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.Article;
  -import org.apache.ojb.broker.query.Criteria;
  -import org.apache.ojb.odmg.OJB;
  -import org.odmg.Implementation;
  -import org.odmg.Database;
  -import org.odmg.Transaction;
  -import org.odmg.OQLQuery;
  -import org.odmg.DList;
   
  +import javax.ejb.EJBHome;
  +import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -import javax.naming.Context;
   import javax.rmi.PortableRemoteObject;
  -import javax.ejb.EJBHome;
  -import java.util.Iterator;
  -import java.util.Properties;
   import java.util.ArrayList;
   import java.util.List;
  -import java.util.Collections;
  -import java.util.Arrays;
  +import java.util.Properties;
   
   /**
    * Stress test client using the OJB's ODMG and PB api.
  @@ -112,7 +98,6 @@
       private PBSessionRemote bean;
   
   
  -
       public StressTestClient()
       {
           this.threadCount = concurrentThreads;
  @@ -171,7 +156,7 @@
           prop = System.getProperties();
           // if jndi-properties not set as system properties, take jboss jndi
           // properties as default
  -        if(prop.getProperty("java.naming.factory.initial") == null)
  +        if (prop.getProperty("java.naming.factory.initial") == null)
           {
               prop = new Properties();
               prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  @@ -190,7 +175,7 @@
           try
           {
               Object object = PortableRemoteObject.narrow(ctx.lookup(PBSessionHome.JNDI_NAME), EJBHome.class);
  -            bean = (PBSessionRemote)((PBSessionHome)object).create();
  +            bean = (PBSessionRemote) ((PBSessionHome) object).create();
           }
           catch (Exception e)
           {
  @@ -235,15 +220,15 @@
               int objectCount = 0;
               int objectCountAfter = 0;
   
  -            if (whichTest==1 || whichTest ==3)
  +            if (whichTest == 1 || whichTest == 3)
               {
                   int activeThreadsStart = test.threadGroup.activeCount();
                   test.init();
                   objectCount = test.getArticleCount();
                   test.testMultithreaded_PB_api();
  -                while(test.threadGroup.activeCount()>activeThreadsStart)
  +                while (test.threadGroup.activeCount() > activeThreadsStart)
                   {
  -                    System.err.println("# active threads: "+ test.threadGroup.activeCount());
  +                    System.err.println("# active threads: " + test.threadGroup.activeCount());
                       try
                       {
                           Thread.sleep(1500);
  @@ -253,22 +238,22 @@
                       }
                   }
   
  -                System.err.println("Test-Info:   Objects in DB before PB test: "+ objectCount);
  +                System.err.println("Test-Info:   Objects in DB before PB test: " + objectCount);
                   objectCountAfter = test.getArticleCount();
  -                System.err.println("Test-Info:   Objects in DB after PB test: "+objectCountAfter);
  -                System.err.println("Test-Info:   Stress test was successful? - "+(objectCount==objectCountAfter)+" -");
  +                System.err.println("Test-Info:   Objects in DB after PB test: " + objectCountAfter);
  +                System.err.println("Test-Info:   Stress test was successful? - " + (objectCount == objectCountAfter) + " -");
               }
   
   
  -            if (whichTest==2 || whichTest ==3)
  +            if (whichTest == 2 || whichTest == 3)
               {
                   int activeThreadsStart = test.threadGroup.activeCount();
                   test.init();
                   objectCount = test.getArticleCount();
                   test.testMultithreaded_ODMG_api();
  -                while(test.threadGroup.activeCount()>activeThreadsStart)
  +                while (test.threadGroup.activeCount() > activeThreadsStart)
                   {
  -                    System.err.println("# active threads: "+ test.threadGroup.activeCount());
  +                    System.err.println("# active threads: " + test.threadGroup.activeCount());
                       try
                       {
                           Thread.sleep(1500);
  @@ -278,10 +263,10 @@
                       }
                   }
   
  -                System.err.println("Test-Info:   Objects in DB before ODMG test: "+ objectCount);
  +                System.err.println("Test-Info:   Objects in DB before ODMG test: " + objectCount);
                   objectCountAfter = test.getArticleCount();
  -                System.err.println("Test-Info:   Objects in DB after ODMG test: "+objectCountAfter);
  -                System.err.println("Test-Info:   Stress test was successful? - "+(objectCount==objectCountAfter)+" -");
  +                System.err.println("Test-Info:   Objects in DB after ODMG test: " + objectCountAfter);
  +                System.err.println("Test-Info:   Stress test was successful? - " + (objectCount == objectCountAfter) + " -");
               }
           }
           catch (Exception e)
  @@ -295,7 +280,7 @@
       {
           String sep = System.getProperty("line.separator");
           times[0] = System.currentTimeMillis();
  -        log.info(sep+sep+"++ Start thread generation for PB api test ++");
  +        log.info(sep + sep + "++ Start thread generation for PB api test ++");
           log.info("Begin with stress test, " + concurrentThreads +
                   " concurrent threads, handle " + iterationsPerThread + " articles form each thread");
           for (int i = 0; i < concurrentThreads; i++)
  @@ -312,7 +297,7 @@
           }
           times[0] = (long) (System.currentTimeMillis() - times[0]);
           log.info(buildTestSummary("PB API"));
  -        log.info("++ End of stress test PB api ++"+sep+sep);
  +        log.info("++ End of stress test PB api ++" + sep + sep);
       }
   
       public void testMultithreaded_ODMG_api()
  @@ -336,7 +321,7 @@
           }
           times[0] = (long) (System.currentTimeMillis() - times[0]);
           log.info(buildTestSummary("ODMG"));
  -        log.info("++ End of stress test ODMG api ++"+sep);
  +        log.info("++ End of stress test ODMG api ++" + sep);
       }
   
       private String buildTestSummary(String key)
  @@ -348,7 +333,7 @@
           buf.append(sep);
           buf.append("TEST SUMMARY - " + key);
           buf.append(sep);
  -        buf.append(concurrentThreads+" concurrent threads, handle " + iterationsPerThread + " articles per thread");
  +        buf.append(concurrentThreads + " concurrent threads, handle " + iterationsPerThread + " articles per thread");
           buf.append(sep);
           buf.append("Test period: " + (double) (((double) times[0]) / 1000) + " [sec]");
           buf.append(sep);
  @@ -388,7 +373,7 @@
               prop = System.getProperties();
               // id jndi-properties not set as system properties, take jboss jndi
               // properties as default
  -            if(prop.getProperty("java.naming.factory.initial") == null)
  +            if (prop.getProperty("java.naming.factory.initial") == null)
               {
                   prop = new Properties();
                   prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  @@ -406,7 +391,7 @@
               try
               {
                   Object object = PortableRemoteObject.narrow(ctx.lookup(ODMGSessionHome.JNDI_NAME), EJBHome.class);
  -                bean = (ODMGSessionRemote)((ODMGSessionHome)object).create();
  +                bean = (ODMGSessionRemote) ((ODMGSessionHome) object).create();
               }
               catch (Exception e)
               {
  @@ -441,8 +426,8 @@
           private Article createArticle(int id)
           {
               Article a = new Article();
  -            if(clientKeyGeneration) a.setArticleId(getId());
  -            if(clientKeyGeneration) a.setArticleName("New Article " + id);
  +            if (clientKeyGeneration) a.setArticleId(getId());
  +            if (clientKeyGeneration) a.setArticleName("New Article " + id);
               a.setMinimumStock(100);
               a.setOrderedUnits(17);
               a.setPrice(0.45);
  @@ -511,7 +496,7 @@
               prop = System.getProperties();
               // id jndi-properties not set as system properties, take jboss jndi
               // properties as default
  -            if(prop.getProperty("java.naming.factory.initial") == null)
  +            if (prop.getProperty("java.naming.factory.initial") == null)
               {
                   prop = new Properties();
                   prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  @@ -530,7 +515,7 @@
               try
               {
                   Object object = PortableRemoteObject.narrow(ctx.lookup(PBSessionHome.JNDI_NAME), EJBHome.class);
  -                bean = (PBSessionRemote)((PBSessionHome)object).create();
  +                bean = (PBSessionRemote) ((PBSessionHome) object).create();
               }
               catch (Exception e)
               {
  @@ -565,7 +550,7 @@
           private Article createArticle(int id)
           {
               Article a = new Article();
  -            if(clientKeyGeneration) a.setArticleId(getId());
  +            if (clientKeyGeneration) a.setArticleId(getId());
               a.setArticleName("New Performance Article " + id);
               a.setMinimumStock(100);
               a.setOrderedUnits(17);
  
  
  
  1.4       +8 -8      jakarta-ojb/src/ejb/org/apache/ojb/ejb/VOHelper.java
  
  Index: VOHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/VOHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VOHelper.java	9 Jan 2003 18:38:33 -0000	1.3
  +++ VOHelper.java	10 Jan 2003 11:33:10 -0000	1.4
  @@ -57,8 +57,8 @@
   import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.Person;
   
  -import java.util.List;
   import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * Simple helper class.
  @@ -70,7 +70,7 @@
       public static List createNewArticleList(int number)
       {
           ArrayList list = new ArrayList();
  -        for (int i=0; i<number; i++)
  +        for (int i = 0; i < number; i++)
           {
               list.add(createNewArticle(i));
           }
  @@ -80,7 +80,7 @@
       public static List createNewPersonList(int number)
       {
           ArrayList list = new ArrayList();
  -        for (int i=0; i<number; i++)
  +        for (int i = 0; i < number; i++)
           {
               list.add(createNewPerson(i));
           }
  @@ -91,21 +91,21 @@
       {
           Article a = new Article();
           a.setArticleName("New Performance Article " + counter);
  -        a.setMinimumStock(10*counter);
  +        a.setMinimumStock(10 * counter);
           a.setOrderedUnits(17);
  -        a.setPrice(0.45*counter);
  +        a.setPrice(0.45 * counter);
           a.setProductGroupId(1);
           a.setStock(234);
           a.setSupplierId(4);
  -        a.setUnit("bottle "+counter);
  +        a.setUnit("bottle " + counter);
           return a;
       }
   
       public static Person createNewPerson(int counter)
       {
           Person p = new Person();
  -        p.setFirstname("firstname "+counter);
  -        p.setLastname("lastname "+counter);
  +        p.setFirstname("firstname " + counter);
  +        p.setLastname("lastname " + counter);
           return p;
       }
   }
  
  
  

Mime
View raw message