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 2007/05/16 01:01:07 UTC
svn commit: r538363 - in
/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker:
accesslayer/ConnectionFactoryFactory.java cache/ObjectCacheTwoLevelImpl.java
Author: arminw
Date: Tue May 15 16:01:06 2007
New Revision: 538363
URL: http://svn.apache.org/viewvc?view=rev&rev=538363
Log:
add shortcut name support, optimize source
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryFactory.java
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryFactory.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryFactory.java?view=diff&rev=538363&r1=538362&r2=538363
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryFactory.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryFactory.java Tue May 15 16:01:06 2007
@@ -51,4 +51,9 @@
{
return "ConnectionFactoryClass";
}
+
+ protected Class getBaseInterface()
+ {
+ return ConnectionFactory.class;
+ }
}
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java?view=diff&rev=538363&r1=538362&r2=538363
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java Tue May 15 16:01:06 2007
@@ -34,6 +34,7 @@
import org.apache.ojb.broker.metadata.FieldDescriptor;
import org.apache.ojb.broker.metadata.MetadataException;
import org.apache.ojb.broker.util.ClassHelper;
+import org.apache.ojb.broker.util.ShortcutMapper;
import org.apache.ojb.broker.util.logging.Logger;
import org.apache.ojb.broker.util.logging.LoggerFactory;
@@ -190,8 +191,8 @@
Object[] objects = new Object[]{broker, prop};
try
{
- this.copyStrategy = (CopyStrategy) ClassHelper.newInstance(copyStrategyName);
- Class target = ClassHelper.getClass(applicationCacheName);
+ this.copyStrategy = (CopyStrategy) ClassHelper.newInstance(ShortcutMapper.resolve(copyStrategyName, CopyStrategy.class));
+ Class target = ShortcutMapper.resolve(applicationCacheName, ObjectCache.class);
if(target.equals(ObjectCacheDefaultImpl.class))
{
// this property doesn't make sense in context of two-level cache
@@ -233,7 +234,7 @@
private Object lookupFromApplicationCache(final Identity oid)
{
Object result = null;
- Object obj = getApplicationCache().lookup(oid);
+ Object obj = applicationCache.lookup(oid);
if(obj != null)
{
result = copyStrategy.read(broker, obj);
@@ -250,16 +251,16 @@
Object oldTarget = null;
if(!cacheIfNew)
{
- oldTarget = getApplicationCache().lookup(oid);
+ oldTarget = applicationCache.lookup(oid);
}
Object target = copyStrategy.write(broker, obj, oldTarget);
if(cacheIfNew)
{
- return getApplicationCache().cacheIfNew(oid, target);
+ return applicationCache.cacheIfNew(oid, target);
}
else
{
- getApplicationCache().cache(oid, target);
+ applicationCache.cache(oid, target);
return false;
}
}
@@ -421,7 +422,7 @@
{
if(log.isDebugEnabled()) log.debug("Remove object " + oid);
sessionCache.remove(oid);
- getApplicationCache().remove(oid);
+ applicationCache.remove(oid);
}
/**
@@ -430,7 +431,7 @@
public void clear()
{
sessionCache.clear();
- getApplicationCache().clear();
+ applicationCache.clear();
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org