db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb OJB-logging.properties
Date Wed, 08 Jun 2005 23:33:33 GMT
arminw      2005/06/08 16:33:33

  Modified:    src/ejb/org/apache/ojb/ejb/odmg ODMGBaseBeanImpl.java
                        ODMGSessionBean.java RollbackBean.java
                        StressTestClient.java
               src/ejb/org/apache/ojb/ejb/pb ArticleManagerPBBean.java
                        PBBaseBeanImpl.java PBSessionBean.java
                        PersonArticleManagerPBBean.java
                        PersonManagerPBBean.java RollbackBean.java
               src/ejb/org/apache/ojb/ejb AllODMGTests.java AllPBTests.java
                        SessionBeanImpl.java
               src/java/org/apache/ojb/jdo
                        PersistenceManagerFactoryImpl.java
               src/samples/org/apache/ojb/tutorial2 Application.java
                        UCDeleteProduct.java UCEditProduct.java
                        UCEnterNewProduct.java UCListAllProducts.java
               src/samples/org/apache/ojb/tutorials ODMGExample.java
               src/test/org/apache/ojb OJB-logging.properties
  Log:
  merge with OJB_1_0_RELEASE branch
  
  Revision  Changes    Path
  1.8       +4 -3      db-ojb/src/ejb/org/apache/ojb/ejb/odmg/ODMGBaseBeanImpl.java
  
  Index: ODMGBaseBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/odmg/ODMGBaseBeanImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ODMGBaseBeanImpl.java	13 Jan 2005 20:05:36 -0000	1.7
  +++ ODMGBaseBeanImpl.java	8 Jun 2005 23:33:33 -0000	1.8
  @@ -20,7 +20,8 @@
   import java.util.Iterator;
   
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.query.Criteria;
  +import org.apache.ojb.broker.query.QueryFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.SessionBeanImpl;
  @@ -170,7 +171,7 @@
       public int getCount(Class target)
       {
           PersistenceBroker broker = ((HasBroker) odmg.currentTransaction()).getBroker();
  -        int result = broker.getCount(new QueryByCriteria(target));
  +        int result = broker.getCount(QueryFactory.newQuery(target, (Criteria) null));
           return result;
       }
   
  
  
  
  1.7       +3 -4      db-ojb/src/ejb/org/apache/ojb/ejb/odmg/ODMGSessionBean.java
  
  Index: ODMGSessionBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/odmg/ODMGSessionBean.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ODMGSessionBean.java	13 Sep 2004 10:54:28 -0000	1.6
  +++ ODMGSessionBean.java	8 Jun 2005 23:33:33 -0000	1.7
  @@ -28,7 +28,6 @@
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.ArticleVO;
   import org.apache.ojb.ejb.PersonVO;
  -import org.odmg.DList;
   import org.odmg.Database;
   import org.odmg.Implementation;
   import org.odmg.OQLQuery;
  @@ -160,12 +159,12 @@
       protected int getObjectCount(Implementation ojb, Class target)
       {
           if(log.isDebugEnabled()) log.debug("getObjectCount was called");
  -        DList list;
  +        List list;
           try
           {
               OQLQuery query = ojb.newOQLQuery();
               query.create("select allObjects from " + target.getName());
  -            list = (DList) query.execute();
  +            list = (List) query.execute();
               return list.size();
           }
           catch (QueryException e)
  
  
  
  1.4       +6 -7      db-ojb/src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java
  
  Index: RollbackBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RollbackBean.java	13 Jan 2005 20:05:36 -0000	1.3
  +++ RollbackBean.java	8 Jun 2005 23:33:33 -0000	1.4
  @@ -16,9 +16,9 @@
    */
   
   
  +import javax.ejb.CreateException;
   import javax.ejb.EJBException;
   import javax.ejb.SessionBean;
  -import javax.ejb.CreateException;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  @@ -31,13 +31,12 @@
   import org.apache.ojb.broker.PersistenceBroker;
   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.QueryFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.ArticleVO;
   import org.apache.ojb.ejb.PersonVO;
   import org.apache.ojb.odmg.TransactionExt;
  -import org.odmg.DList;
   import org.odmg.OQLQuery;
   import org.odmg.QueryException;
   
  @@ -270,7 +269,7 @@
           tx.flush();
           Class searchClass = objectsToStore.get(0).getClass();
           PersistenceBroker broker = tx.getBroker();
  -        Query q = new QueryByCriteria(searchClass);
  +        Query q = QueryFactory.newQuery(searchClass, (Criteria) null);
           // we get the iterator and step into the first found object
           Iterator it = broker.getIteratorByQuery(q);
           it.next();
  @@ -306,12 +305,12 @@
       protected int getObjectCount(Class target)
       {
           log.info("getObjectCount was called");
  -        DList list;
  +        List list;
           try
           {
               OQLQuery query = getImplementation().newOQLQuery();
               query.create("select allObjects from " + target.getName());
  -            list = (DList) query.execute();
  +            list = (List) query.execute();
               return list.size();
           }
           catch(QueryException e)
  
  
  
  1.5       +2 -2      db-ojb/src/ejb/org/apache/ojb/ejb/odmg/StressTestClient.java
  
  Index: StressTestClient.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/odmg/StressTestClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StressTestClient.java	5 Apr 2004 00:17:08 -0000	1.4
  +++ StressTestClient.java	8 Jun 2005 23:33:33 -0000	1.5
  @@ -15,8 +15,8 @@
    * limitations under the License.
    */
   
  -import org.apache.commons.lang.SystemUtils;
   import junit.framework.TestCase;
  +import org.apache.commons.lang.SystemUtils;
   
   /**
    *
  
  
  
  1.5       +4 -4      db-ojb/src/ejb/org/apache/ojb/ejb/pb/ArticleManagerPBBean.java
  
  Index: ArticleManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/pb/ArticleManagerPBBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArticleManagerPBBean.java	5 Apr 2004 00:17:08 -0000	1.4
  +++ ArticleManagerPBBean.java	8 Jun 2005 23:33:33 -0000	1.5
  @@ -22,7 +22,7 @@
   import org.apache.ojb.broker.PersistenceBroker;
   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.QueryFactory;
   import org.apache.ojb.ejb.ArticleVO;
   import org.apache.ojb.ejb.CategoryVO;
   
  @@ -132,7 +132,7 @@
           {
               Criteria criteria = new Criteria();
               if (articleName != null) criteria.addEqualTo("name", articleName);
  -            Query q = new QueryByCriteria(ArticleVO.class, criteria);
  +            Query q = QueryFactory.newQuery(ArticleVO.class, criteria);
               result = broker.getCollectionByQuery(q);
           }
           finally
  @@ -169,7 +169,7 @@
           {
               Criteria criteria = new Criteria();
               if (categoryName != null) criteria.addEqualTo("categoryName", categoryName);
  -            Query q = new QueryByCriteria(CategoryVO.class, criteria);
  +            Query q = QueryFactory.newQuery(CategoryVO.class, criteria);
               result = broker.getCollectionByQuery(q);
           }
           finally
  
  
  
  1.7       +5 -4      db-ojb/src/ejb/org/apache/ojb/ejb/pb/PBBaseBeanImpl.java
  
  Index: PBBaseBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/pb/PBBaseBeanImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PBBaseBeanImpl.java	13 Jan 2005 20:05:36 -0000	1.6
  +++ PBBaseBeanImpl.java	8 Jun 2005 23:33:33 -0000	1.7
  @@ -21,8 +21,9 @@
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  +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.QueryFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.SessionBeanImpl;
  @@ -89,7 +90,7 @@
           int result;
           try
           {
  -            result = broker.getCount(new QueryByCriteria(target));
  +            result = broker.getCount(QueryFactory.newQuery(target, (Criteria) null));
           }
           finally
           {
  @@ -107,7 +108,7 @@
           Collection result;
           try
           {
  -            Query q = new QueryByCriteria(target);
  +            Query q = QueryFactory.newQuery(target, (Criteria) null);
               result = broker.getCollectionByQuery(q);
           }
           finally
  
  
  
  1.9       +6 -6      db-ojb/src/ejb/org/apache/ojb/ejb/pb/PBSessionBean.java
  
  Index: PBSessionBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/pb/PBSessionBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PBSessionBean.java	13 Jan 2005 20:05:36 -0000	1.8
  +++ PBSessionBean.java	8 Jun 2005 23:33:33 -0000	1.9
  @@ -26,7 +26,7 @@
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   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.QueryFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.ArticleVO;
  @@ -131,7 +131,7 @@
       protected int getCount(Class target)
       {
           PersistenceBroker broker = getBroker();
  -        int result = broker.getCount(new QueryByCriteria(target));
  +        int result = broker.getCount(QueryFactory.newQuery(target, (Criteria) null));
           broker.close();
           return result;
       }
  @@ -143,7 +143,7 @@
       {
           if(log.isDebugEnabled()) log.debug("getAllObjects was called");
           PersistenceBroker broker = getBroker();
  -        Query q = new QueryByCriteria(target);
  +        Query q = QueryFactory.newQuery(target, (Criteria) null);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
           return result;
  @@ -156,7 +156,7 @@
       {
           if(log.isDebugEnabled()) log.debug("getAllObjects was called");
           PersistenceBroker broker = getBroker();
  -        Query q = new QueryByCriteria(target);
  +        Query q = QueryFactory.newQuery(target, (Criteria) null);
           Iterator result = broker.getIteratorByQuery(q);
           broker.close();
           return result;
  @@ -180,7 +180,7 @@
           PersistenceBroker broker = getBroker();
           Criteria crit = new Criteria();
           crit.addLike("name", articleName);
  -        Query q = new QueryByCriteria(ArticleVO.class, crit);
  +        Query q = QueryFactory.newQuery(ArticleVO.class, crit);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
           return result;
  
  
  
  1.10      +4 -3      db-ojb/src/ejb/org/apache/ojb/ejb/pb/PersonArticleManagerPBBean.java
  
  Index: PersonArticleManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/pb/PersonArticleManagerPBBean.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PersonArticleManagerPBBean.java	13 Jan 2005 20:05:36 -0000	1.9
  +++ PersonArticleManagerPBBean.java	8 Jun 2005 23:33:33 -0000	1.10
  @@ -29,8 +29,9 @@
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.core.PersistenceBrokerFactoryIF;
  +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.QueryFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.ArticleVO;
  @@ -107,7 +108,7 @@
           try
           {
               // do something with broker
  -            Query q = new QueryByCriteria(PersonVO.class);
  +            Query q = QueryFactory.newQuery(PersonVO.class, (Criteria) null);
               broker.getCollectionByQuery(q);
               // System.out.println("## broker1: con=" + broker.serviceConnectionManager().getConnection());
               //now use nested bean call
  
  
  
  1.6       +3 -3      db-ojb/src/ejb/org/apache/ojb/ejb/pb/PersonManagerPBBean.java
  
  Index: PersonManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/pb/PersonManagerPBBean.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PersonManagerPBBean.java	13 Jan 2005 20:05:36 -0000	1.5
  +++ PersonManagerPBBean.java	8 Jun 2005 23:33:33 -0000	1.6
  @@ -21,7 +21,7 @@
   import org.apache.ojb.broker.PersistenceBroker;
   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.QueryFactory;
   import org.apache.ojb.ejb.PersonVO;
   
   /**
  @@ -112,7 +112,7 @@
           Criteria criteria = new Criteria();
           if (firstname != null) criteria.addEqualTo("firstname", firstname);
           if (lastname != null) criteria.addEqualTo("firstname", lastname);
  -        Query q = new QueryByCriteria(PersonVO.class);
  +        Query q = QueryFactory.newQuery(PersonVO.class, (Criteria) null);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
           return result;
  
  
  
  1.4       +3 -3      db-ojb/src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java
  
  Index: RollbackBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RollbackBean.java	13 Jan 2005 20:05:36 -0000	1.3
  +++ RollbackBean.java	8 Jun 2005 23:33:33 -0000	1.4
  @@ -30,7 +30,7 @@
   import org.apache.ojb.broker.PersistenceBroker;
   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.QueryFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.ejb.ArticleVO;
  @@ -213,7 +213,7 @@
           PersistenceBroker broker = getBroker();
           try
           {
  -            Query q = new QueryByCriteria(searchClass);
  +            Query q = QueryFactory.newQuery(searchClass, (Criteria) null);
               // we get the iterator and step into the first found object
               Iterator it = broker.getIteratorByQuery(q);
               it.next();
  
  
  
  1.6       +2 -2      db-ojb/src/ejb/org/apache/ojb/ejb/AllODMGTests.java
  
  Index: AllODMGTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/AllODMGTests.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AllODMGTests.java	13 Sep 2004 10:54:30 -0000	1.5
  +++ AllODMGTests.java	8 Jun 2005 23:33:33 -0000	1.6
  @@ -20,8 +20,8 @@
   import org.apache.ojb.ejb.odmg.ArticleTestClient;
   import org.apache.ojb.ejb.odmg.ODMGClient;
   import org.apache.ojb.ejb.odmg.PersonArticleClientODMG;
  -import org.apache.ojb.ejb.odmg.StressTestClient;
   import org.apache.ojb.ejb.odmg.RollbackClient;
  +import org.apache.ojb.ejb.odmg.StressTestClient;
   
   /**
    * The facade to all ODMG-api session bean test cases.
  
  
  
  1.6       +2 -2      db-ojb/src/ejb/org/apache/ojb/ejb/AllPBTests.java
  
  Index: AllPBTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/AllPBTests.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AllPBTests.java	13 Sep 2004 10:54:30 -0000	1.5
  +++ AllPBTests.java	8 Jun 2005 23:33:33 -0000	1.6
  @@ -20,8 +20,8 @@
   import org.apache.ojb.ejb.pb.ArticleTestClient;
   import org.apache.ojb.ejb.pb.PBClient;
   import org.apache.ojb.ejb.pb.PersonArticleClient;
  -import org.apache.ojb.ejb.pb.StressTestClient;
   import org.apache.ojb.ejb.pb.RollbackClient;
  +import org.apache.ojb.ejb.pb.StressTestClient;
   
   /**
    * The facade to all PB-api session bean test cases.
  
  
  
  1.7       +1 -2      db-ojb/src/ejb/org/apache/ojb/ejb/SessionBeanImpl.java
  
  Index: SessionBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/SessionBeanImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SessionBeanImpl.java	5 Apr 2004 00:17:07 -0000	1.6
  +++ SessionBeanImpl.java	8 Jun 2005 23:33:33 -0000	1.7
  @@ -16,7 +16,6 @@
    */
   
   import javax.ejb.EJBException;
  -import javax.ejb.SessionBean;
   import javax.ejb.SessionContext;
   
   /**
  
  
  
  1.6       +10 -19    db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerFactoryImpl.java
  
  Index: PersistenceManagerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerFactoryImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PersistenceManagerFactoryImpl.java	4 Apr 2004 23:53:38 -0000	1.5
  +++ PersistenceManagerFactoryImpl.java	8 Jun 2005 23:33:33 -0000	1.6
  @@ -22,6 +22,8 @@
   import java.util.Collections;
   import java.util.Properties;
   
  +import org.apache.commons.lang.BooleanUtils;
  +
   /**
    * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
    */
  @@ -130,25 +132,14 @@
   		PersistenceManagerFactoryImpl retval = new PersistenceManagerFactoryImpl();
   		// parse and set the properties
   		// boolean props
  -//#ifdef JDBC30
  -		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, Boolean.toString(retval.getOptimistic()))));
  -		retval.setRetainValues(Boolean.getBoolean(props.getProperty(JDOConstants.RETAIN_VALUES,
Boolean.toString(retval.getRetainValues()))));
  -		retval.setRestoreValues(Boolean.getBoolean(props.getProperty(JDOConstants.RESTORE_VALUES,
Boolean.toString(retval.getRestoreValues()))));
  -		retval.setIgnoreCache(Boolean.getBoolean(props.getProperty(JDOConstants.IGNORE_CACHE,
Boolean.toString(retval.getIgnoreCache()))));
  -		retval.setNontransactionalRead(Boolean.getBoolean(props.getProperty(JDOConstants.NON_TRANSACTIONAL_READ,
Boolean.toString(retval.getNontransactionalRead()))));
  -		retval.setMultithreaded(Boolean.getBoolean(props.getProperty(JDOConstants.MULTI_THREADED,
Boolean.toString(retval.getMultithreaded()))));
  -		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, Boolean.toString(retval.getOptimistic()))));
  -		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, Boolean.toString(retval.getOptimistic()))));
  -//#else
  -		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, (retval.getOptimistic()
? "true" : "false")))); 
  -		retval.setRetainValues(Boolean.getBoolean(props.getProperty(JDOConstants.RETAIN_VALUES,
(retval.getRetainValues() ? "true" : "false")))); 
  -		retval.setRestoreValues(Boolean.getBoolean(props.getProperty(JDOConstants.RESTORE_VALUES,
(retval.getRestoreValues() ? "true" : "false")))); 
  -		retval.setIgnoreCache(Boolean.getBoolean(props.getProperty(JDOConstants.IGNORE_CACHE,
(retval.getIgnoreCache() ? "true" : "false")))); 
  -		retval.setNontransactionalRead(Boolean.getBoolean(props.getProperty(JDOConstants.NON_TRANSACTIONAL_READ,
(retval.getNontransactionalRead() ? "true" : "false"))));
  -		retval.setMultithreaded(Boolean.getBoolean(props.getProperty(JDOConstants.MULTI_THREADED,
(retval.getMultithreaded() ? "true" : "false"))));
  -		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, (retval.getOptimistic()
? "true" : "false"))));
  -		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, (retval.getOptimistic()
? "true" : "false"))));
  -//#endif
  +		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, BooleanUtils.toStringTrueFalse(retval.getOptimistic()))));
  +		retval.setRetainValues(Boolean.getBoolean(props.getProperty(JDOConstants.RETAIN_VALUES,
BooleanUtils.toStringTrueFalse(retval.getRetainValues()))));
  +		retval.setRestoreValues(Boolean.getBoolean(props.getProperty(JDOConstants.RESTORE_VALUES,
BooleanUtils.toStringTrueFalse(retval.getRestoreValues()))));
  +		retval.setIgnoreCache(Boolean.getBoolean(props.getProperty(JDOConstants.IGNORE_CACHE,
BooleanUtils.toStringTrueFalse(retval.getIgnoreCache()))));
  +		retval.setNontransactionalRead(Boolean.getBoolean(props.getProperty(JDOConstants.NON_TRANSACTIONAL_READ,
BooleanUtils.toStringTrueFalse(retval.getNontransactionalRead()))));
  +		retval.setMultithreaded(Boolean.getBoolean(props.getProperty(JDOConstants.MULTI_THREADED,
BooleanUtils.toStringTrueFalse(retval.getMultithreaded()))));
  +		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, BooleanUtils.toStringTrueFalse(retval.getOptimistic()))));
  +		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, BooleanUtils.toStringTrueFalse(retval.getOptimistic()))));
   
   		// string props
   		retval.setConnectionUserName(props.getProperty(JDOConstants.CONNECTION_USER_NAME, retval.getConnectionUserName()));
  
  
  
  1.5       +4 -1      db-ojb/src/samples/org/apache/ojb/tutorial2/Application.java
  
  Index: Application.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/samples/org/apache/ojb/tutorial2/Application.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Application.java	24 Nov 2004 22:31:13 -0000	1.4
  +++ Application.java	8 Jun 2005 23:33:33 -0000	1.5
  @@ -42,6 +42,9 @@
       public Application()
       {
           // get facade instance
  +        // use one Implementation instance per database
  +        // it's recommended to share the Implementation and Database instances
  +        // in the application, instead of always instantiate and open it.
           Implementation odmg = OJB.getInstance();
           Database       db   = odmg.newDatabase();
   
  @@ -89,7 +92,7 @@
   
       /**
        * Reads a single line from stdin and returns it.
  -     * 
  +     *
        * @return The user's intput
        */
       private String readLine()
  
  
  
  1.3       +7 -2      db-ojb/src/samples/org/apache/ojb/tutorial2/UCDeleteProduct.java
  
  Index: UCDeleteProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/samples/org/apache/ojb/tutorial2/UCDeleteProduct.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCDeleteProduct.java	22 Jun 2004 22:34:00 -0000	1.2
  +++ UCDeleteProduct.java	8 Jun 2005 23:33:33 -0000	1.3
  @@ -15,7 +15,12 @@
    * limitations under the License.
    */
   
  -import org.odmg.*;
  +import java.util.List;
  +
  +import org.odmg.Database;
  +import org.odmg.Implementation;
  +import org.odmg.OQLQuery;
  +import org.odmg.Transaction;
   
   /**
    * Use case for deleting a product from the database.
  @@ -70,7 +75,7 @@
   
               query.create(oqlQuery);
   
  -            DList   result      = (DList)query.execute();
  +            List   result      = (List)query.execute();
               Product toBeDeleted = (Product)result.get(0);
   
               // 4. now mark object for deletion
  
  
  
  1.3       +6 -2      db-ojb/src/samples/org/apache/ojb/tutorial2/UCEditProduct.java
  
  Index: UCEditProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/samples/org/apache/ojb/tutorial2/UCEditProduct.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCEditProduct.java	22 Jun 2004 22:34:00 -0000	1.2
  +++ UCEditProduct.java	8 Jun 2005 23:33:33 -0000	1.3
  @@ -15,7 +15,11 @@
    * limitations under the License.
    */
   
  -import org.odmg.*;
  +import java.util.List;
  +
  +import org.odmg.Implementation;
  +import org.odmg.OQLQuery;
  +import org.odmg.Transaction;
   
   /**
    * Use case for editing a product.
  @@ -68,7 +72,7 @@
   
               query.create(oqlQuery);
   
  -            DList   result     = (DList)query.execute();
  +            List   result     = (List)query.execute();
               Product toBeEdited = (Product)result.get(0);
   
               // 4. lock the product for write access
  
  
  
  1.3       +6 -4      db-ojb/src/samples/org/apache/ojb/tutorial2/UCEnterNewProduct.java
  
  Index: UCEnterNewProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/samples/org/apache/ojb/tutorial2/UCEnterNewProduct.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCEnterNewProduct.java	22 Jun 2004 22:34:00 -0000	1.2
  +++ UCEnterNewProduct.java	8 Jun 2005 23:33:33 -0000	1.3
  @@ -17,6 +17,7 @@
   
   import org.odmg.Implementation;
   import org.odmg.Transaction;
  +import org.odmg.Database;
   
   /**
    * Use case for adding a new product to the database.
  @@ -25,7 +26,7 @@
   {
       /**
        * Creates a new enter-new use case instance.
  -     * 
  +     *
        * @param odmg The odmg implementation to use
        */
       public UCEnterNewProduct(Implementation odmg)
  @@ -35,7 +36,7 @@
   
       /**
        * Returns a description of this use case.
  -     * 
  +     *
        * @return A description of the use case
        */
       public String getDescription()
  @@ -65,12 +66,13 @@
           // now perform persistence operations
   
           // 3. open transaction
  +        Database db = odmg.getDatabase(null); // the current DB
           Transaction tx = odmg.newTransaction();
   
           tx.begin();
   
  -        // 4. acquire write lock on new object
  -        tx.lock(newProduct, Transaction.WRITE);
  +        // 4. make persistent new object
  +        db.makePersistent(newProduct);
   
           // 5. commit transaction
           tx.commit();
  
  
  
  1.3       +2 -2      db-ojb/src/samples/org/apache/ojb/tutorial2/UCListAllProducts.java
  
  Index: UCListAllProducts.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/samples/org/apache/ojb/tutorial2/UCListAllProducts.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCListAllProducts.java	22 Jun 2004 22:34:00 -0000	1.2
  +++ UCListAllProducts.java	8 Jun 2005 23:33:33 -0000	1.3
  @@ -16,8 +16,8 @@
    */
   
   import java.util.Iterator;
  +import java.util.List;
   
  -import org.odmg.DList;
   import org.odmg.Implementation;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
  @@ -68,7 +68,7 @@
               query.create("select allproducts from " + Product.class.getName());
   
               // 4. perform the query and store the result in a persistent Collection
  -            DList allProducts = (DList) query.execute();
  +            List allProducts = (List) query.execute();
   
               tx.commit();
   
  
  
  
  1.3       +76 -63    db-ojb/src/samples/org/apache/ojb/tutorials/ODMGExample.java
  
  Index: ODMGExample.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/samples/org/apache/ojb/tutorials/ODMGExample.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ODMGExample.java	22 Jun 2004 22:34:01 -0000	1.2
  +++ ODMGExample.java	8 Jun 2005 23:33:33 -0000	1.3
  @@ -15,55 +15,68 @@
    * limitations under the License.
    */
   
  -import org.odmg.DList;
  +import java.util.List;
  +
  +import org.apache.ojb.odmg.OJB;
  +import org.apache.ojb.odmg.TransactionExt;
   import org.odmg.Database;
   import org.odmg.Implementation;
  +import org.odmg.ODMGException;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
   
  -import org.apache.ojb.odmg.OJB;
  -import org.apache.ojb.odmg.TransactionExt;
  -
   /**
    * ODMG API Usage Examples for the ODMG Tutorial
    */
   public class ODMGExample
   {
  +    private Implementation odmg;
  +    private Database database;
  +
  +    public ODMGExample()
  +    {
  +        odmg = OJB.getInstance();
  +        database = odmg.newDatabase();
  +        try
  +        {
  +            database.open("default", Database.OPEN_READ_WRITE);
  +        }
  +        catch(ODMGException e)
  +        {
  +            throw new RuntimeException("Tutorial execution failed", e);
  +        }
  +    }
  +
  +
       /**
        * Stores the given product in the database.
  -     * 
  +     *
        * @param product The product to store
        */
  -    public static void storeProduct(Product product)
  +    public void storeProduct(Product product)
       {
  -        Implementation impl = OJB.getInstance();
  -        Transaction    tx   = impl.newTransaction();
  -
  +        Transaction tx = odmg.newTransaction();
           tx.begin();
  -        tx.lock(product, Transaction.WRITE);
  +        database.makePersistent(product);
           tx.commit();
       }
   
       /**
        * Finds the product with the given name.
  -     * 
  +     *
        * @param name The name of the product
        * @return The product if found
        */
  -    public static Product findProductByName(String name) throws Exception
  +    public Product findProductByName(String name) throws Exception
       {
  -        Implementation impl = OJB.getInstance();
  -        Transaction    tx   = impl.newTransaction();
  -
  +        Transaction tx = odmg.newTransaction();
           tx.begin();
  -
  -        OQLQuery query = impl.newOQLQuery();
  -
  +        OQLQuery query = odmg.newOQLQuery();
           query.create("select products from " + Product.class.getName() + " where name =
$1");
           query.bind(name);
   
  -        DList   results = (DList)query.execute();
  -        Product product = (Product)results.iterator().next();
  +        List results = (List) query.execute();
  +        Product product = (Product) results.iterator().next();
   
           tx.commit();
           return product;
  @@ -71,52 +84,40 @@
   
       /**
        * Sells the given amount of products.
  -     * 
  +     *
        * @param product The product to sell
        * @param number  The number of items to sell
        */
  -    public static void sellProduct(Product product, int number)
  +    public void sellProduct(Product product, int number)
       {
  -        Implementation impl = OJB.getInstance();
  -        Transaction    tx   = impl.newTransaction();
  -
  +        Transaction tx = odmg.newTransaction();
           tx.begin();
  -
           tx.lock(product, Transaction.WRITE);
  -        product.setStock(product.getStock() -  number);
  -
  +        product.setStock(product.getStock() - number);
           tx.commit();
       }
   
       /**
        * Deletes the given product from the database.
  -     * 
  +     *
        * @param product The product to delete
        */
  -    public static void deleteProduct(Product product)
  +    public void deleteProduct(Product product)
       {
  -        Implementation impl = OJB.getInstance();
  -        Transaction    tx = impl.newTransaction();
  -
  +        Transaction tx = odmg.newTransaction();
           tx.begin();
  -
  -        Database db = impl.getDatabase(product);
  -
  -        db.deletePersistent(product);
  -
  +        database.deletePersistent(product);
           tx.commit();
       }
   
       /**
        * Stores any changes to the product in the database.
  -     * 
  +     *
        * @param product The product to update in the database
        */
  -    public static void persistChanges(Product product)
  +    public void persistChanges(Product product)
       {
  -        Implementation impl = OJB.getInstance();
  -        TransactionExt tx  = (TransactionExt)impl.newTransaction();
  -
  +        TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.markDirty(product);
           tx.commit();
  @@ -124,30 +125,42 @@
   
       /**
        * The main entry point for this sample application.
  -     * 
  +     *
        * @param args The commandline arguments
        */
       public static void main(String[] args) throws Exception
       {
  -        Implementation odmg = OJB.getInstance();
  -        Database       db   = odmg.newDatabase();
  -
  -        db.open("default", Database.OPEN_READ_WRITE);
  -
  -        Product product = new Product();
  -
  -        product.setName("Widget");
  -        product.setPrice(9.99);
  -        product.setStock(11);
  -
  -        storeProduct(product);
  -
  -        Product same = findProductByName(product.getName());
  -
  -        System.out.println(same.getId() + " = " + product.getId());
  -
  -        sellProduct(same, 1);
  +        String name = "Widget_" + System.currentTimeMillis();
  +        Product tmp = new Product();
  +        tmp.setName(name);
  +        tmp.setPrice(9.99);
  +        tmp.setStock(11);
  +
  +        ODMGExample example = new ODMGExample();
  +
  +        System.out.println("1a. Store product: " + tmp);
  +        example.storeProduct(tmp);
  +        System.out.println("1b. Product stored: " + tmp);
  +        System.out.println();
  +
  +        System.out.println("2a. Find product by name");
  +        Product aProduct = example.findProductByName(tmp.getName());
  +        System.out.println("2b. Found product: " + aProduct);
  +        System.out.println();
  +
  +        System.out.println("3a. Sell two products, stock before was " + aProduct.getStock());
  +        example.sellProduct(aProduct, 2);
  +        aProduct = example.findProductByName(aProduct.getName());
  +        System.out.println("3b. Product sold, current stock is " + aProduct.getStock());
  +        System.out.println();
  +
  +        System.out.println("4a. Delete a product object");
  +        example.deleteProduct(aProduct);
  +        System.out.println("4b. Product deleted");
  +        System.out.println("4c. Try to lookup deleted product");
  +        Product newProduct = example.findProductByName(aProduct.getName());
  +        System.out.println("4d. Found product: " + newProduct);
   
  -        db.close();
  +        System.exit(0);
       }
   }
  
  
  
  1.4       +24 -1     db-ojb/src/test/org/apache/ojb/OJB-logging.properties
  
  Index: OJB-logging.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/OJB-logging.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OJB-logging.properties	17 Mar 2005 09:57:06 -0000	1.3
  +++ OJB-logging.properties	8 Jun 2005 23:33:33 -0000	1.4
  @@ -46,6 +46,9 @@
   #
   # The Default Logger instance used within OJB
   DEFAULT.LogLevel=WARN
  +#
  +# PB-api and Kernel
  +#
   # Logger for PersistenceBrokerImpl class
   org.apache.ojb.broker.core.PersistenceBrokerImpl.LogLevel=WARN
   # Logger for PersistenceBrokerFactory class PersistenceBrokerFactoryDefaultImpl
  @@ -74,6 +77,26 @@
   org.apache.ojb.broker.core.proxy.IndirectionHandler.LogLevel=WARN
   # Logger for Oracle9i platform, useful for tracing failing Oracle-extensions or large LOB-support
   org.apache.ojb.broker.platforms.PlatformOracle9iImpl.LogLevel=WARN
  +# Metadata for super-inheritance
  +org.apache.ojb.broker.metadata.SuperReferenceDescriptor$SuperReferenceField.LogLevel=WARN
  +# OJB locking implementations
  +org.apache.ojb.broker.locking.LockManagerInMemoryImpl.LogLevel=WARN
  +org.apache.ojb.broker.locking.LockManagerCommonsImpl.LogLevel=WARN
  +org.apache.ojb.broker.locking.LockManagerRemoteImpl.LogLevel=WARN
  +org.apache.ojb.broker.locking.CommonsOJBLockManager.LogLevel=WARN
  +#
  +# odmg-api
  +#
  +org.apache.ojb.odmg.TransactionImpl.LogLevel=WARN
  +org.apache.ojb.odmg.J2EETransactionImpl.LogLevel=WARN
  +org.apache.ojb.odmg.ImplementationImpl.LogLevel=WARN
  +org.apache.ojb.odmg.DatabaseImpl.LogLevel=WARN
  +org.apache.ojb.odmg.ObjectEnvelopeTable.LogLevel=WARN
  +org.apache.ojb.odmg.ObjectEnvelope.LogLevel=WARN
  +org.apache.ojb.odmg.ObjectEnvelopeOrdering.LogLevel=WARN
  +org.apache.ojb.odmg.LocalTxManager.LogLevel=WARN
  +org.apache.ojb.odmg.JTATxManager.LogLevel=WARN
  +#
   #
   # Special Logger categories used in test suite and tutorials
   #
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message