public static Object makeVersioned(Object target) throws Exception { if (target instanceof ClassProxy) throw new IllegalStateException("A ClassProxy is not allowed to be Versioned. You must have a concrete object"); ClassProxy proxy = ClassProxyFactory.newInstance(target.getClass()); VersionedObject versioned = new VersionedObject(target); proxy._getInstanceAdvisor().getMetaData().addMetaData(VERSIONED, VERSIONED_OBJECT, versioned, PayloadKey.TRANSIENT); proxy._getInstanceAdvisor().appendInterceptor(VersionedObjectInterceptorFactory.getInstance()); proxy._getInstanceAdvisor().appendInterceptor(new VersionedObjectForwardingInterceptor()); return proxy; }
public List makeVersionedList(List list, ArrayList newObjects) throws Exception { ClassProxy proxy = ClassProxyFactory.newInstance(list.getClass()); GUID guid = tag(proxy); DistributedListState manager = new DistributedListState(guid, timeout, proxy, list, this, synchManager); StateManager.setStateManager(proxy, manager); CollectionStateChangeInterceptor interceptor = new CollectionStateChangeInterceptor(manager); proxy._getInstanceAdvisor().appendInterceptor(interceptor); newObjects.add(manager); return (List)proxy; }
public Map makeVersionedMap(Map map, ArrayList newObjects) throws Exception { ClassProxy proxy = ClassProxyFactory.newInstance(map.getClass()); GUID guid = tag(proxy); DistributedMapState manager = new DistributedMapState(guid, timeout, proxy, map, this, synchManager); StateManager.setStateManager(proxy, manager); CollectionStateChangeInterceptor interceptor = new CollectionStateChangeInterceptor(manager); proxy._getInstanceAdvisor().appendInterceptor(interceptor); newObjects.add(manager); return (Map)proxy; }
public Set makeVersionedSet(Set set, ArrayList newObjects) throws Exception { ClassProxy proxy = ClassProxyFactory.newInstance(set.getClass()); GUID guid = tag(proxy); DistributedSetState manager = new DistributedSetState(guid, timeout, proxy, set, this, synchManager); StateManager.setStateManager(proxy, manager); CollectionStateChangeInterceptor interceptor = new CollectionStateChangeInterceptor(manager); proxy._getInstanceAdvisor().appendInterceptor(interceptor); newObjects.add(manager); return (Set)proxy; }
/** * This is used by DistributedState.buildObject when the DistributedState object is * serialized across the wire and must recreate the object it represents */ public ClassProxy addListVersioning(List list, DistributedListState manager) throws Exception { ClassProxy proxy = ClassProxyFactory.newInstance(list.getClass()); GUID guid = manager.getGUID(); org.jboss.aop.metadata.SimpleMetaData metaData = proxy._getInstanceAdvisor().getMetaData(); metaData.addMetaData(VERSION_MANAGER, VERSION_ID, guid); StateManager.setStateManager(proxy, manager); CollectionStateChangeInterceptor interceptor = new CollectionStateChangeInterceptor(manager); proxy._getInstanceAdvisor().appendInterceptor(interceptor); return proxy; }
/** * This is used by DistributedState.buildObject when the DistributedState object is * serialized across the wire and must recreate the object it represents */ public ClassProxy addMapVersioning(Map map, DistributedMapState manager) throws Exception { ClassProxy proxy = ClassProxyFactory.newInstance(map.getClass()); GUID guid = manager.getGUID(); org.jboss.aop.metadata.SimpleMetaData metaData = proxy._getInstanceAdvisor().getMetaData(); metaData.addMetaData(VERSION_MANAGER, VERSION_ID, guid); StateManager.setStateManager(proxy, manager); CollectionStateChangeInterceptor interceptor = new CollectionStateChangeInterceptor(manager); proxy._getInstanceAdvisor().appendInterceptor(interceptor); return proxy; }
/** * This is used by DistributedState.buildObject when the DistributedState object is * serialized across the wire and must recreate the object it represents */ public ClassProxy addSetVersioning(Set set, DistributedSetState manager) throws Exception { ClassProxy proxy = ClassProxyFactory.newInstance(set.getClass()); GUID guid = manager.getGUID(); org.jboss.aop.metadata.SimpleMetaData metaData = proxy._getInstanceAdvisor().getMetaData(); metaData.addMetaData(VERSION_MANAGER, VERSION_ID, guid); StateManager.setStateManager(proxy, manager); CollectionStateChangeInterceptor interceptor = new CollectionStateChangeInterceptor(manager); proxy._getInstanceAdvisor().appendInterceptor(interceptor); return proxy; } }
/** * This is used by DistributedState.buildObject when the DistributedState object is * serialized across the wire and must recreate the object it represents */ public void addVersioning(DistributedPOJOState manager, Advised advised) { StateManager.setStateManager(advised, manager); StateChangeInterceptor interceptor = new StateChangeInterceptor(manager); org.jboss.aop.metadata.SimpleMetaData metaData = advised._getInstanceAdvisor().getMetaData(); metaData.addMetaData(VERSION_MANAGER, VERSION_ID, manager.getGUID()); advised._getInstanceAdvisor().appendInterceptor(interceptor); }
StateChangeInterceptor interceptor = new StateChangeInterceptor(manager); manager.acquireWriteLock(); advised._getInstanceAdvisor().appendInterceptor(interceptor); try