db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/otm OTMKit.java Kit.java
Date Sun, 05 Dec 2004 19:53:04 GMT
tomdz       2004/12/05 11:53:04

  Modified:    src/jdori/org/apache/ojb/jdori/sql OjbStorePMF.java
               src/java/org/apache/ojb/otm/transaction
                        LocalTransactionFactory.java
                        TransactionFactory.java
                        ManagedTransactionFactory.java
               src/java/org/apache/ojb/broker/util/dbhandling
                        DatabaseHandlingTask.java
               src/java/org/apache/ojb/otm/core BaseConnection.java
               src/java/org/apache/ojb/jdo PersistenceManagerImpl.java
               src/java/org/apache/ojb/odmg DatabaseImpl.java
               src/java/org/apache/ojb/otm OTMKit.java Kit.java
  Log:
  Removed dependencies of the commons-sql dbhandling, and the odmg, otm and jdo implementations
to the PersistenceBrokerFactory
  
  Revision  Changes    Path
  1.7       +7 -2      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStorePMF.java
  
  Index: OjbStorePMF.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStorePMF.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- OjbStorePMF.java	5 Dec 2004 17:45:00 -0000	1.6
  +++ OjbStorePMF.java	5 Dec 2004 19:53:03 -0000	1.7
  @@ -58,7 +58,7 @@
       {
           super();
           ojb = new OJB();
  -        persistenceConf = ojb.getConfiguration(null);
  +        persistenceConf = ojb.getDefaultConfiguration();
       }
   
       /**
  @@ -72,9 +72,14 @@
       {
           super(URL, userName, password, driverName);
           ojb = new OJB();
  -        persistenceConf = ojb.getConfiguration(null);
  +        persistenceConf = ojb.getDefaultConfiguration();
       }
   
  +    public OJB getOjb()
  +    {
  +        return ojb;
  +    }
  +    
       private static HashMap getTrackedClasses()
       {
           HashMap classMap = new HashMap();
  
  
  
  1.11      +5 -4      db-ojb/src/java/org/apache/ojb/otm/transaction/LocalTransactionFactory.java
  
  Index: LocalTransactionFactory.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/transaction/LocalTransactionFactory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LocalTransactionFactory.java	4 Apr 2004 23:53:42 -0000	1.10
  +++ LocalTransactionFactory.java	5 Dec 2004 19:53:03 -0000	1.11
  @@ -16,6 +16,7 @@
    */
   
   import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.otm.OTMConnection;
   import org.apache.ojb.otm.core.BaseConnection;
   import org.apache.ojb.otm.core.Transaction;
  @@ -71,9 +72,9 @@
       /**
        * @see org.apache.ojb.otm.transaction.TransactionFactory#acquireConnection(PBKey)
        */
  -    public OTMConnection acquireConnection (PBKey pbKey)
  +    public OTMConnection acquireConnection(PersistenceConfiguration persistenceConf)
       {
  -        OTMConnection newConnection = new LocalConnection(pbKey);
  +        OTMConnection newConnection = new LocalConnection(persistenceConf);
           // Ensure the transaction is established for this connection.
           getTransactionForConnection(newConnection);
           return newConnection;
  @@ -89,9 +90,9 @@
        */
       private static class LocalConnection extends BaseConnection
       {
  -        public LocalConnection (PBKey pbKey)
  +        public LocalConnection(PersistenceConfiguration persistenceConf)
           {
  -            super(pbKey);
  +            super(persistenceConf);
           }
   
   
  
  
  
  1.6       +3 -4      db-ojb/src/java/org/apache/ojb/otm/transaction/TransactionFactory.java
  
  Index: TransactionFactory.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/transaction/TransactionFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TransactionFactory.java	4 Apr 2004 23:53:42 -0000	1.5
  +++ TransactionFactory.java	5 Dec 2004 19:53:03 -0000	1.6
  @@ -15,11 +15,10 @@
    * limitations under the License.
    */
   
  -import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.otm.OTMConnection;
   import org.apache.ojb.otm.core.Transaction;
   
  -
   /**
    *
    * Factory to fetch current transaction. The various implementations will handle
  @@ -38,7 +37,7 @@
        *  @return     the current Transaction
        * 
        */
  -    public Transaction getTransactionForConnection (OTMConnection connection);
  +    public Transaction getTransactionForConnection(OTMConnection connection);
       
       /**
        * 
  @@ -48,5 +47,5 @@
        *  @return     new connection
        * 
        */
  -    public OTMConnection acquireConnection (PBKey pbKey);
  +    public OTMConnection acquireConnection(PersistenceConfiguration persistenceConf);
   }
  
  
  
  1.10      +5 -6      db-ojb/src/java/org/apache/ojb/otm/transaction/ManagedTransactionFactory.java
  
  Index: ManagedTransactionFactory.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/transaction/ManagedTransactionFactory.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ManagedTransactionFactory.java	14 Nov 2004 09:39:57 -0000	1.9
  +++ ManagedTransactionFactory.java	5 Dec 2004 19:53:03 -0000	1.10
  @@ -20,8 +20,8 @@
   import javax.transaction.SystemException;
   import javax.transaction.TransactionManager;
   
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.transaction.tm.TransactionManagerFactory;
   import org.apache.ojb.broker.transaction.tm.TransactionManagerFactoryException;
   import org.apache.ojb.otm.OTMConnection;
  @@ -93,9 +93,9 @@
       /**
        * @see org.apache.ojb.otm.transaction.TransactionFactory#acquireConnection
        */
  -    public OTMConnection acquireConnection(PBKey pbKey)
  +    public OTMConnection acquireConnection(PersistenceConfiguration persistenceConf)
       {
  -        return new ManagedConnection(pbKey);
  +        return new ManagedConnection(persistenceConf);
       }
   
   
  @@ -128,10 +128,9 @@
   
       private static class ManagedConnection extends BaseConnection
       {
  -
  -        public ManagedConnection (PBKey pbKey)
  +        public ManagedConnection(PersistenceConfiguration persistenceConf)
           {
  -            super(pbKey);
  +            super(persistenceConf);
           }
   
           /**
  
  
  
  1.10      +1 -4      db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java
  
  Index: DatabaseHandlingTask.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DatabaseHandlingTask.java	14 Nov 2004 09:36:44 -0000	1.9
  +++ DatabaseHandlingTask.java	5 Dec 2004 19:53:03 -0000	1.10
  @@ -19,7 +19,6 @@
   import java.util.*;
   
   import org.apache.ojb.broker.PBKey;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.metadata.ConnectionRepository;
   import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
  @@ -745,9 +744,7 @@
                   System.setProperty("OJB.properties", _ojbPropertiesFile.getAbsolutePath());
               }
   
  -            // this effectively initializes OJB
               _ojb = new OJB();
  -            PersistenceBrokerFactory.setOjb(_ojb);
   
               MetadataManager     metadataManager = _ojb.getMetadataManager();
               RepositoryPersistor persistor       = metadataManager.getRepositoryPersistor();
  @@ -909,7 +906,7 @@
   
               if ((_jcdAlias == null) || (_jcdAlias.length() == 0))
               {
  -                pbKey = PersistenceBrokerFactory.getDefaultKey();
  +                pbKey = _ojb.getDefaultKey();
                   if (pbKey == null)
                   {
                       throw new BuildException("No default connection defined in the repository
file, and none specified via the jcdalias attribute");
  
  
  
  1.42      +2 -2      db-ojb/src/java/org/apache/ojb/otm/core/BaseConnection.java
  
  Index: BaseConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/BaseConnection.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- BaseConnection.java	5 Dec 2004 14:22:31 -0000	1.41
  +++ BaseConnection.java	5 Dec 2004 19:53:03 -0000	1.42
  @@ -57,9 +57,9 @@
        * Constructor for BaseConnection.
        *  
        */
  -    public BaseConnection(PBKey pbKey)
  +    public BaseConnection(PersistenceConfiguration persistenceConf)
       {
  -        _pb = (PersistenceBrokerInternal)PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  +        _pb = (PersistenceBrokerInternal)persistenceConf.createPersistenceBroker();
       }
   
       public void close()
  
  
  
  1.16      +16 -3     db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerImpl.java
  
  Index: PersistenceManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PersistenceManagerImpl.java	24 Oct 2004 15:36:15 -0000	1.15
  +++ PersistenceManagerImpl.java	5 Dec 2004 19:53:04 -0000	1.16
  @@ -26,10 +26,11 @@
   import javax.jdo.Transaction;
   
   import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.PBKey;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.core.proxy.CollectionProxy;
   import org.apache.ojb.broker.core.proxy.ProxyHelper;
  +import org.apache.ojb.jdori.sql.OjbStorePMF;
   import org.apache.ojb.otm.EditingContext;
   import org.apache.ojb.otm.OTMConnection;
   import org.apache.ojb.otm.OTMKit;
  @@ -63,17 +64,29 @@
           m_password = password;
           m_alias = alias;
           m_kit = SimpleKit.getInstance();
  +
  +        OJB ojb = null;
  +
  +        if (factory instanceof OjbStorePMF)
  +        {
  +            ojb = ((OjbStorePMF)factory).getOjb();
  +        }
  +        else
  +        {
  +            ojb = new OJB();
  +        }
  +        
           /**
            * if the alias is null, use the default.
            */
           if (null == m_alias)
           {
  -            m_conn = m_kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
  +            m_conn = m_kit.acquireConnection(ojb.getDefaultConfiguration());
           }
           else
           {
               PBKey key = new PBKey(m_alias, m_userID, m_password);
  -            m_conn = m_kit.acquireConnection(key);
  +            m_conn = m_kit.acquireConnection(ojb.getConfiguration(key));
           }
           m_tx = new TransactionImpl(this, m_kit, m_conn);
       }
  
  
  
  1.30      +2 -2      db-ojb/src/java/org/apache/ojb/odmg/DatabaseImpl.java
  
  Index: DatabaseImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/DatabaseImpl.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DatabaseImpl.java	5 Dec 2004 14:22:30 -0000	1.29
  +++ DatabaseImpl.java	5 Dec 2004 19:53:04 -0000	1.30
  @@ -124,7 +124,7 @@
               if (name == null)
               {
                   log.info("Given argument was 'null', open default database");
  -                persistenceConf = odmg.getOJBRuntime().getConfiguration(null);
  +                persistenceConf = odmg.getOJBRuntime().getDefaultConfiguration();
               }
               else
               {
  
  
  
  1.13      +4 -3      db-ojb/src/java/org/apache/ojb/otm/OTMKit.java
  
  Index: OTMKit.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/OTMKit.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- OTMKit.java	4 Apr 2004 23:53:40 -0000	1.12
  +++ OTMKit.java	5 Dec 2004 19:53:04 -0000	1.13
  @@ -16,7 +16,7 @@
    */
   
   import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.otm.copy.ObjectCopyStrategy;
   import org.apache.ojb.otm.core.Transaction;
   import org.apache.ojb.otm.lock.map.LockMap;
  @@ -37,10 +37,11 @@
       /**
        * Obtain an OTMConnection for the given persistence broker key
        */
  -    public OTMConnection acquireConnection(PBKey pbKey)
  +    public OTMConnection acquireConnection(PersistenceConfiguration persistenceConf)
       {
           TransactionFactory txFactory = getTransactionFactory();
  -        return txFactory.acquireConnection(pbKey);
  +
  +        return txFactory.acquireConnection(persistenceConf);
       }
   
       /**
  
  
  
  1.6       +3 -3      db-ojb/src/java/org/apache/ojb/otm/Kit.java
  
  Index: Kit.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/Kit.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Kit.java	4 Apr 2004 23:53:40 -0000	1.5
  +++ Kit.java	5 Dec 2004 19:53:04 -0000	1.6
  @@ -16,7 +16,7 @@
    */
   
   import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.otm.copy.ObjectCopyStrategy;
   import org.apache.ojb.otm.core.Transaction;
   import org.apache.ojb.otm.lock.map.LockMap;
  @@ -33,10 +33,10 @@
       /**
        * Acquire an open OTMConnection
        *
  -     * @param pbKey
  +     * @param persistenceConf
        * @return
        */
  -	OTMConnection acquireConnection(PBKey pbKey);
  +	OTMConnection acquireConnection(PersistenceConfiguration persistenceConf);
   
       /**
        * Obtain the transaction this connection is bound to
  
  
  

---------------------------------------------------------------------
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