aclute 2005/08/12 06:49:21
Modified: src/java/org/apache/ojb/broker/core/proxy Tag:
OJB_1_0_RELEASE ProxyFactoryCGLIBImpl.java
ProxyFactoryJDKImpl.java ProxyHelper.java
ProxyFactory.java
src/java/org/apache/ojb/broker/cache Tag: OJB_1_0_RELEASE
ObjectCacheTwoLevelImpl.java
Log:
Additional attribute on ProxyFactory to signify whether a specific
implementation requires interface-backed objects. Useful for a sanity check in
TLCache when forceProxies is set.
Revision Changes Path
No revision
No revision
1.2.2.2 +6 -0
db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyFactoryCGLIBImpl.java
Index: ProxyFactoryCGLIBImpl.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyFactoryCGLIBImpl.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- ProxyFactoryCGLIBImpl.java 9 Aug 2005 20:03:21 -0000 1.2.2.1
+++ ProxyFactoryCGLIBImpl.java 12 Aug 2005 13:49:21 -0000 1.2.2.2
@@ -69,4 +69,10 @@
}
+ public boolean interfaceRequiredForProxyGeneration() {
+ return false;
+ }
+
+
+
}
1.2.2.2 +4 -0
db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyFactoryJDKImpl.java
Index: ProxyFactoryJDKImpl.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyFactoryJDKImpl.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- ProxyFactoryJDKImpl.java 9 Aug 2005 20:03:21 -0000 1.2.2.1
+++ ProxyFactoryJDKImpl.java 12 Aug 2005 13:49:21 -0000 1.2.2.2
@@ -132,5 +132,9 @@
return interfaces;
}
+
+ public boolean interfaceRequiredForProxyGeneration() {
+ return true;
+ }
}
1.2.2.4 +2 -2
db-ojb/src/java/org/apache/ojb/broker/core/proxy/Attic/ProxyHelper.java
Index: ProxyHelper.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/Attic/ProxyHelper.java,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -r1.2.2.3 -r1.2.2.4
--- ProxyHelper.java 10 Aug 2005 19:26:53 -0000 1.2.2.3
+++ ProxyHelper.java 12 Aug 2005 13:49:21 -0000 1.2.2.4
@@ -32,7 +32,7 @@
proxyFactoryRef = new SoftReference(getBroker().getProxyFactory());
}
- private static ProxyFactory getProxyFactory() {
+ public static ProxyFactory getProxyFactory() {
if (proxyFactoryRef.get() == null) {
proxyFactoryRef = new
SoftReference(getBroker().getProxyFactory());
}
1.1.2.2 +8 -1
db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java
Index: ProxyFactory.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ProxyFactory.java 9 Aug 2005 20:03:21 -0000 1.1.2.1
+++ ProxyFactory.java 12 Aug 2005 13:49:21 -0000 1.1.2.2
@@ -211,4 +211,11 @@
* @return The string representation
*/
public String toString(Object proxy);
+
+ /**
+ * Method that returns whether or not this ProxyFactory can generate
reference Proxies
+ * for classes regardless if they extend an interface or not.
+ *
+ */
+ boolean interfaceRequiredForProxyGeneration();
}
No revision
No revision
1.1.2.9 +9 -1
db-ojb/src/java/org/apache/ojb/broker/cache/Attic/ObjectCacheTwoLevelImpl.java
Index: ObjectCacheTwoLevelImpl.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/cache/Attic/ObjectCacheTwoLevelImpl.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- ObjectCacheTwoLevelImpl.java 10 Aug 2005 19:32:19 -0000 1.1.2.8
+++ ObjectCacheTwoLevelImpl.java 12 Aug 2005 13:49:21 -0000 1.1.2.9
@@ -166,6 +166,14 @@
String forceProxyValue = prop.getProperty(FORCE_PROXIES,
"false").trim();
forceProxies = Boolean.valueOf(forceProxyValue).booleanValue();
+ if (forceProxies &&
ProxyHelper.getProxyFactory().interfaceRequiredForProxyGeneration()){
+ log.warn("'" + FORCE_PROXIES + "' is set to true, however a
ProxyFactory implementation " +
+ "[" + ProxyHelper.getProxyFactory().getClass().getName()
+"] " +
+ " that requires persistent objects to implement an
inteface is being used. Please ensure " +
+ "that all persistent objects implement an interface, or
change the ProxyFactory setting to a dynamic " +
+ "proxy generator (like ProxyFactoryCGLIBImpl).");
+ }
+
Class[] type = new Class[]{PersistenceBroker.class,
Properties.class};
Object[] objects = new Object[]{broker, prop};
try
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]