[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic ...
Manik Surtani
msurtani at jboss.com
Sat Dec 30 12:50:03 EST 2006
User: msurtani
Date: 06/12/30 12:50:03
Modified: src-50/org/jboss/cache/pojo/interceptors/dynamic
CacheFieldInterceptor.java
Log:
Major changes to restructure cache and node object model
Revision Changes Path
1.13 +22 -19 JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheFieldInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- CacheFieldInterceptor.java 27 Oct 2006 01:49:09 -0000 1.12
+++ CacheFieldInterceptor.java 30 Dec 2006 17:50:03 -0000 1.13
@@ -17,17 +17,16 @@
import org.jboss.aop.joinpoint.FieldWriteInvocation;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Fqn;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.pojo.memory.FieldPersistentReference;
-import org.jboss.cache.pojo.util.AopUtil;
-import org.jboss.cache.pojo.util.CacheApiUtil;
-import org.jboss.cache.pojo.PojoTreeCache;
+import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.CachedType;
-import org.jboss.cache.pojo.PojoInstance;
import org.jboss.cache.pojo.PojoCacheAlreadyDetachedException;
+import org.jboss.cache.pojo.PojoInstance;
import org.jboss.cache.pojo.PojoUtil;
import org.jboss.cache.pojo.impl.PojoCacheImpl;
+import org.jboss.cache.pojo.memory.FieldPersistentReference;
+import org.jboss.cache.pojo.util.AopUtil;
+import org.jboss.cache.pojo.util.CacheApiUtil;
import java.lang.reflect.Field;
import java.util.Iterator;
@@ -52,7 +51,7 @@
public CacheFieldInterceptor(PojoCacheImpl pCache, Fqn fqn, CachedType type)
{
this.pCache_ = pCache;
- cache_ = (CacheSPI)this.pCache_.getCache();
+ cache_ = (CacheSPI) this.pCache_.getCache();
this.fqn_ = fqn;
this.type_ = type;
util_ = new PojoUtil();
@@ -77,7 +76,7 @@
public void setInterceptor(Interceptor intcptr)
{
- CacheFieldInterceptor interceptor = (CacheFieldInterceptor)intcptr;
+ CacheFieldInterceptor interceptor = (CacheFieldInterceptor) intcptr;
setFqn(interceptor.getFqn());
setAopInstance(interceptor.getAopInstance());
}
@@ -99,7 +98,7 @@
public Object invoke(Invocation invocation) throws Throwable
{
// Kind of ad hoc now. MethodInvocation should not invoke this.
- if(invocation instanceof MethodInvocation)
+ if (invocation instanceof MethodInvocation)
return invocation.invokeNext();
// Check if CLASS_INTERNAL exists. If not, that means we are done. We need to remove ourself.
@@ -117,9 +116,9 @@
Advisor advisor = fieldInvocation.getAdvisor();
Field field = fieldInvocation.getField();
- if(log_.isTraceEnabled())
+ if (log_.isTraceEnabled())
{
- log_.trace("invoke(): field write interception for fqn: " +fqn_ + " and field: " +field);
+ log_.trace("invoke(): field write interception for fqn: " + fqn_ + " and field: " + field);
}
// Only if this field is replicatable. static, transient and final are not.
@@ -131,7 +130,8 @@
if (fieldType.isImmediate() || hasSerializableAnnotation(field, advisor, parentType))
{
cache_.put(fqn_, field.getName(), value);
- } else
+ }
+ else
{
//cache_.putObject(((Fqn)fqn_.clone()).add(field.getName()), value);
pCache_.attach(new Fqn(fqn_, field.getName()), value);
@@ -140,7 +140,8 @@
Object obj = fieldInvocation.getTargetObject();
util_.inMemorySubstitution(obj, field, value);
- } else if (invocation instanceof FieldReadInvocation)
+ }
+ else if (invocation instanceof FieldReadInvocation)
{
FieldInvocation fieldInvocation =
(FieldInvocation) invocation;
@@ -156,7 +157,8 @@
if (fieldType.isImmediate() || hasSerializableAnnotation(field, advisor, parentType))
{
result = cache_.get(fqn_, field.getName());
- } else
+ }
+ else
{
//result = cache_.getObject(((Fqn)fqn_.clone()).add(field.getName()));
result = pCache_.getObject(new Fqn(fqn_, field.getName()));
@@ -217,11 +219,11 @@
{
boolean detached = false;
- if(!CacheApiUtil.exists(cache_, fqn_, PojoInstance.KEY))
+ if (!CacheApiUtil.exists(cache_, fqn_, PojoInstance.KEY))
{
detached = true;
Object obj = invocation.getTargetObject();
- if (! (obj instanceof Advised))
+ if (!(obj instanceof Advised))
throw new RuntimeException("Interception on non-advised pojo " + obj.toString());
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
@@ -229,7 +231,7 @@
if (interceptor != null)
{
advisor.removeInterceptor(interceptor.getName());
- throw new PojoCacheAlreadyDetachedException("pojo: " +obj.getClass() +
+ throw new PojoCacheAlreadyDetachedException("pojo: " + obj.getClass() +
" has possibly been detached remotely. Internal id: " + interceptor.getFqn());
}
}
@@ -257,9 +259,10 @@
if (fieldType.isImmediate())
{
value = cache_.get(fqn_, field.getName());
- } else
+ }
+ else
{
- // value = removeObject(fqn_+TreeCache.SEPARATOR+field.getName());
+ // value = removeObject(fqn_+CacheImpl.SEPARATOR+field.getName());
//value = cache_.getObject(((Fqn)fqn_.clone()).add(field.getName()));
value = pCache_.getObject(new Fqn(fqn_, field.getName()));
}
More information about the jboss-cvs-commits
mailing list