[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo ...
Manik Surtani
msurtani at jboss.com
Sat Dec 30 21:08:40 EST 2006
User: msurtani
Date: 06/12/30 21:08:40
Modified: src-50/org/jboss/cache/pojo PojoReference.java
CachedType.java PojoUtil.java PojoInstance.java
Log:
Updates to tests to go along with changes in node methods
Revision Changes Path
1.5 +3 -2 JBossCache/src-50/org/jboss/cache/pojo/PojoReference.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoReference.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/PojoReference.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PojoReference.java 26 Sep 2006 10:25:16 -0000 1.4
+++ PojoReference.java 31 Dec 2006 02:08:40 -0000 1.5
@@ -10,13 +10,14 @@
import java.io.Serializable;
-/** POJO reference that contains the information to point to the real POJO storage.
+/**
+ * POJO reference that contains the information to point to the real POJO storage.
*
* @author Ben Wang
*/
public class PojoReference implements Serializable // Externalizable is no more efficient
{
-// protected static Log log=LogFactory.getLog(PojoReference.class.getName());
+ // protected static Log log=LogFactory.getLog(PojoReference.class.getLastElementAsString());
public static final Object KEY = "PojoReference";
static final long serialVersionUID = 6492134565825613209L;
// If not null, it signifies that this is a reference that points to this fqn.
1.7 +8 -7 JBossCache/src-50/org/jboss/cache/pojo/CachedType.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CachedType.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/CachedType.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- CachedType.java 8 Nov 2006 08:47:23 -0000 1.6
+++ CachedType.java 31 Dec 2006 02:08:40 -0000 1.7
@@ -2,9 +2,9 @@
import org.jboss.aop.Advisor;
import org.jboss.aop.joinpoint.FieldInvocation;
+import org.jboss.cache.pojo.interceptors.PojoBeginInterceptor;
import org.jboss.cache.pojo.memory.FieldPersistentReference;
import org.jboss.cache.pojo.memory.PersistentReference;
-import org.jboss.cache.pojo.interceptors.PojoBeginInterceptor;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
@@ -148,17 +148,17 @@
CachedAttribute attr = (CachedAttribute) i.next();
sb
.append("\t")
- .append(attr.getType().getName())
+ .append(attr.getType().getLastElementAsString())
.append(" ")
- .append(attr.getName())
+ .append(attr.getLastElementAsString())
.append(" [")
.append(attr.getGet() == null
? "<no get>"
- : attr.getGet().getName())
+ : attr.getGet().getLastElementAsString())
.append(", ")
.append(attr.getSet() == null
? "<no set>"
- : attr.getSet().getName())
+ : attr.getSet().getLastElementAsString())
.append("]\n");
}
*/
@@ -230,7 +230,8 @@
if (CachedClassWithNoAnnotation_.get(clazz) != null)
{
return false;
- } else if (CachedClassWithAnnotation_.get(clazz) != null)
+ }
+ else if (CachedClassWithAnnotation_.get(clazz) != null)
{
return true;
}
@@ -271,7 +272,7 @@
return true;
}
- if(!PojoBeginInterceptor.getReplicateFinalField() && Modifier.isFinal(mods))
+ if (!PojoBeginInterceptor.getReplicateFinalField() && Modifier.isFinal(mods))
{
return true;
}
1.15 +33 -30 JBossCache/src-50/org/jboss/cache/pojo/PojoUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoUtil.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/PojoUtil.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- PojoUtil.java 20 Nov 2006 23:32:49 -0000 1.14
+++ PojoUtil.java 31 Dec 2006 02:08:40 -0000 1.15
@@ -7,26 +7,27 @@
package org.jboss.cache.pojo;
-import org.jboss.aop.InstanceAdvisor;
-import org.jboss.aop.Domain;
import org.jboss.aop.Advised;
-import org.jboss.aop.pointcut.ast.ParseException;
-import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.Domain;
+import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.advice.AdviceBinding;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.pointcut.ast.ParseException;
+import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.annotation.TxUndo;
-import org.jboss.cache.pojo.observable.Observer;
-import org.jboss.cache.pojo.observable.Subject;
import org.jboss.cache.pojo.interceptors.dynamic.CacheFieldInterceptor;
import org.jboss.cache.pojo.interceptors.dynamic.ReentrancyStopperInterceptor;
-import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.observable.Observer;
+import org.jboss.cache.pojo.observable.Subject;
import java.lang.reflect.Field;
import java.util.List;
/**
* Utility class for method wrappers that we are interested to rollback (i.e., rollback).
+ *
* @author Ben Wang
- * @version $Id: PojoUtil.java,v 1.14 2006/11/20 23:32:49 genman Exp $
+ * @version $Id: PojoUtil.java,v 1.15 2006/12/31 02:08:40 msurtani Exp $
*/
public class PojoUtil
{
@@ -54,8 +55,8 @@
public void undoDetachInterceptor(InstanceAdvisor advisor, Interceptor interceptor, Observer observer)
{
- Object pojo = ((CacheFieldInterceptor)interceptor).getAopInstance().get();
- if(pojo == null)
+ Object pojo = ((CacheFieldInterceptor) interceptor).getAopInstance().get();
+ if (pojo == null)
{
throw new PojoCacheException("PojoUtil.detachInterceptor(): null pojo");
}
@@ -78,21 +79,21 @@
Observer observer)
{
// add the observer
- ((Subject)pojo).addObserver(observer);
+ ((Subject) pojo).addObserver(observer);
// Note that subject interceptor should come before the cache interceptor.
advisor.appendInterceptor(interceptor);
- if(checkRecursive)
+ if (checkRecursive)
{
// Insert interceptor to detect recursive call
Class clazz = pojo.getClass();
Field[] fields = clazz.getDeclaredFields();
String clazzName = clazz.getName();
- for(Field field: fields)
+ for (Field field : fields)
{
String name = field.getName();
- if(name.contains("$aop")) continue; // this is aop declared field.
+ if (name.contains("$aop")) continue; // this is aop declared field.
StringBuffer buf = new StringBuffer().append("set(* ").append(clazzName).append("->").
append(name).append(")");
@@ -100,11 +101,12 @@
try
{
binding = new AdviceBinding(BindingName + name, buf.toString(), null);
- } catch (ParseException e)
+ }
+ catch (ParseException e)
{
e.printStackTrace();
throw new PojoCacheException("PojoUtil._attachInterceptor(): can't parse the field binding: "
- +e);
+ + e);
}
binding.addInterceptor(ReentrancyStopperInterceptor.class);
getInstanceDomain(pojo).addBinding(binding);
@@ -114,7 +116,7 @@
private Domain getInstanceDomain(Object obj)
{
- Advised advised = ((Advised)obj);
+ Advised advised = ((Advised) obj);
InstanceAdvisor advisor = advised._getInstanceAdvisor();
return advisor.getDomain();
}
@@ -124,11 +126,12 @@
try
{
field.set(obj, newValue);
- } catch (IllegalAccessException e)
+ }
+ catch (IllegalAccessException e)
{
throw new PojoCacheException(
"PojoUtil.inMemorySubstitution(): Can't swap out the class of field \" " +
- "+field.getName()," + e);
+ "+field.getLastElementAsString()," + e);
}
}
@@ -136,25 +139,25 @@
{
advisor.removeInterceptor(interceptor.getName());
// retrieve pojo
- Object pojo = ((CacheFieldInterceptor)interceptor).getAopInstance().get();
+ Object pojo = ((CacheFieldInterceptor) interceptor).getAopInstance().get();
- if(pojo == null)
+ if (pojo == null)
{
throw new PojoCacheException("PojoUtil.detachInterceptor(): null pojo");
}
- ((Subject)pojo).removeObserver(observer);
+ ((Subject) pojo).removeObserver(observer);
- if(checkRecursive)
+ if (checkRecursive)
{
// Insert interceptor to detect recursive call
Class clazz = pojo.getClass();
Field[] fields = clazz.getDeclaredFields();
- for(Field field: fields)
+ for (Field field : fields)
{
String name = field.getName();
- if(name.contains("$aop")) continue; // this is aop declared field.
- getInstanceDomain(pojo).removeBinding(BindingName +name);
+ if (name.contains("$aop")) continue; // this is aop declared field.
+ getInstanceDomain(pojo).removeBinding(BindingName + name);
}
}
}
@@ -173,7 +176,7 @@
private int _incrementReferenceCount(Fqn sourceFqn, int count, List refList)
{
refList.add(sourceFqn);
- return count+1;
+ return count + 1;
}
@TxUndo
@@ -190,6 +193,6 @@
private int _decrementReferenceCount(Fqn sourceFqn, int count, List refList)
{
refList.remove(sourceFqn);
- return count-1;
+ return count - 1;
}
}
1.5 +10 -9 JBossCache/src-50/org/jboss/cache/pojo/PojoInstance.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoInstance.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/PojoInstance.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PojoInstance.java 20 Nov 2006 23:32:49 -0000 1.4
+++ PojoInstance.java 31 Dec 2006 02:08:40 -0000 1.5
@@ -12,7 +12,8 @@
import java.util.ArrayList;
import java.util.List;
-/** POJO class metadata information.
+/**
+ * POJO class metadata information.
* When an object is looked up or put in PojoCache, this object will be advised with a CacheFieldInterceptor.
* The underlying cache stores a reference to this object (for example to update the instance variables, etc.).
* Since this reference need to be transactional but never replicated (the reference is only valid
@@ -24,7 +25,7 @@
*/
public class PojoInstance implements Serializable // Externalizable is no more efficient
{
-// protected static Log log=LogFactory.getLog(PojoReference.class.getName());
+ // protected static Log log=LogFactory.getLog(PojoReference.class.getLastElementAsString());
public static final Object KEY = "PojoInstance";
public static final int INITIAL_COUNTER_VALUE = -1;
@@ -92,7 +93,7 @@
synchronized public int incrementRefCount(Fqn sourceFqn)
{
- if(sourceFqn == null)
+ if (sourceFqn == null)
{
throw new IllegalStateException("PojoInstance.incrementRefCount(): null sourceFqn");
}
@@ -106,7 +107,7 @@
throw new IllegalStateException("PojoReference.incrementRefCount(): source fqn: " +
sourceFqn + " is already present.");
- if(util_ == null) util_ = new PojoUtil();
+ if (util_ == null) util_ = new PojoUtil();
refCount_ = util_.incrementReferenceCount(sourceFqn, refCount_, referencedBy_);
// referencedBy_.add(sourceFqn);
@@ -117,7 +118,7 @@
synchronized public int decrementRefCount(Fqn sourceFqn)
{
- if(sourceFqn == null)
+ if (sourceFqn == null)
{
throw new IllegalStateException("PojoInstance.incrementRefCount(): null sourceFqn");
}
@@ -126,7 +127,7 @@
throw new IllegalStateException("PojoReference.decrementRefCount(): source fqn: " +
sourceFqn + " is not present.");
- if(util_ == null) util_ = new PojoUtil();
+ if (util_ == null) util_ = new PojoUtil();
refCount_ = util_.decrementReferenceCount(sourceFqn, refCount_, referencedBy_);
// referencedBy_.remove(sourceFqn);
More information about the jboss-cvs-commits
mailing list