You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2002/12/24 14:46:34 UTC
cvs commit: jakarta-ojb/src/java/org/apache/ojb/otm Environment.java
arminw 2002/12/24 05:46:34
Modified: src/java/org/apache/ojb/otm Environment.java
Log:
update to new stuff
Revision Changes Path
1.3 +48 -51 jakarta-ojb/src/java/org/apache/ojb/otm/Environment.java
Index: Environment.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/otm/Environment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Environment.java 8 Nov 2002 13:29:29 -0000 1.2
+++ Environment.java 24 Dec 2002 13:46:34 -0000 1.3
@@ -60,6 +60,7 @@
import org.apache.ojb.broker.PBKey;
import org.apache.ojb.broker.cache.ObjectCache;
import org.apache.ojb.broker.metadata.DescriptorRepository;
+import org.apache.ojb.broker.metadata.MetadataManager;
import org.apache.ojb.otm.cache.spi.CopyingObjectCache;
import org.apache.ojb.otm.copy.spi.ObjectCopyStrategy;
import org.apache.ojb.otm.transaction.spi.TransactionCoordinator;
@@ -71,9 +72,8 @@
private HashMap _copyStrategies;
private ObjectCopyStrategy _defaultCopyStrategy;
private boolean _isCacheHot;
-
+
private CopyingObjectCache _globalObjectCache;
- private DescriptorRepository _descriptorRepository;
public Environment (String repositoryFile, String user, String password)
{
@@ -86,7 +86,7 @@
super(repositoryFile);
init();
}
-
+
private void init () {
_copyStrategies = new HashMap();
}
@@ -98,141 +98,138 @@
}
return _globalObjectCache;
}
-
+
public DescriptorRepository getDescriptorRepository ()
{
- if (_descriptorRepository == null) {
- _descriptorRepository = DescriptorRepository.getInstance(this);
- }
- return _descriptorRepository;
+ return MetadataManager.getInstance().getRepository();
}
-
+
public Identity getIdentity (Object obj)
{
// DescriptorRepository descriptorRepository = getDescriptorRepository();
return new Identity(obj);
}
-
+
/**
- *
+ *
* Get a <code>Connection</code> that could works with this <code>Environment</code>.
- *
+ *
* @return the PersistenceBroker.
- *
+ *
*/
public Connection acquireConnection ()
{
return new Connection(this);
}
-
+
/////////////////////////////
// Environment settings
/////////////////////////////
-
+
/**
- *
+ *
* Set the TransactionCoordinator for this Environment
- *
+ *
* @param transactionCoordinator the TransactionCoordinator
- *
+ *
*/
public void setTransactionCoordinator (TransactionCoordinator transactionCoordinator)
{
_transactionCoordinator = transactionCoordinator;
}
-
+
/**
- *
+ *
* Returns the TransactionCoordinator associated with this Environment
- *
+ *
* @return the TransactionCoordinator
- *
+ *
*/
public TransactionCoordinator getTransactionCoordinator ()
{
return _transactionCoordinator;
}
-
+
/**
- *
- * Set the <code>CacheAdapter</code> associated with this repository. The CacheAdapter is
+ *
+ * Set the <code>CacheAdapter</code> associated with this repository. The CacheAdapter is
* used to cache all objects in the GlobalCache.
- *
+ *
* @param classAdapter the CacheAdapter class.
- *
+ *
*/
public void setCacheAdapter (ObjectCache cacheAdapter) {
_cacheAdapter = cacheAdapter;
}
-
+
/**
- *
+ *
* Get the CacheAdapter for this repository.
- *
+ *
* @return the CacheAdapter
- *
+ *
*/
public ObjectCache getCacheAdapter ()
{
return _cacheAdapter;
}
-
+
/**
- *
+ *
* Set if the Cache should be hot?
- *
+ *
* @param isHot true, if hot. false, otherwise.
- *
+ *
*/
public void setCacheHot (boolean isHot)
{
_isCacheHot = isHot;
}
-
+
/**
- *
+ *
* Tests if the cache is requested to be hot
- *
+ *
* @return is cache requested to be hot?
- *
+ *
*/
public boolean isCacheHot ()
{
return _isCacheHot;
}
-
+
/**
- *
+ *
* Set the default ObjectCopyStrategy for all classes.
- *
+ *
* @param copyStrategy the default ObjectCopyStrategy class
- *
+ *
*/
public void setDefaultCopyStrategy (ObjectCopyStrategy copyStrategy)
{
_defaultCopyStrategy = copyStrategy;
}
-
+
/**
- *
+ *
* Set the ObjectCopyStrategy associated with the given domain class.
- *
+ *
* @param domainClass the domain class
* @param copyStrategy the ObjectCopyStrategy
- *
+ *
*/
public void setCopyStrategy (Class domainClass, ObjectCopyStrategy copyStrategy)
{
_copyStrategies.put(domainClass, copyStrategy);
}
-
+
/**
- *
+ *
* Get the ObjectCopyStrategy associated with the given domain class. If no strategy is
* associated use the default ObjectCopyStrategy class.
- *
+ *
* @return the ObjectCopyStrategy class
- *
+ *
*/
public ObjectCopyStrategy getCopyStrategy (Class domainClass)
{