db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r553580 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ShortcutMapper.java
Date Thu, 05 Jul 2007 17:49:18 GMT
Author: arminw
Date: Thu Jul  5 10:49:17 2007
New Revision: 553580

URL: http://svn.apache.org/viewvc?view=rev&rev=553580
Log:
change link color

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ShortcutMapper.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ShortcutMapper.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ShortcutMapper.java?view=diff&rev=553580&r1=553579&r2=553580
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ShortcutMapper.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ShortcutMapper.java
Thu Jul  5 10:49:17 2007
@@ -41,23 +41,18 @@
 import org.apache.ojb.broker.cache.ObjectCacheDefaultImpl;
 import org.apache.ojb.broker.cache.ObjectCacheEmptyImpl;
 import org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl;
-import org.apache.ojb.broker.cache.ObjectCacheJCSImpl;
 import org.apache.ojb.broker.cache.ObjectCache;
 import org.apache.ojb.broker.accesslayer.NullCheckDefaultImpl;
 import org.apache.ojb.broker.accesslayer.NullCheckRelaxedImpl;
 import org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl;
-import org.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl;
 import org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl;
 import org.apache.ojb.broker.accesslayer.ConnectionFactory;
 import org.apache.ojb.broker.accesslayer.NullCheck;
 import org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl;
 import org.apache.ojb.broker.accesslayer.RowReader;
-import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldAutoProxyImpl;
 import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl;
-import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldCGLibImpl;
 import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImpl;
 import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl;
-import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDynaBeanImpl;
 import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
 import org.apache.ojb.broker.transaction.tm.JBossTransactionManagerFactory;
 import org.apache.ojb.broker.transaction.tm.WebSphereTransactionManagerFactory;
@@ -71,6 +66,7 @@
 import org.apache.ojb.broker.transaction.tm.TransactionManagerFactory;
 import org.apache.ojb.broker.PersistenceChecker;
 import org.apache.ojb.broker.ManageableCollection;
+import org.apache.ojb.broker.OJBRuntimeException;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.ClassUtils;
 
@@ -96,7 +92,8 @@
                 .add("default", ObjectCacheDefaultImpl.class)
                 .add("empty", ObjectCacheEmptyImpl.class)
                 .add("session", ObjectCachePerBrokerImpl.class)
-                .add("jcs", ObjectCacheJCSImpl.class);
+                // use class name to avoid dependencies to none standard OJB libraries
+                .add("jcs", "org.apache.ojb.broker.cache.ObjectCacheJCSImpl");
         addMapping(mapping);
 
         mapping = new Mapping(ObjectCacheTwoLevelImpl.CopyStrategy.class)
@@ -120,12 +117,13 @@
         addMapping(mapping);
 
         mapping = new Mapping(PersistentField.class)
-                .add("auto", PersistentFieldAutoProxyImpl.class)
+                // use class name to avoid dependencies to none standard OJB libraries
+                .add("auto", "org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldAutoProxyImpl")
                 .add("direct", PersistentFieldDirectImpl.class)
-                .add("cglib", PersistentFieldCGLibImpl.class)
+                .add("cglib", "org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldCGLibImpl")
                 .add("privileged", PersistentFieldPrivilegedImpl.class)
                 .add("introspector", PersistentFieldIntrospectorImpl.class)
-                .add("dynabean", PersistentFieldDynaBeanImpl.class);
+                .add("dynabean", "org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDynaBeanImpl");
         addMapping(mapping);
 
         mapping = new Mapping(TransactionManagerFactory.class)
@@ -142,7 +140,8 @@
 
         mapping = new Mapping(ConnectionFactory.class)
                 .add("pooled", ConnectionFactoryPooledImpl.class)
-                .add("dbcp", ConnectionFactoryDBCPImpl.class)
+                // use class name to avoid dependencies to none standard OJB libraries
+                .add("dbcp", "org.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl")
                 .add("none", ConnectionFactoryNotPooledImpl.class)
                 .add("notpooled", ConnectionFactoryNotPooledImpl.class);
         addMapping(mapping);
@@ -390,13 +389,28 @@
 
         Mapping add(String shortcut, Class resolvedClass)
         {
-            shortcutMap.put(shortcut, resolvedClass);
+            shortcutMap.put(shortcut, resolvedClass.getName());
+            return this;
+        }
+
+        Mapping add(String shortcut, String resolvedClassName)
+        {
+            shortcutMap.put(shortcut, resolvedClassName);
             return this;
         }
 
         Class resolve(String shortcut)
         {
-            return (Class) shortcutMap.get(shortcut);
+            String name = (String) shortcutMap.get(shortcut);
+            try
+            {
+                return name != null ? ClassHelper.getClass(name) : null;
+            }
+            catch(ClassNotFoundException e)
+            {
+                throw new OJBRuntimeException("Can't resolve mapped class '" + name
+                        + "' for shortcut name '" + shortcut + "'", e);
+            }
         }
     }
 }



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