From: Ben W. <bw...@jb...> - 2006-07-07 09:34:43
|
User: bwang Date: 06/07/07 05:34:41 Modified: src-50/org/jboss/cache/pojo/collection AbstractCollectionInterceptor.java CachedListInterceptor.java CachedMapInterceptor.java CachedSetInterceptor.java Log: Added undo interceptor stack. Revision Changes Path 1.4 +8 -1 JBossCache/src-50/org/jboss/cache/pojo/collection/AbstractCollectionInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: AbstractCollectionInterceptor.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/AbstractCollectionInterceptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- AbstractCollectionInterceptor.java 27 Jun 2006 06:19:16 -0000 1.3 +++ AbstractCollectionInterceptor.java 7 Jul 2006 09:34:41 -0000 1.4 @@ -15,7 +15,7 @@ * Abstract base class for collection interceptor. * * @author Ben Wang - * @version $Id: AbstractCollectionInterceptor.java,v 1.3 2006/06/27 06:19:16 bwang Exp $ + * @version $Id: AbstractCollectionInterceptor.java,v 1.4 2006/07/07 09:34:41 bwang Exp $ */ @SuppressWarnings({"CanBeFinal"}) public abstract class AbstractCollectionInterceptor implements BaseInterceptor @@ -71,4 +71,11 @@ { return attached_; } + + abstract void setInMemoryCopy(Object obj); + abstract Object getInMemoryCopy(); + abstract void setCacheCopy(Object obj); + abstract Object getCacheCopy(); + abstract void setCurrentCopy(Object obj); + abstract Object getCurrecntCopy(); } 1.4 +54 -0 JBossCache/src-50/org/jboss/cache/pojo/collection/CachedListInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: CachedListInterceptor.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/CachedListInterceptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- CachedListInterceptor.java 27 Jun 2006 06:19:16 -0000 1.3 +++ CachedListInterceptor.java 7 Jul 2006 09:34:41 -0000 1.4 @@ -8,6 +8,7 @@ import org.jboss.cache.Fqn; import org.jboss.cache.pojo.PojoTreeCache; +import org.jboss.aop.advice.Interceptor; import java.util.ArrayList; import java.util.List; @@ -44,6 +45,29 @@ current_ = cacheImpl_; } + public CachedListInterceptor() {} + + public Object clone() + { + CachedListInterceptor interceptor = new CachedListInterceptor(); + interceptor.setFqn(getFqn()); + interceptor.setAopInstance(getAopInstance()); + interceptor.setCurrentCopy(getCurrecntCopy()); + interceptor.setInMemoryCopy(getInMemoryCopy()); + interceptor.setCacheCopy(getCacheCopy()); + return interceptor; + } + + public void setInterceptor(Interceptor intcptr) + { + CachedListInterceptor interceptor = (CachedListInterceptor)intcptr; + setFqn(interceptor.getFqn()); + setAopInstance(interceptor.getAopInstance()); + setCurrentCopy(interceptor.getCurrecntCopy()); + setInMemoryCopy(interceptor.getInMemoryCopy()); + setCacheCopy(interceptor.getCacheCopy()); + } + /** * When we want to associate this proxy with the cache again. We will need to translate the in-memory * content to the cache store first. @@ -90,6 +114,36 @@ current_ = inMemImpl_; } + void setInMemoryCopy(Object obj) + { + inMemImpl_ = (List)obj; + } + + Object getInMemoryCopy() + { + return inMemImpl_; + } + + void setCacheCopy(Object obj) + { + cacheImpl_ = (List)obj; + } + + Object getCacheCopy() + { + return cacheImpl_; + } + + void setCurrentCopy(Object obj) + { + current_ = (List)obj; + } + + Object getCurrecntCopy() + { + return current_; + } + private void toMemory(boolean removeFromCache) { if (inMemImpl_ == null) 1.4 +54 -0 JBossCache/src-50/org/jboss/cache/pojo/collection/CachedMapInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: CachedMapInterceptor.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/CachedMapInterceptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- CachedMapInterceptor.java 27 Jun 2006 06:19:16 -0000 1.3 +++ CachedMapInterceptor.java 7 Jul 2006 09:34:41 -0000 1.4 @@ -8,6 +8,7 @@ import org.jboss.cache.Fqn; import org.jboss.cache.pojo.PojoTreeCache; +import org.jboss.aop.advice.Interceptor; import java.util.HashMap; import java.util.Iterator; @@ -39,6 +40,59 @@ current_ = cacheImpl_; } + CachedMapInterceptor() {} + + public Object clone() + { + CachedListInterceptor interceptor = new CachedListInterceptor(); + interceptor.setFqn(getFqn()); + interceptor.setAopInstance(getAopInstance()); + interceptor.setCurrentCopy(getCurrecntCopy()); + interceptor.setInMemoryCopy(getInMemoryCopy()); + interceptor.setCacheCopy(getCacheCopy()); + return interceptor; + } + + public void setInterceptor(Interceptor intcptr) + { + CachedListInterceptor interceptor = (CachedListInterceptor)intcptr; + setFqn(interceptor.getFqn()); + setAopInstance(interceptor.getAopInstance()); + setCurrentCopy(interceptor.getCurrecntCopy()); + setInMemoryCopy(interceptor.getInMemoryCopy()); + setCacheCopy(interceptor.getCacheCopy()); + } + + void setInMemoryCopy(Object obj) + { + inMemImpl_ = (Map)obj; + } + + Object getInMemoryCopy() + { + return inMemImpl_; + } + + void setCacheCopy(Object obj) + { + cacheImpl_ = (Map)obj; + } + + Object getCacheCopy() + { + return cacheImpl_; + } + + void setCurrentCopy(Object obj) + { + current_ = (Map)obj; + } + + Object getCurrecntCopy() + { + return current_; + } + /** * When we want to associate this proxy with the cache again. We will need to translate the in-memory * content to the cache store first. 1.4 +54 -0 JBossCache/src-50/org/jboss/cache/pojo/collection/CachedSetInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: CachedSetInterceptor.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/CachedSetInterceptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- CachedSetInterceptor.java 27 Jun 2006 06:19:16 -0000 1.3 +++ CachedSetInterceptor.java 7 Jul 2006 09:34:41 -0000 1.4 @@ -8,6 +8,7 @@ import org.jboss.cache.Fqn; import org.jboss.cache.pojo.PojoTreeCache; +import org.jboss.aop.advice.Interceptor; import java.util.HashSet; import java.util.Iterator; @@ -40,6 +41,59 @@ current_ = cacheImpl_; } + public CachedSetInterceptor() {} + + public Object clone() + { + CachedListInterceptor interceptor = new CachedListInterceptor(); + interceptor.setFqn(getFqn()); + interceptor.setAopInstance(getAopInstance()); + interceptor.setCurrentCopy(getCurrecntCopy()); + interceptor.setInMemoryCopy(getInMemoryCopy()); + interceptor.setCacheCopy(getCacheCopy()); + return interceptor; + } + + public void setInterceptor(Interceptor intcptr) + { + CachedListInterceptor interceptor = (CachedListInterceptor)intcptr; + setFqn(interceptor.getFqn()); + setAopInstance(interceptor.getAopInstance()); + setCurrentCopy(interceptor.getCurrecntCopy()); + setInMemoryCopy(interceptor.getInMemoryCopy()); + setCacheCopy(interceptor.getCacheCopy()); + } + + void setInMemoryCopy(Object obj) + { + inMemImpl_ = (Set)obj; + } + + Object getInMemoryCopy() + { + return inMemImpl_; + } + + void setCacheCopy(Object obj) + { + cacheImpl_ = (Set)obj; + } + + Object getCacheCopy() + { + return cacheImpl_; + } + + void setCurrentCopy(Object obj) + { + current_ = (Set)obj; + } + + Object getCurrecntCopy() + { + return current_; + } + /** * When we want to associate this proxy with the cache again. We will need to translate the in-memory * content to the cache store first. |