[jbosscache-commits] JBoss Cache SVN: r6891 - in core/branches/flat/src: main/docbook/userguide/en/modules and 38 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Oct 8 14:56:44 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-10-08 14:56:43 -0400 (Wed, 08 Oct 2008)
New Revision: 6891
Added:
core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
core/branches/flat/src/main/java/org/jboss/cache/Cache_Legacy.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/NullComponentFactory.java
core/branches/flat/src/main/java/org/jboss/starobrno/manager/
core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifier/NotifierImpl.java
core/branches/flat/src/test/java/org/jboss/starobrno/
core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java
Removed:
core/branches/flat/src/main/java/org/jboss/cache/factories/
core/branches/flat/src/main/java/org/jboss/starobrno/CacheImpl.java
core/branches/flat/src/main/java/org/jboss/starobrno/CacheManager.java
Modified:
core/branches/flat/src/main/docbook/faq/en/master.xml
core/branches/flat/src/main/docbook/userguide/en/modules/deployment.xml
core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java
core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java
core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java
core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java
core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/branches/flat/src/main/java/org/jboss/cache/Fqn.java
core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java
core/branches/flat/src/main/java/org/jboss/cache/Node.java
core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java
core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/Region.java
core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java
core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/TreeCacheViewMBean.java
core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java
core/branches/flat/src/main/java/org/jboss/cache/Version.java
core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServerMBean.java
core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/CacheListener.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/NodeMoved.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/event/Event.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/event/EventImpl.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/flat/src/main/java/org/jboss/cache/util/CachePrinter.java
core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java
core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java
core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java
core/branches/flat/src/main/java/org/jboss/starobrno/CacheException.java
core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java
core/branches/flat/src/main/java/org/jboss/starobrno/ReplicationException.java
core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/config/Configuration.java
core/branches/flat/src/main/java/org/jboss/starobrno/config/ConfigurationComponent.java
core/branches/flat/src/main/java/org/jboss/starobrno/context/TransactionContext.java
core/branches/flat/src/main/java/org/jboss/starobrno/eviction/BaseEvictionAlgorithm.java
core/branches/flat/src/main/java/org/jboss/starobrno/eviction/DefaultEvictionActionPolicy.java
core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionActionPolicy.java
core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionAlgorithm.java
core/branches/flat/src/main/java/org/jboss/starobrno/eviction/NullEvictionAlgorithm.java
core/branches/flat/src/main/java/org/jboss/starobrno/eviction/RemoveOnEvictActionPolicy.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/BootstrapFactory.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/ComponentRegistry.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/InterceptorChainFactory.java
core/branches/flat/src/main/java/org/jboss/starobrno/factories/annotations/NonVolatile.java
core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/base/CommandInterceptor.java
core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifier/Notifier.java
core/branches/flat/src/test/resources/log4j.xml
Log:
Tried to get a basic test working
Modified: core/branches/flat/src/main/docbook/faq/en/master.xml
===================================================================
--- core/branches/flat/src/main/docbook/faq/en/master.xml 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/docbook/faq/en/master.xml 2008-10-08 18:56:43 UTC (rev 6891)
@@ -90,7 +90,7 @@
<para>JBoss Cache comes in two flavours: Core and Pojo versions. The core library
(using the
- <literal>org.jboss.cache.Cache</literal>
+ <literal>org.jboss.cache.Cache_Legacy</literal>
interface
) is the underlying library that organises data in a tree-like structure and handles all locking,
passivation,
@@ -613,7 +613,7 @@
and
<literal>IsolationLevel</literal>
), do I simply need to create multiple
- <literal>org.jboss.cache.Cache</literal>
+ <literal>org.jboss.cache.Cache_Legacy</literal>
instances with the appropriate configuration?
</para>
</question>
@@ -621,7 +621,7 @@
<answer>
<para>Yes. All the above mentioned properties are per cache
instance. Therefore you will need separate
- <literal>org.jboss.cache.Cache</literal>
+ <literal>org.jboss.cache.Cache_Legacy</literal>
instances.
</para>
</answer>
@@ -630,7 +630,7 @@
<qandaentry>
<question>
<para>Isn't this expensive from a networking standpoint, i.e., needing to create sockets for each
- <literal>org.jboss.cache.Cache</literal>
+ <literal>org.jboss.cache.Cache_Legacy</literal>
instance?
</para>
</question>
@@ -1133,7 +1133,7 @@
or extend
<literal>org.jboss.cache.AbstractCacheListener</literal>
and override for the events you are interested in. You can then register the listener using the
- <literal>org.jboss.cache.Cache.addCacheListener()</literal>
+ <literal>org.jboss.cache.Cache_Legacy.addCacheListener()</literal>
API.
</para>
</answer>
Modified: core/branches/flat/src/main/docbook/userguide/en/modules/deployment.xml
===================================================================
--- core/branches/flat/src/main/docbook/userguide/en/modules/deployment.xml 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/docbook/userguide/en/modules/deployment.xml 2008-10-08 18:56:43 UTC (rev 6891)
@@ -167,13 +167,13 @@
beans that make up a POJO service.
</para>
<para>
- For each configurable option exposed by the
- <literal>Configuration</literal>
- components, a getter/setter must be defined in the configuration class.
- This is required so that JBoss Microcontainer can, in typical IOC way,
- call these methods when the corresponding properties have been
+ For each configurable option exposed by the
+ <literal>Configuration</literal>
+ components, a getter/setter must be defined in the configuration class.
+ This is required so that JBoss Microcontainer can, in typical IOC way,
+ call these methods when the corresponding properties have been
configured.
- </para>
+ </para>
<para>
The rules for how to deploy the file, how to package it, how to
ensure the required jars are on the classpath, etc. are the same
@@ -194,111 +194,111 @@
<programlisting role="XML"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!-- First we create a Configuration object for the cache -->
- <bean name="ExampleCacheConfig"
- class="org.jboss.cache.config.Configuration">
-
- <!-- Externally injected services -->
- <property name="runtimeConfig">
- <bean name="ExampleCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
- <property name="transactionManager">
- <inject bean="jboss:service=TransactionManager"
- property="TransactionManager"/>
+ <!-- First we create a Configuration object for the cache -->
+ <bean name="ExampleCacheConfig"
+ class="org.jboss.cache.config.Configuration">
+
+ <!-- Externally injected services -->
+ <property name="runtimeConfig">
+ <bean name="ExampleCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
+ <property name="transactionManager">
+ <inject bean="jboss:service=TransactionManager"
+ property="TransactionManager"/>
+ </property>
+ <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
+ </bean>
</property>
- <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
- </bean>
- </property>
-
- <property name="multiplexerStack">udp</property>
- <property name="clusterName">Example-EntityCache</property>
-
- <!--
- Node locking level : SERIALIZABLE
- REPEATABLE_READ (default)
- READ_COMMITTED
- READ_UNCOMMITTED
- NONE
- -->
- <property name="isolationLevel">REPEATABLE_READ</property>
+ <property name="multiplexerStack">udp</property>
- <!-- Valid modes are LOCAL
- REPL_ASYNC
- REPL_SYNC
- -->
- <property name="cacheMode">REPL_SYNC</property>
+ <property name="clusterName">Example-EntityCache</property>
- <!-- The max amount of time (in milliseconds) we wait until the
- initial state (ie. the contents of the cache) are retrieved from
- existing members in a clustered environment
- -->
- <property name="initialStateRetrievalTimeout">15000</property>
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <property name="isolationLevel">REPEATABLE_READ</property>
- <!-- Number of milliseconds to wait until all responses for a
- synchronous call have been received.
- -->
- <property name="syncReplTimeout">20000</property>
+ <!-- Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <property name="cacheMode">REPL_SYNC</property>
- <!-- Max number of milliseconds to wait for a lock acquisition -->
- <property name="lockAcquisitionTimeout">15000</property>
-
- <property name="exposeManagementStatistics">true</property>
-
- <!-- Must be true if any entity deployment uses a scoped classloader -->
- <property name="useRegionBasedMarshalling">true</property>
- <!-- Must match the value of "useRegionBasedMarshalling" -->
- <property name="inactiveOnStartup">true</property>
+ <!-- The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <property name="initialStateRetrievalTimeout">15000</property>
- <!-- Specific eviction policy configurations. This is LRU -->
- <property name="evictionConfig">
- <bean name="ExampleEvictionConfig"
- class="org.jboss.cache.config.EvictionConfig">
- <property name="defaultEvictionPolicyClass">
- org.jboss.cache.eviction.LRUPolicy
- </property>
- <property name="wakeupIntervalSeconds">5</property>
- <property name="evictionRegionConfigs">
- <list>
- <bean name="ExampleDefaultEvictionRegionConfig"
- class="org.jboss.cache.config.EvictionRegionConfig">
- <property name="regionName">/_default_</property>
- <property name="evictionPolicyConfig">
- <bean name="ExampleDefaultLRUConfig"
- class="org.jboss.cache.eviction.LRUConfiguration">
- <property name="maxNodes">5000</property>
- <property name="timeToLiveSeconds">1000</property>
+ <!-- Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <property name="syncReplTimeout">20000</property>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <property name="lockAcquisitionTimeout">15000</property>
+
+ <property name="exposeManagementStatistics">true</property>
+
+ <!-- Must be true if any entity deployment uses a scoped classloader -->
+ <property name="useRegionBasedMarshalling">true</property>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <property name="inactiveOnStartup">true</property>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <property name="evictionConfig">
+ <bean name="ExampleEvictionConfig"
+ class="org.jboss.cache.config.EvictionConfig">
+ <property name="defaultEvictionPolicyClass">
+ org.jboss.cache.eviction.LRUPolicy
+ </property>
+ <property name="wakeupIntervalSeconds">5</property>
+ <property name="evictionRegionConfigs">
+ <list>
+ <bean name="ExampleDefaultEvictionRegionConfig"
+ class="org.jboss.cache.config.EvictionRegionConfig">
+ <property name="regionName">/_default_</property>
+ <property name="evictionPolicyConfig">
+ <bean name="ExampleDefaultLRUConfig"
+ class="org.jboss.cache.eviction.LRUConfiguration">
+ <property name="maxNodes">5000</property>
+ <property name="timeToLiveSeconds">1000</property>
+ </bean>
+ </property>
</bean>
- </property>
- </bean>
- </list>
+ </list>
+ </property>
+ </bean>
</property>
+
</bean>
- </property>
-
- </bean>
-
- <!-- Factory to build the Cache. -->
- <bean name="DefaultCacheFactory" class="org.jboss.cache.DefaultCacheFactory">
- <constructor factoryClass="org.jboss.cache.DefaultCacheFactory"
- factoryMethod="getInstance"/>
- </bean>
-
- <!-- The cache itself -->
- <bean name="ExampleCache" class="org.jboss.cache.Cache">
-
- <constructor factoryMethod="createCache">
- <factory bean="DefaultCacheFactory"/>
- <parameter class="org.jboss.cache.config.Configuration"><inject bean="ExampleCacheConfig"/></parameter>
- <parameter class="boolean">false</false>
- </constructor>
-
- </bean>
-</deployment>
-]]></programlisting>
+ <!-- Factory to build the Cache. -->
+ <bean name="DefaultCacheFactory" class="org.jboss.cache.DefaultCacheFactory">
+ <constructor factoryClass="org.jboss.cache.DefaultCacheFactory"
+ factoryMethod="getInstance"/>
+ </bean>
+ <!-- The cache itself -->
+ <bean name="ExampleCache" class="org.jboss.cache.Cache_Legacy">
+
+ <constructor factoryMethod="createCache">
+ <factory bean="DefaultCacheFactory"/>
+ <parameter class="org.jboss.cache.config.Configuration"><inject bean="ExampleCacheConfig"/></parameter>
+ <parameter class="boolean">false</false>
+ </constructor>
+
+ </bean>
+
+ </deployment>
+ ]]></programlisting>
+
<para>
See the JBoss Microcontainer documentation
<footnote>
Modified: core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,24 +22,24 @@
package org.jboss.cache;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.invocation.NodeInvocationDelegate;
import org.jboss.cache.mvcc.ReadCommittedNode;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import java.util.Map;
/**
- * Generates new nodes based on the {@link CacheSPI} configuration.
+ * Generates new nodes based on the {@link CacheSPI_Legacy} configuration.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
*/
public abstract class AbstractNodeFactory<K, V> implements NodeFactory<K, V>
{
- protected CacheSPI<K, V> cache;
+ protected CacheSPI_Legacy<K, V> cache;
protected boolean useVersionedNode;
protected Configuration configuration;
protected InvocationContextContainer invocationContextContainer;
@@ -57,7 +57,7 @@
}
@Inject
- public void injectDependencies(CacheSPI<K, V> cache, Configuration configuration,
+ public void injectDependencies(CacheSPI_Legacy<K, V> cache, Configuration configuration,
InvocationContextContainer invocationContextContainer,
InterceptorChain interceptorChain, CommandsFactory commandsFactory)
{
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -46,7 +46,7 @@
* In addition, methods provide anadditional option to create and return a cache without starting it.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @see org.jboss.cache.Cache
+ * @see Cache_Legacy
* @see org.jboss.cache.DefaultCacheFactory
* @since 2.0.0
*/
@@ -54,24 +54,24 @@
public interface CacheFactory<K, V>
{
/**
- * Creates and starts a {@link Cache} instance using default configuration settings. See {@link Configuration} for default values.
+ * Creates and starts a {@link Cache_Legacy} instance using default configuration settings. See {@link Configuration} for default values.
*
* @return a cache
* @throws ConfigurationException if there are problems with the default configuration
*/
- Cache<K, V> createCache() throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache() throws ConfigurationException;
/**
- * Creates and optionally starts a {@link Cache} instance using default configuration settings. See {@link Configuration} for default values.
+ * Creates and optionally starts a {@link Cache_Legacy} instance using default configuration settings. See {@link Configuration} for default values.
*
* @param start if true, starts the cache
* @return a cache
* @throws ConfigurationException if there are problems with the default configuration
*/
- Cache<K, V> createCache(boolean start) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(boolean start) throws ConfigurationException;
/**
- * Creates and starts a {@link org.jboss.cache.Cache} instance. The following are all valid calls:
+ * Creates and starts a {@link Cache_Legacy} instance. The following are all valid calls:
* <pre>
* factory.createCache("myCacheService.xml"); // file is in class path
* factory.createCache("etc/myCacheService.xml"); // file is in etc/ relative to the directory you started the JVM
@@ -79,75 +79,75 @@
* </pre>
*
* @param configFileName the named XML file should exist in the classpath or should be a fully qualified or relative (to your JVM working directory) path to a file on the local file system. Note that the classpath is checked first for the existence of this file.
- * @return a running {@link org.jboss.cache.Cache} instance
+ * @return a running {@link Cache_Legacy} instance
* @throws org.jboss.cache.config.ConfigurationException
* if there are problems with the configuration
*/
- Cache<K, V> createCache(String configFileName) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(String configFileName) throws ConfigurationException;
/**
- * Creates {@link Cache} instance, and optionally starts it.
+ * Creates {@link Cache_Legacy} instance, and optionally starts it.
*
* @param configFileName the named XML file should exist in the classpath or should be a fully qualified or relative (to your JVM working directory) path to a file on the local file system. Note that the classpath is checked first for the existence of this file.
* @param start if true, the cache is started before returning.
- * @return an optionally running {@link Cache} instance
+ * @return an optionally running {@link Cache_Legacy} instance
* @throws org.jboss.cache.config.ConfigurationException
* if there are problems with the configuration
* @see #createCache(String) for examples on valid config file names.
*/
- Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException;
/**
- * Creates a {@link Cache} instance based on a {@link org.jboss.cache.config.Configuration} passed in.
+ * Creates a {@link Cache_Legacy} instance based on a {@link org.jboss.cache.config.Configuration} passed in.
* <p/>
* Ensure that the Configuration you pass in is not used by another cache instance in the same JVM,
* as it may be concurrently modified. Clone the configuration, if shared, using
* {@link org.jboss.cache.config.Configuration#clone()}.
*
- * @param configuration the {@link Configuration} object that is passed in to setCache the {@link Cache}.
- * @return a running {@link Cache} instance
+ * @param configuration the {@link Configuration} object that is passed in to setCache the {@link Cache_Legacy}.
+ * @return a running {@link Cache_Legacy} instance
* @throws org.jboss.cache.config.ConfigurationException
* if there are problems with the configuration
*/
- Cache<K, V> createCache(Configuration configuration) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(Configuration configuration) throws ConfigurationException;
/**
- * Creates {@link Cache} instance, and optionally starts it, based on a {@link org.jboss.cache.config.Configuration} passed in.
+ * Creates {@link Cache_Legacy} instance, and optionally starts it, based on a {@link org.jboss.cache.config.Configuration} passed in.
* <p/>
* Ensure that the Configuration you pass in is not used by another cache instance in the same JVM,
* as it may be concurrently modified. Clone the configuration, if shared, using
* {@link org.jboss.cache.config.Configuration#clone()}.
*
- * @param configuration the {@link Configuration} object that is passed in to setCache the {@link Cache}.
+ * @param configuration the {@link Configuration} object that is passed in to setCache the {@link Cache_Legacy}.
* @param start if true, the cache is started before returning.
- * @return an optionally running {@link Cache} instance
+ * @return an optionally running {@link Cache_Legacy} instance
* @throws org.jboss.cache.config.ConfigurationException
* if there are problems with the configuration
*/
- Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException;
/**
- * Creates a {@link Cache} instance based on an {@link java.io.InputStream} passed in, which should be a stream to a valid
+ * Creates a {@link Cache_Legacy} instance based on an {@link java.io.InputStream} passed in, which should be a stream to a valid
* XML configuration file.
*
* @param is the {@link java.io.InputStream}
- * @return a running {@link Cache} instance
+ * @return a running {@link Cache_Legacy} instance
* @throws org.jboss.cache.config.ConfigurationException
* if there are problems with the configuration
* @since 2.1.0
*/
- Cache<K, V> createCache(InputStream is) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(InputStream is) throws ConfigurationException;
/**
- * Creates a {@link Cache} instance based on an {@link java.io.InputStream} passed in, which should be a stream to a valid
+ * Creates a {@link Cache_Legacy} instance based on an {@link java.io.InputStream} passed in, which should be a stream to a valid
* XML configuration file.
*
* @param is the {@link java.io.InputStream}
* @param start if true, the cache is started before returning.
- * @return a running {@link Cache} instance
+ * @return a running {@link Cache_Legacy} instance
* @throws org.jboss.cache.config.ConfigurationException
* if there are problems with the configuration
* @since 2.1.0
*/
- Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException;
+ org.jboss.starobrno.Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -66,9 +66,9 @@
* optionally instantiating the cache if it hasn't already been
* instantiated.
* <p>
- * The caller is free to invoke the {@link Cache#create()} and
- * {@link Cache#start()} lifecycle methods on the returned cache, but
- * the @link Cache#stop()} and {@link Cache#destroy()} methods should not
+ * The caller is free to invoke the {@link Cache_Legacy#create()} and
+ * {@link Cache_Legacy#start()} lifecycle methods on the returned cache, but
+ * the @link Cache#stop()} and {@link Cache_Legacy#destroy()} methods should not
* be invoked, since it is quite possible other users are still using the
* cache. Use {@link #releaseCache(String)} to notify this
* registry that the caller is no longer using a cache; let the registry
@@ -92,7 +92,7 @@
* does not include <code>configName</code>
* @throws Exception if there is a problem instantiating the cache
*/
- Cache<Object, Object> getCache(String configName, boolean create) throws Exception;
+ Cache_Legacy<Object, Object> getCache(String configName, boolean create) throws Exception;
/**
* Notifies the registry that the caller is no longer using the given
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -44,7 +44,7 @@
private boolean configRegistryInjected;
- private final Map<String, Cache<Object, Object>> caches = new HashMap<String, Cache<Object, Object>>();
+ private final Map<String, Cache_Legacy<Object, Object>> caches = new HashMap<String, Cache_Legacy<Object, Object>>();
private final Map<String, Integer> checkouts = new HashMap<String, Integer>();
@@ -107,9 +107,9 @@
}
}
- public Cache<Object, Object> getCache(String configName, boolean create) throws Exception
+ public Cache_Legacy<Object, Object> getCache(String configName, boolean create) throws Exception
{
- Cache<Object, Object> cache;
+ Cache_Legacy<Object, Object> cache;
synchronized (caches)
{
cache = caches.get(configName);
@@ -140,9 +140,10 @@
* @param config the Configuration for the cache
* @return the Cache
*/
- protected Cache<Object, Object> createCache(Configuration config)
+ protected Cache_Legacy<Object, Object> createCache(Configuration config)
{
- return new DefaultCacheFactory<Object, Object>().createCache(config, false);
+// return new DefaultCacheFactory<Object, Object>().createCache(config, false);
+ return null;
}
public void releaseCache(String configName)
@@ -153,7 +154,7 @@
throw new IllegalStateException(configName + " not registered");
if (decrementCheckout(configName) == 0)
{
- Cache<Object, Object> cache = caches.remove(configName);
+ Cache_Legacy<Object, Object> cache = caches.remove(configName);
destroyCache(cache);
}
}
@@ -177,7 +178,7 @@
this.channelFactory = channelFactory;
}
- public void registerCache(Cache<Object, Object> cache, String configName)
+ public void registerCache(Cache_Legacy<Object, Object> cache, String configName)
{
synchronized (caches)
{
@@ -212,9 +213,9 @@
{
synchronized (caches)
{
- for (Iterator<Map.Entry<String, Cache<Object, Object>>> it = caches.entrySet().iterator(); it.hasNext();)
+ for (Iterator<Map.Entry<String, Cache_Legacy<Object, Object>>> it = caches.entrySet().iterator(); it.hasNext();)
{
- Map.Entry<String, Cache<Object, Object>> entry = it.next();
+ Map.Entry<String, Cache_Legacy<Object, Object>> entry = it.next();
destroyCache(entry.getValue());
it.remove();
}
@@ -260,7 +261,7 @@
}
}
- private void destroyCache(Cache<Object, Object> cache)
+ private void destroyCache(Cache_Legacy<Object, Object> cache)
{
if (cache.getCacheStatus() == CacheStatus.STARTED)
{
Copied: core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java (from rev 6890, core/branches/flat/src/main/java/org/jboss/cache/CacheSPI.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -0,0 +1,354 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cache;
+
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.buddyreplication.GravitateResult;
+import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.loader.CacheLoader;
+import org.jboss.cache.loader.CacheLoaderManager;
+import org.jboss.cache.marshall.Marshaller;
+import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.factories.ComponentRegistry;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A more detailed interface to {@link Cache_Legacy}, which is used when writing plugins for or extending JBoss Cache. A reference
+ * to this interface should only be obtained when it is passed in to your code, for example when you write an
+ * {@link org.jboss.cache.interceptors.base.CommandInterceptor} or {@link CacheLoader}.
+ * <p/>
+ * <B><I>You should NEVER attempt to directly cast a {@link Cache_Legacy} instance to this interface. In future, the implementation may not allow it.</I></B>
+ * <p/>
+ * This interface contains overridden method signatures of some methods from {@link Cache_Legacy}, overridden to ensure return
+ * types of {@link Node} are replaced with {@link NodeSPI}.
+ * <p/>
+ *
+ * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
+ * @see NodeSPI
+ * @see Cache_Legacy
+ * @see org.jboss.cache.loader.CacheLoader
+ * @since 2.0.0
+ */
+ at ThreadSafe
+public interface CacheSPI_Legacy<K, V> extends Cache_Legacy<K, V>
+{
+ /**
+ * Overrides {@link Cache_Legacy#getRoot()} to return a {@link org.jboss.cache.NodeSPI} instead of a {@link org.jboss.cache.Node}.
+ */
+ NodeSPI<K, V> getRoot();
+
+ /**
+ * Overrides {@link Cache_Legacy#getNode(String)} to return a {@link org.jboss.cache.NodeSPI} instead of a {@link org.jboss.cache.Node}.
+ *
+ * @param s string representation of an Fqn
+ * @return a NodeSPI
+ */
+ NodeSPI<K, V> getNode(String s);
+
+ /**
+ * Overrides {@link Cache_Legacy#getNode(Fqn)} to return a {@link org.jboss.cache.NodeSPI} instead of a {@link org.jboss.cache.Node}.
+ *
+ * @param f an Fqn
+ * @return a NodeSPI
+ */
+ NodeSPI<K, V> getNode(Fqn f);
+
+
+ /**
+ * Retrieves a reference to a running {@link javax.transaction.TransactionManager}, if one is configured.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return a TransactionManager
+ */
+ TransactionManager getTransactionManager();
+
+ /**
+ * Retrieves the current Interceptor chain.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return an immutable {@link List} of {@link org.jboss.cache.interceptors.base.CommandInterceptor}s configured for this cache, or
+ * <code>null</code> if {@link Cache_Legacy#create() create()} has not been invoked
+ * and the interceptors thus do not exist.
+ */
+ List<CommandInterceptor> getInterceptorChain();
+
+ /**
+ * Retrieves an instance of a {@link Marshaller}, which is capable of
+ * converting Java objects to bytestreams and back in an efficient manner, which is
+ * also interoperable with bytestreams produced/consumed by other versions of JBoss
+ * Cache.
+ * <p/>
+ * The use of this marshaller is the <b>recommended</b> way of creating efficient,
+ * compatible, byte streams from objects.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return an instance of {@link Marshaller}
+ */
+ Marshaller getMarshaller();
+
+ /**
+ * Adds a custom interceptor to the interceptor chain, at specified position, where the first interceptor in the chain
+ * is at position 0 and the last one at getInterceptorChain().size() - 1.
+ *
+ * @param i the interceptor to add
+ * @param position the position to add the interceptor
+ */
+ void addInterceptor(CommandInterceptor i, int position);
+
+ /**
+ * Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type. Throws a
+ * cache exception if it cannot find an interceptor of the specified type.
+ *
+ * @param i interceptor to add
+ * @param afterInterceptor interceptor type after which to place custom interceptor
+ */
+ void addInterceptor(CommandInterceptor i, Class<? extends CommandInterceptor> afterInterceptor);
+
+ /**
+ * Removes the interceptor at a specified position, where the first interceptor in the chain
+ * is at position 0 and the last one at getInterceptorChain().size() - 1.
+ *
+ * @param position the position at which to remove an interceptor
+ */
+ void removeInterceptor(int position);
+
+ /**
+ * Removes the interceptor of specified type.
+ *
+ * @param interceptorType type of interceptor to remove
+ */
+ void removeInterceptor(Class<? extends CommandInterceptor> interceptorType);
+
+ /**
+ * Retrieves the current CacheCacheLoaderManager instance associated with the current Cache instance.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return Retrieves a reference to the currently configured {@link org.jboss.cache.loader.CacheLoaderManager} if one or more cache loaders are configured, null otherwise.
+ */
+ CacheLoaderManager getCacheLoaderManager();
+
+ /**
+ * Retrieves the current BuddyManager instance associated with the current Cache instance.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return an instance of {@link BuddyManager} if buddy replication is enabled, null otherwise.
+ */
+ BuddyManager getBuddyManager();
+
+ /**
+ * Retrieves the current TransactionTable instance associated with the current Cache instance.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return the current {@link TransactionTable}
+ */
+ TransactionTable getTransactionTable();
+
+ /**
+ * Gets a handle of the RPC manager.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return the {@link org.jboss.cache.RPCManager} configured.
+ */
+ RPCManager getRPCManager();
+
+ /**
+ * Retrieves the current StateTransferManager instance associated with the current Cache instance.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return the current {@link org.jboss.cache.statetransfer.StateTransferManager}
+ */
+ StateTransferManager getStateTransferManager();
+
+ /**
+ * Retrieves the current RegionManager instance associated with the current Cache instance.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return the {@link RegionManager}
+ */
+ RegionManager getRegionManager();
+
+
+ /**
+ * Retrieves the current Notifier instance associated with the current Cache instance.
+ * <p/>
+ * From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
+ * {@link org.jboss.cache.factories.annotations.Inject} annotation.
+ *
+ * @return the notifier attached with this instance of the cache. See {@link org.jboss.cache.notifications.Notifier}, a class
+ * that is responsible for emitting notifications to registered CacheListeners.
+ */
+ Notifier getNotifier();
+
+ /**
+ * @return the name of the cluster. Null if running in local mode.
+ */
+ String getClusterName();
+
+ /**
+ * @return the number of attributes in the cache.
+ */
+ int getNumberOfAttributes();
+
+ /**
+ * @return the number of nodes in the cache.
+ */
+ int getNumberOfNodes();
+
+ /**
+ * Returns the global transaction for this local transaction.
+ * Optionally creates a new global transaction if it does not exist.
+ *
+ * @param tx the current transaction
+ * @param createIfNotExists if true creates a new transaction if none exists
+ * @return a GlobalTransaction
+ */
+ GlobalTransaction getCurrentTransaction(Transaction tx, boolean createIfNotExists);
+
+ /**
+ * Returns the transaction associated with the current thread.
+ * If a local transaction exists, but doesn't yet have a mapping to a
+ * GlobalTransaction, a new GlobalTransaction will be created and mapped to
+ * the local transaction. Note that if a local transaction exists, but is
+ * not ACTIVE or PREPARING, null is returned.
+ *
+ * @return A GlobalTransaction, or null if no (local) transaction was associated with the current thread
+ */
+ GlobalTransaction getCurrentTransaction();
+
+ /**
+ * Returns a node without accessing the interceptor chain. Does not return any nodes marked as invalid. Note that this call works
+ * directly on the cache data structure and will not pass through the interceptor chain. Hence node locking, cache
+ * loading or activation does not take place, and so the results of this call should not be treated as definitive. Concurrent node
+ * removal, passivation, etc. may affect the results of this call.
+ *
+ * @param fqn the Fqn to look up.
+ * @param includeDeletedNodes if you intend to see nodes marked as deleted within the current tx, set this to true
+ * @return a node if one exists or null
+ */
+ NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes);
+
+ /**
+ * Returns a node without accessing the interceptor chain, optionally returning nodes that are marked as invalid ({@link org.jboss.cache.Node#isValid()} == false).
+ * Note that this call works
+ * directly on the cache data structure and will not pass through the interceptor chain. Hence node locking, cache
+ * loading or activation does not take place, and so the results of this call should not be treated as definitive. Concurrent node
+ * removal, passivation, etc. may affect the results of this call.
+ *
+ * @param fqn the Fqn to look up.
+ * @param includeDeletedNodes if you intend to see nodes marked as deleted within the current tx, set this to true
+ * @param includeInvalidNodes if true, nodes marked as being invalid are also returned.
+ * @return a node if one exists or null
+ */
+ NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes, boolean includeInvalidNodes);
+
+ /**
+ * Used with buddy replication's data gravitation interceptor. If marshalling is necessary, ensure that the cache is
+ * configured to use {@link org.jboss.cache.config.Configuration#useRegionBasedMarshalling} and the {@link org.jboss.cache.Region}
+ * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
+ *
+ * @param fqn the fqn to gravitate
+ * @param searchBuddyBackupSubtrees if true, buddy backup subtrees are searched and if false, they are not.
+ * @param ctx
+ * @return a GravitateResult which contains the data for the gravitation
+ */
+ GravitateResult gravitateData(Fqn fqn, boolean searchBuddyBackupSubtrees, InvocationContext ctx);
+
+ /**
+ * Returns a Set<Fqn> of Fqns of the topmost node of internal regions that
+ * should not included in standard state transfers. Will include
+ * {@link BuddyManager#BUDDY_BACKUP_SUBTREE} if buddy replication is
+ * enabled.
+ *
+ * @return an unmodifiable Set<Fqn>. Will not return <code>null</code>.
+ */
+ Set<Fqn> getInternalFqns();
+
+ int getNumberOfLocksHeld();
+
+ /**
+ * Helper method that does a peek and ensures that the result of the peek is not null. Note that this call works
+ * directly on the cache data structure and will not pass through the interceptor chain. Hence node locking, cache
+ * loading or activation does not take place, and so the results of this call should not be treated as definitive.
+ *
+ * @param fqn Fqn to peek
+ * @return true if the peek returns a non-null value.
+ */
+ boolean exists(Fqn fqn);
+
+ /**
+ * A convenience method that takes a String representation of an Fqn. Otherwise identical to {@link #exists(Fqn)}.
+ * Note that this call works
+ * directly on the cache data structure and will not pass through the interceptor chain. Hence node locking, cache
+ * loading or activation does not take place, and so the results of this call should not be treated as definitive.
+ */
+ boolean exists(String fqn);
+
+ /**
+ * Returns all children of a given node. Returns an empty set if there are no children.
+ * The set is unmodifiable.
+ *
+ * @param fqn The fully qualified name of the node
+ * @return Set an unmodifiable set of children names, Object.
+ */
+ Set<Object> getChildrenNames(Fqn fqn);
+
+ /**
+ * Convenience method that takes a String representation of an Fqn. Otherwise identical to {@link #getChildrenNames(Fqn)}
+ *
+ * @param fqn as a string
+ * @return Set an unmodifiable set of children names, Object.
+ */
+ Set<String> getChildrenNames(String fqn);
+
+ /**
+ * Returns the component registry associated with this cache instance.
+ *
+ * @see org.jboss.cache.factories.ComponentRegistry
+ */
+ ComponentRegistry getComponentRegistry();
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: core/branches/flat/src/main/java/org/jboss/cache/Cache_Legacy.java (from rev 6890, core/branches/flat/src/main/java/org/jboss/cache/Cache.java)
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Cache_Legacy.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/cache/Cache_Legacy.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -0,0 +1,539 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cache;
+
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jgroups.Address;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Interface for a Cache where data mappings are grouped and stored in a tree data
+ * structure consisting of {@link Node}s.
+ * <p/>
+ * This is the central construct and basic client API of JBoss Cache and is used for
+ * cache-wide operations.
+ * <p/>
+ * The cache is constructed using a {@link CacheFactory} and is started
+ * using {@link #start}, if not already started by the CacheFactory.
+ * <p/>
+ * Once constructed, the Cache interface can be used to create or access {@link Node}s, which contain data. Once references
+ * to {@link Node}s are obtained, data can be stored in them,
+ * <p/>
+ * As a convenience (and mainly to provide a familiar API to the older JBoss Cache 1.x.x releases) methods are provided that
+ * operate directly on nodes.
+ * <ul>
+ * <li>{@link #put(Fqn,Object,Object)} </li>
+ * <li>{@link #put(Fqn,java.util.Map)} </li>
+ * <li>{@link #get(Fqn,Object)} </li>
+ * <li>{@link #remove(Fqn,Object)} </li>
+ * <li>{@link #removeNode(Fqn)} </li>
+ * </ul>
+ * <p/>
+ * A simple example of usage:
+ * <pre>
+ * // creates with default settings and starts the cache
+ * Cache cache = DefaultCacheFactory.getInstance().createCache();
+ * Fqn personRecords = Fqn.fromString("/org/mycompany/personRecords");
+ * <p/>
+ * Node rootNode = cache.getRoot();
+ * Node personRecordsNode = rootNode.addChild(personRecords);
+ * <p/>
+ * // now add some person records.
+ * Fqn peterGriffin = Fqn.fromString("/peterGriffin");
+ * Fqn stewieGriffin = Fqn.fromString("/stewieGriffin");
+ * <p/>
+ * // the addChild() API uses relative Fqns
+ * Node peter = personRecordsNode.addChild(peterGriffin);
+ * Node stewie = personRecordsNode.addChild(stewieGriffin);
+ * <p/>
+ * peter.put("name", "Peter Griffin");
+ * peter.put("ageGroup", "MidLifeCrisis");
+ * peter.put("homicidal", Boolean.FALSE);
+ * <p/>
+ * stewie.put("name", "Stewie Griffin");
+ * stewie.put("ageGroup", "Infant");
+ * stewie.put("homicidal", Boolean.TRUE);
+ * <p/>
+ * peter.getFqn().toString(); // will print out /org/mycompany/personRecords/peterGriffin
+ * stewie.getFqn().toString(); // will print out /org/mycompany/personRecords/stewieGriffin
+ * <p/>
+ * peter.getFqn().getParent().equals(stewie.getFqn().getParent()); // will return true
+ * <p/>
+ * </pre>
+ * <p/>
+ * For more information, please read the JBoss Cache user guide and tutorial, available on <a href="http://labs.jboss.com/portal/jbosscache/docs/index.html" target="_BLANK">the JBoss Cache documentation site</a>,
+ * and look through the examples <a href="http://labs.jboss.com/portal/jbosscache/download/index.html" target="_BLANK">shipped with the JBoss Cache distribution</a>.
+ *
+ * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
+ * @see Node
+ * @see CacheFactory
+ * @since 2.0.0
+ */
+ at ThreadSafe
+public interface Cache_Legacy<K, V>
+{
+ /**
+ * Retrieves the configuration of this cache.
+ *
+ * @return the configuration.
+ */
+ Configuration getConfiguration();
+
+ /**
+ * Returns the root node of this cache.
+ *
+ * @return the root node
+ */
+ Node<K, V> getRoot();
+
+ /**
+ * Adds a {@link org.jboss.cache.notifications.annotation.CacheListener}-annotated object to the entire cache. The object passed in needs to be properly annotated with the
+ * {@link org.jboss.cache.notifications.annotation.CacheListener} annotation otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException} will be thrown.
+ *
+ * @param listener listener to add
+ */
+ void addCacheListener(Object listener);
+
+ /**
+ * Removes a {@link org.jboss.cache.notifications.annotation.CacheListener}-annotated object from the cache. The object passed in needs to be properly annotated with the
+ * {@link org.jboss.cache.notifications.annotation.CacheListener} annotation otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException} will be thrown.
+ *
+ * @param listener listener to remove
+ */
+ void removeCacheListener(Object listener);
+
+ /**
+ * Retrieves an immutable {@link List} of objects annotated as {@link org.jboss.cache.notifications.annotation.CacheListener}s attached to the cache.
+ *
+ * @return an immutable {@link List} of objects annotated as {@link org.jboss.cache.notifications.annotation.CacheListener}s attached to the cache.
+ */
+ Set<Object> getCacheListeners();
+
+ /**
+ * Associates the specified value with the specified key for a {@link Node} in this cache.
+ * If the {@link Node} previously contained a mapping for this key, the old value is replaced by the specified value.
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to be accessed.
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return previous value associated with specified key, or <code>null</code> if there was no mapping for key.
+ * A <code>null</code> return can also indicate that the Node previously associated <code>null</code> with the specified key, if the implementation supports null values.
+ * @throws IllegalStateException if the cache is not in a started state.
+ */
+ V put(Fqn fqn, K key, V value);
+
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to {@link #put(Fqn, Object, Object)}
+ *
+ * @param fqn String representation of the Fqn
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return previous value associated with specified key, or <code>null</code> if there was no mapping for key.
+ * A <code>null</code> return can also indicate that the Node previously associated <code>null</code> with the specified key, if the implementation supports null values.
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+
+ V put(String fqn, K key, V value);
+
+ /**
+ * Under special operating behavior, associates the value with the specified key for a node identified by the Fqn passed in.
+ * <ul>
+ * <li> Only goes through if the node specified does not exist; no-op otherwise.</i>
+ * <li> Force asynchronous mode for replication to prevent any blocking.</li>
+ * <li> invalidation does not take place. </li>
+ * <li> 0ms lock timeout to prevent any blocking here either. If the lock is not acquired, this method is a no-op, and swallows the timeout exception.</li>
+ * <li> Ongoing transactions are suspended before this call, so failures here will not affect any ongoing transactions.</li>
+ * <li> Errors and exceptions are 'silent' - logged at a much lower level than normal, and this method does not throw exceptions</li>
+ * </ul>
+ * This method is for caching data that has an external representation in storage, where, concurrent modification and
+ * transactions are not a consideration, and failure to put the data in the cache should be treated as a 'suboptimal outcome'
+ * rather than a 'failing outcome'.
+ * <p/>
+ * An example of when this method is useful is when data is read from, for example, a legacy datastore, and is cached before
+ * returning the data to the caller. Subsequent calls would prefer to get the data from the cache and if the data doesn't exist
+ * in the cache, fetch again from the legacy datastore.
+ * <p/>
+ * See <a href="http://jira.jboss.com/jira/browse/JBCACHE-848">JBCACHE-848</a> for details around this feature.
+ * <p/>
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to be accessed.
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link org.jboss.cache.CacheStatus#STARTED}.
+ */
+ void putForExternalRead(Fqn fqn, K key, V value);
+
+ /**
+ * Copies all of the mappings from the specified map to a {@link Node}.
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to copy the data to
+ * @param data mappings to copy
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ void put(Fqn fqn, Map<? extends K, ? extends V> data);
+
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to {@link #put(Fqn, java.util.Map)}
+ *
+ * @param fqn String representation of the Fqn
+ * @param data data map to insert
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ void put(String fqn, Map<? extends K, ? extends V> data);
+
+ /**
+ * Removes the mapping for this key from a Node.
+ * Returns the value to which the Node previously associated the key, or
+ * <code>null</code> if the Node contained no mapping for this key.
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to be accessed.
+ * @param key key whose mapping is to be removed from the Node
+ * @return previous value associated with specified Node's key
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ V remove(Fqn fqn, K key);
+
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to {@link #remove(Fqn, Object)}
+ *
+ * @param fqn string representation of the Fqn to retrieve
+ * @param key key to remove
+ * @return old value removed, or null if the fqn does not exist
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ V remove(String fqn, K key);
+
+ /**
+ * Removes a {@link Node} indicated by absolute {@link Fqn}.
+ *
+ * @param fqn {@link Node} to remove
+ * @return true if the node was removed, false if the node was not found
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ boolean removeNode(Fqn fqn);
+
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to {@link #removeNode(Fqn)}
+ *
+ * @param fqn string representation of the Fqn to retrieve
+ * @return true if the node was found and removed, false otherwise
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ boolean removeNode(String fqn);
+
+ /**
+ * A convenience method to retrieve a node directly from the cache. Equivalent to calling cache.getRoot().getChild(fqn).
+ *
+ * @param fqn fqn of the node to retrieve
+ * @return a Node object, or a null if the node does not exist.
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ Node<K, V> getNode(Fqn fqn);
+
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to {@link #getNode(Fqn)}
+ *
+ * @param fqn string representation of the Fqn to retrieve
+ * @return node, or null if the node does not exist
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ Node<K, V> getNode(String fqn);
+
+
+ /**
+ * Convenience method that allows for direct access to the data in a {@link Node}.
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to be accessed.
+ * @param key key under which value is to be retrieved.
+ * @return returns data held under specified key in {@link Node} denoted by specified Fqn.
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ V get(Fqn fqn, K key);
+
+ /**
+ * Convenience method that takes a string representation of an Fqn. Otherwise identical to {@link #get(Fqn, Object)}
+ *
+ * @param fqn string representation of the Fqn to retrieve
+ * @param key key to fetch
+ * @return value, or null if the fqn does not exist.
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ V get(String fqn, K key);
+
+ /**
+ * Eviction call that evicts the specified {@link Node} from memory.
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to be evicted.
+ * @param recursive evicts children as well
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ void evict(Fqn fqn, boolean recursive);
+
+ /**
+ * Eviction call that evicts the specified {@link Node} from memory. Not recursive.
+ *
+ * @param fqn <b><i>absolute</i></b> {@link Fqn} to the {@link Node} to be evicted.
+ * @throws IllegalStateException if the cache is not in a started state
+ */
+ void evict(Fqn fqn);
+
+ /**
+ * Retrieves a {@link Region} for a given {@link Fqn}. If the region does not exist,
+ * and <li>createIfAbsent</li> is true, then one is created.
+ * <p/>
+ * If not, parent Fqns will be consulted in turn for registered regions, gradually working up to
+ * Fqn.ROOT. If no regions are defined in any of the parents either, a null is returned.
+ *
+ * @param fqn Fqn that is contained in a region.
+ * @param createIfAbsent If true, will create a new associated region if not found.
+ * @return a MarshRegion. Null if none is found.
+ * @see Region
+ */
+ Region getRegion(Fqn fqn, boolean createIfAbsent);
+
+ /**
+ * Removes a region denoted by the Fqn passed in.
+ *
+ * @param fqn of the region to remove
+ * @return true if a region did exist and was removed; false otherwise.
+ */
+ boolean removeRegion(Fqn fqn);
+
+ /**
+ * Lifecycle method that initializes configuration state, the root node, etc.
+ *
+ * @throws CacheException if there are creation problems
+ */
+ void create() throws CacheException;
+
+ /**
+ * Lifecycle method that starts the cache loader,
+ * starts cache replication, starts the region manager, etc., and (if configured) warms the cache using a
+ * state transfer or cache loader preload.
+ *
+ * @throws CacheException if there are startup problems
+ */
+ void start() throws CacheException;
+
+ /**
+ * Lifecycle method that stops the cache, including replication,
+ * clustering, cache loading, notifications, etc., and clears all cache in-memory state.
+ * <p/>
+ * State can be reconstituted by using either a cache loader or state transfer when the cache starts again.
+ */
+ void stop();
+
+ /**
+ * Lifecycle method that destroys the cache and removes any interceptors/configuration elements.
+ * Cache can then be restarted (potentially after reconfiguring) using {@link #create()} and {@link #start()}.
+ */
+ void destroy();
+
+ /**
+ * Gets where the cache currently is its lifecycle transitions.
+ *
+ * @return the CacheStatus. Will not return <code>null</code>.
+ */
+ CacheStatus getCacheStatus();
+
+ /**
+ * @return the current invocation context for the current invocation and cache instance.
+ * @throws IllegalStateException if the cache has been destroyed.
+ */
+ InvocationContext getInvocationContext();
+
+ /**
+ * Sets the passed in {@link org.jboss.cache.InvocationContext} as current.
+ *
+ * @param ctx invocation context to use
+ * @throws IllegalStateException if the cache has been destroyed.
+ */
+ void setInvocationContext(InvocationContext ctx);
+
+ /**
+ * Returns the local address of this cache in a cluster, or <code>null</code>
+ * if running in local mode.
+ *
+ * @return the local address of this cache in a cluster, or <code>null</code>
+ * if running in local mode.
+ */
+ Address getLocalAddress();
+
+ /**
+ * Returns a list of members in the cluster, or <code>null</code>
+ * if running in local mode.
+ *
+ * @return a {@link List} of members in the cluster, or <code>null</code>
+ * if running in local mode.
+ */
+ List<Address> getMembers();
+
+ /**
+ * Moves a part of the cache to a different subtree.
+ * <p/>
+ * E.g.:
+ * <p/>
+ * assume a cache structure such as:
+ * <p/>
+ * <pre>
+ * /a/b/c
+ * /a/b/d
+ * /a/b/e
+ * <p/>
+ * <p/>
+ * Fqn f1 = Fqn.fromString("/a/b/c");
+ * Fqn f2 = Fqn.fromString("/a/b/d");
+ * <p/>
+ * cache.move(f1, f2);
+ * </pre>
+ * <p/>
+ * Will result in:
+ * <pre>
+ * <p/>
+ * /a/b/d/c
+ * /a/b/e
+ * <p/>
+ * </pre>
+ * <p/>
+ * and now
+ * <p/>
+ * <pre>
+ * Fqn f3 = Fqn.fromString("/a/b/e");
+ * Fqn f4 = Fqn.fromString("/a");
+ * cache.move(f3, f4);
+ * </pre>
+ * <p/>
+ * will result in:
+ * <pre>
+ * /a/b/d/c
+ * /a/e
+ * </pre>
+ * No-op if the node to be moved is the root node.
+ * <p/>
+ * <b>Note</b>: As of 3.0.0 and when using MVCC locking, more specific behaviour is defined as follows:
+ * <ul>
+ * <li>A no-op if the node is moved unto itself. E.g., <tt>move(fqn, fqn.getParent())</tt> will not do anything.</li>
+ * <li>If a target node does not exist it will be created silently, to be more consistent with other APIs such as <tt>put()</tt> on a nonexistent node.</li>
+ * <li>If the source node does not exist this is a no-op, to be more consistent with other APIs such as <tt>get()</tt> on a nonexistent node.</li>
+ * </ul>
+ *
+ * @param nodeToMove the Fqn of the node to move.
+ * @param newParent new location under which to attach the node being moved.
+ * @throws NodeNotExistsException may throw one of these if the target node does not exist or if a different thread has moved this node elsewhere already.
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link CacheStatus#STARTED}.
+ */
+ void move(Fqn nodeToMove, Fqn newParent) throws NodeNotExistsException;
+
+ /**
+ * Convenience method that takes in string representations of Fqns. Otherwise identical to {@link #move(Fqn, Fqn)}
+ *
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link CacheStatus#STARTED}.
+ */
+ void move(String nodeToMove, String newParent) throws NodeNotExistsException;
+
+ /**
+ * Returns the version of the cache as a string.
+ *
+ * @return the version string of the cache.
+ * @see Version#printVersion
+ */
+ String getVersion();
+
+ /**
+ * Retrieves a defensively copied data map of the underlying node. A convenience method to retrieving a node and
+ * getting data from the node directly.
+ *
+ * @param fqn
+ * @return map of data, or an empty map
+ * @throws CacheException
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link CacheStatus#STARTED}.
+ */
+ Map<K, V> getData(Fqn fqn);
+
+ /**
+ * Convenience method that takes in a String represenation of the Fqn. Otherwise identical to {@link #getKeys(Fqn)}.
+ */
+ Set<K> getKeys(String fqn);
+
+ /**
+ * Returns a set of attribute keys for the Fqn.
+ * Returns null if the node is not found, otherwise a Set.
+ * The set is a copy of the actual keys for this node.
+ * <p/>
+ * A convenience method to retrieving a node and
+ * getting keys from the node directly.
+ *
+ * @param fqn name of the node
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link CacheStatus#STARTED}.
+ */
+ Set<K> getKeys(Fqn fqn);
+
+ /**
+ * Convenience method that takes in a String represenation of the Fqn. Otherwise identical to {@link #clearData(Fqn)}.
+ *
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link CacheStatus#STARTED}.
+ */
+ void clearData(String fqn);
+
+ /**
+ * Removes the keys and properties from a named node.
+ * <p/>
+ * A convenience method to retrieving a node and
+ * getting keys from the node directly.
+ *
+ * @param fqn name of the node
+ * @throws IllegalStateException if {@link #getCacheStatus()} would not return {@link CacheStatus#STARTED}.
+ */
+ void clearData(Fqn fqn);
+
+ /**
+ * Starts a batch. This is a lightweight batching mechanism that groups cache writes together and finally performs the
+ * write, persistence and/or replication when {@link #endBatch(boolean)} is called rather than for each invocation on the
+ * cache.
+ * <p/>
+ * Note that if there is an existing transaction in scope and the cache has been configured to use a JTA compliant
+ * transaction manager, calls to {@link #startBatch()} and {@link #endBatch(boolean)} are ignored and treated as no-ops.
+ * <p/>
+ *
+ * @see #endBatch(boolean)
+ * @since 3.0
+ */
+ void startBatch();
+
+ /**
+ * Ends an existing ongoing batch. A no-op if a batch has not been started yet.
+ * <p/>
+ * Note that if there is an existing transaction in scope and the cache has been configured to use a JTA compliant
+ * transaction manager, calls to {@link #startBatch()} and {@link #endBatch(boolean)} are ignored and treated as no-ops.
+ * <p/>
+ *
+ * @param successful if <tt>true</tt>, changes made in the batch are committed. If <tt>false</tt>, they are discarded.
+ * @see #startBatch()
+ * @since 3.0
+ */
+ void endBatch(boolean successful);
+}
Property changes on: core/branches/flat/src/main/java/org/jboss/cache/Cache_Legacy.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -54,7 +54,7 @@
@CacheListener
public class ConsoleListener
{
- private CacheSPI cache;
+ private CacheSPI_Legacy cache;
private boolean startCache;
/**
@@ -65,7 +65,7 @@
*
* @param cache the cache to monitor for replication events.
*/
- public ConsoleListener(CacheSPI cache)
+ public ConsoleListener(CacheSPI_Legacy cache)
throws Exception
{
this(cache, true, true);
@@ -80,7 +80,7 @@
* @param stopCache indicates whether or not the cache should be stopped by
* this class.
*/
- public ConsoleListener(CacheSPI cache,
+ public ConsoleListener(CacheSPI_Legacy cache,
boolean startCache, boolean stopCache)
throws Exception
{
@@ -240,7 +240,7 @@
System.out.print("No xml config file argument is supplied. Will use jboss-cache.xml from classpath");
}
- CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(configFileName);
+ CacheSPI_Legacy cache = (CacheSPI_Legacy) new DefaultCacheFactory<Object, Object>().createCache(configFileName);
ConsoleListener listener = new ConsoleListener(cache);
listener.listen();
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,13 +22,13 @@
package org.jboss.cache;
import org.jboss.cache.annotations.Compat;
-import org.jboss.cache.factories.ComponentFactory;
-import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.jmx.PlatformMBeanServerRegistration;
+import org.jboss.starobrno.CacheDelegate;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.config.parsing.XmlConfigurationParser;
+import org.jboss.starobrno.factories.ComponentFactory;
+import org.jboss.starobrno.factories.ComponentRegistry;
import java.io.InputStream;
@@ -60,22 +60,22 @@
return new DefaultCacheFactory();
}
- public Cache<K, V> createCache() throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache() throws ConfigurationException
{
return createCache(true);
}
- public Cache<K, V> createCache(boolean start) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(boolean start) throws ConfigurationException
{
return createCache(new Configuration(), start);
}
- public Cache<K, V> createCache(String configFileName) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(String configFileName) throws ConfigurationException
{
return createCache(configFileName, true);
}
- public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c;
@@ -90,7 +90,7 @@
* @return a cache
* @throws ConfigurationException if there are problems with the cfg
*/
- public Cache<K, V> createCache(Configuration configuration) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(Configuration configuration) throws ConfigurationException
{
return createCache(configuration, true);
}
@@ -103,11 +103,11 @@
* @return a cache
* @throws ConfigurationException if there are problems with the cfg
*/
- public Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException
{
try
{
- CacheSPI<K, V> cache = createAndWire(configuration);
+ org.jboss.starobrno.CacheSPI<K, V> cache = createAndWire(configuration);
if (start) cache.start();
return cache;
}
@@ -125,9 +125,9 @@
}
}
- protected CacheSPI<K, V> createAndWire(Configuration configuration) throws Exception
+ protected org.jboss.starobrno.CacheSPI<K, V> createAndWire(Configuration configuration) throws Exception
{
- CacheSPI<K, V> spi = new CacheInvocationDelegate<K, V>();
+ org.jboss.starobrno.CacheSPI<K, V> spi = new CacheDelegate<K, V>();
bootstrap(spi, configuration);
return spi;
}
@@ -135,14 +135,14 @@
/**
* Bootstraps this factory with a Configuration and a ComponentRegistry.
*/
- private void bootstrap(CacheSPI spi, Configuration configuration)
+ private void bootstrap(org.jboss.starobrno.CacheSPI spi, Configuration configuration)
{
// injection bootstrap stuff
componentRegistry = new ComponentRegistry(configuration, spi);
componentRegistry.registerDefaultClassLoader(defaultClassLoader);
this.configuration = configuration;
- componentRegistry.registerComponent(spi, CacheSPI.class);
+ componentRegistry.registerComponent(spi, org.jboss.starobrno.CacheSPI.class);
componentRegistry.registerComponent(new PlatformMBeanServerRegistration(), PlatformMBeanServerRegistration.class);
}
@@ -156,7 +156,7 @@
this.defaultClassLoader = loader;
}
- public Cache<K, V> createCache(InputStream is) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(InputStream is) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = null;
@@ -164,7 +164,7 @@
return createCache(c);
}
- public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException
+ public org.jboss.starobrno.Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = parser.parseStream(is);
Modified: core/branches/flat/src/main/java/org/jboss/cache/Fqn.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Fqn.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/Fqn.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -37,7 +37,7 @@
/**
* A Fully Qualified Name (Fqn) is a list of names (typically Strings but can be any Object),
- * which represent a path to a particular {@link Node} or sometimes a {@link Region} in a {@link Cache}.
+ * which represent a path to a particular {@link Node} or sometimes a {@link Region} in a {@link Cache_Legacy}.
* <p/>
* This name can be absolute (i.e., relative from the root node - {@link #ROOT}), or relative to any node in the cache. Reading the
* documentation on each API call that makes use of {@link org.jboss.cache.Fqn}s will tell you whether the API expects a
Modified: core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -200,7 +200,7 @@
NodeSPI<K, V> getParent();
- CacheSPI<K, V> getCache();
+ CacheSPI_Legacy<K, V> getCache();
NodeLock getLock();
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/Node.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Node.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/Node.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -27,7 +27,7 @@
import java.util.Set;
/**
- * A Node is a {@link Fqn named} logical grouping of data in the JBoss {@link Cache}.
+ * A Node is a {@link Fqn named} logical grouping of data in the JBoss {@link Cache_Legacy}.
* A node should be used to contain data for a single data record, for example
* information about a particular person or account.
* <p/>
@@ -45,7 +45,7 @@
* <p/>
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @see Cache
+ * @see Cache_Legacy
* @since 2.0.0
*/
@ThreadSafe
@@ -110,7 +110,7 @@
/**
* Removes a child node specified by the given relative {@link Fqn}.
* <p/>
- * If you wish to remove children based on absolute {@link Fqn}s, use the {@link Cache} interface instead.
+ * If you wish to remove children based on absolute {@link Fqn}s, use the {@link Cache_Legacy} interface instead.
*
* @param f {@link Fqn} of the child node, relative to the current node.
* @return true if the node was found and removed, false otherwise
Modified: core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -30,7 +30,7 @@
/**
* A more detailed interface to {@link Node}, which is used when writing plugins for or extending JBoss Cache. References are usually
- * obtained by calling methods on {@link org.jboss.cache.CacheSPI}.
+ * obtained by calling methods on {@link CacheSPI_Legacy}.
* <p/>
* <B><I>You should NEVER attempt to directly cast a {@link Node} instance to this interface. In future, the implementation may not allow it.</I></B>
* <p/>
@@ -57,7 +57,7 @@
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @see Node
- * @see org.jboss.cache.CacheSPI
+ * @see CacheSPI_Legacy
* @since 2.0.0
*/
@NotThreadSafe
@@ -459,7 +459,7 @@
*
* @return a cache
*/
- CacheSPI<K, V> getCache();
+ CacheSPI_Legacy<K, V> getCache();
// ----------- these methods override their corresponding methods in Node, so that the return types are NodeSPI rather than Node.
Modified: core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -24,31 +24,30 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.jmx.annotations.MBean;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.lock.LockManager;
-import org.jboss.cache.lock.LockUtil;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
import org.jboss.cache.statetransfer.DefaultStateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.concurrent.ReclosableLatch;
import org.jboss.cache.util.reflect.ReflectionUtil;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.RuntimeConfig;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
import org.jboss.starobrno.factories.annotations.Stop;
+import org.jboss.starobrno.notifier.Notifier;
+import org.jboss.starobrno.transaction.TransactionTable;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.ChannelException;
@@ -110,7 +109,7 @@
private ChannelMessageListener messageListener;
private Configuration configuration;
private Notifier notifier;
- private CacheSPI spi;
+ private CacheSPI_Legacy spi;
private InvocationContextContainer invocationContextContainer;
private final boolean trace = log.isTraceEnabled();
private Marshaller marshaller;
@@ -125,14 +124,15 @@
@Inject
public void setupDependencies(ChannelMessageListener messageListener, Configuration configuration, Notifier notifier,
- CacheSPI spi, Marshaller marshaller, TransactionTable txTable,
+ Marshaller marshaller, TransactionTable txTable,
TransactionManager txManager, InvocationContextContainer container, InterceptorChain interceptorChain,
ComponentRegistry componentRegistry, LockManager lockManager)
{
this.messageListener = messageListener;
this.configuration = configuration;
this.notifier = notifier;
- this.spi = spi;
+ // TODO: Inject cacheSPI when we are ready
+// this.spi = spi;
this.marshaller = marshaller;
this.txManager = txManager;
this.txTable = txTable;
@@ -368,7 +368,9 @@
for (GlobalTransaction deadOwner : deadOwners)
{
boolean localTx = deadOwner.getAddress().equals(getLocalAddress());
- boolean broken = LockUtil.breakTransactionLock(node.getFqn(), lockManager, deadOwner, localTx, txTable, txManager);
+ // TODO: Fix me!!!
+// boolean broken = LockUtil.breakTransactionLock(node.getFqn(), lockManager, deadOwner, localTx, txTable, txManager);
+ boolean broken = true;
if (broken && trace) log.trace("Broke lock for node " + node.getFqn() + " held by " + deadOwner);
}
@@ -396,7 +398,8 @@
for (GlobalTransaction deadOwner : deadOwners)
{
boolean localTx = deadOwner.getAddress().equals(getLocalAddress());
- boolean broken = LockUtil.breakTransactionLock(node.getFqn(), lockManager, deadOwner, localTx, txTable, txManager);
+// boolean broken = LockUtil.breakTransactionLock(node.getFqn(), lockManager, deadOwner, localTx, txTable, txManager);
+ boolean broken = true; // TODO fix me!!
if (broken && trace) log.trace("Broke lock for node " + node.getFqn() + " held by " + deadOwner);
}
@@ -674,8 +677,10 @@
// now notify listeners - *after* updating the coordinator. - JBCACHE-662
if (needNotification && notifier != null)
{
- InvocationContext ctx = spi.getInvocationContext();
- notifier.notifyViewChange(newView, ctx);
+ // TODO: Fix me when we have repl working
+ throw new UnsupportedOperationException("Fix me!");
+// InvocationContext ctx = spi.getInvocationContext();
+// notifier.notifyViewChange(newView, ctx);
}
// Wake up any threads that are waiting to know about who the coordinator is
Modified: core/branches/flat/src/main/java/org/jboss/cache/Region.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Region.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/Region.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -27,7 +27,7 @@
import org.jboss.starobrno.eviction.EvictionEvent;
/**
- * Defines characteristics such as class loading and eviction of {@link org.jboss.cache.Node}s belonging to a Region in a {@link Cache}.
+ * Defines characteristics such as class loading and eviction of {@link org.jboss.cache.Node}s belonging to a Region in a {@link Cache_Legacy}.
* A Region is described by an {@link #getFqn() Fqn} relative to the root of the cache.
* All nodes and child nodes of this Fqn belong to this region.
* <p/>
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -192,7 +192,7 @@
*/
String dumpRegions();
- CacheSPI getCache();
+ CacheSPI_Legacy getCache();
/**
* @return the eviction timer task attached to the region manager
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -66,7 +66,7 @@
private boolean defaultInactive;
protected static final Log log = LogFactory.getLog(RegionManagerImpl.class);
protected static final boolean trace = log.isTraceEnabled();
- CacheSPI<?, ?> cache;
+ CacheSPI_Legacy<?, ?> cache;
private boolean usingEvictions;
private EvictionConfig evictionConfig;
private final org.jboss.starobrno.eviction.EvictionTimerTask evictionTimerTask = new org.jboss.starobrno.eviction.EvictionTimerTask();
@@ -96,7 +96,7 @@
}
@Inject
- public void injectDependencies(CacheSPI cache, Configuration configuration, RPCManager rpcManager, LockManager lockManager,
+ public void injectDependencies(CacheSPI_Legacy cache, Configuration configuration, RPCManager rpcManager, LockManager lockManager,
BuddyFqnTransformer transformer, RegionRegistry regionsRegistry)
{
this.cache = cache;
@@ -721,7 +721,7 @@
return "RegionManager " + dumpRegions();
}
- public CacheSPI getCache()
+ public CacheSPI_Legacy getCache()
{
return cache;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/TreeCacheViewMBean.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/TreeCacheViewMBean.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/TreeCacheViewMBean.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -39,9 +39,9 @@
void destroy();
- Cache getCache();
+ Cache_Legacy getCache();
- void setCache(Cache cache);
+ void setCache(Cache_Legacy cache);
CacheJmxWrapperMBean getCacheService();
Modified: core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -59,7 +59,7 @@
*/
protected Map<K, V> data;
protected NodeSPI<K, V> delegate;
- protected CacheSPI<K, V> cache;
+ protected CacheSPI_Legacy<K, V> cache;
/**
* Constructs a new node with an FQN of Root.
@@ -81,7 +81,7 @@
initFlags();
}
- public UnversionedNode(Fqn fqn, CacheSPI<K, V> cache, boolean lockForChildInsertRemove)
+ public UnversionedNode(Fqn fqn, CacheSPI_Legacy<K, V> cache, boolean lockForChildInsertRemove)
{
initFlags();
this.cache = cache;
@@ -100,7 +100,7 @@
}
}
- public UnversionedNode(Fqn fqn, CacheSPI<K, V> cache, boolean lockForChildInsertRemove, Map<K, V> data)
+ public UnversionedNode(Fqn fqn, CacheSPI_Legacy<K, V> cache, boolean lockForChildInsertRemove, Map<K, V> data)
{
this(fqn, cache, lockForChildInsertRemove);
if (data != null) this.data = new FastCopyHashMap<K, V>(data);
@@ -144,7 +144,7 @@
// if (data == null) data = new FastCopyHashMap<K, V>();
// }
- public CacheSPI<K, V> getCache()
+ public CacheSPI_Legacy<K, V> getCache()
{
return cache;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Version.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/Version.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -32,7 +32,7 @@
@Immutable
public class Version
{
- public static final String version = "1.0-SNAPSHOT";
+ public static final String version = "1.0.0.SNAPSHOT";
public static final String codename = "Starobrno";
//public static final String cvs = "$Id: Version.java 4592 2007-10-10 16:44:36Z manik.surtani at jboss.com $";
static final byte[] version_id = {'0', '1', '0', '0', 'S'};
Modified: core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -28,8 +28,8 @@
import javax.transaction.TransactionManager;
/**
- * A container for holding thread locals for batching, to be used with the {@link org.jboss.cache.Cache#startBatch()} and
- * {@link org.jboss.cache.Cache#endBatch(boolean)} calls.
+ * A container for holding thread locals for batching, to be used with the {@link org.jboss.cache.Cache_Legacy#startBatch()} and
+ * {@link org.jboss.cache.Cache_Legacy#endBatch(boolean)} calls.
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 3.0
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
@@ -104,7 +104,7 @@
/**
* back-refernce to the CacheImpl object
*/
- private CacheSPI<?, ?> cache;
+ private CacheSPI_Legacy<?, ?> cache;
private Configuration configuration;
private RegionManager regionManager;
private Notifier notifier;
@@ -208,7 +208,7 @@
}
@Inject
- public void injectDependencies(CacheSPI cache, Configuration configuration, RegionManager regionManager,
+ public void injectDependencies(CacheSPI_Legacy cache, Configuration configuration, RegionManager regionManager,
StateTransferManager stateTransferManager, RPCManager rpcManager, Notifier notifier,
CommandsFactory factory, DataContainer dataContainer, BuddyFqnTransformer transformer)
{
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.commands;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.RPCManager;
@@ -78,14 +78,14 @@
protected InterceptorChain invoker;
protected BuddyManager buddyManager;
protected TransactionTable transactionTable;
- protected CacheSPI cacheSpi;
+ protected CacheSPI_Legacy cacheSpi;
protected Configuration configuration;
protected TransactionManager txManager;
protected BuddyFqnTransformer buddyFqnTransformer;
@Inject
public void initialize(RPCManager rpc, DataContainer dataContainer, Notifier notifier, BuddyManager buddyManager,
- InterceptorChain invoker, TransactionTable transactionTable, CacheSPI cacheSpi,
+ InterceptorChain invoker, TransactionTable transactionTable, CacheSPI_Legacy cacheSpi,
Configuration configuration, TransactionManager txManager, BuddyFqnTransformer buddyFqnTransformer)
{
this.rpcManager = rpc;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -28,7 +28,7 @@
import org.jboss.cache.util.Immutables;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#getData(org.jboss.cache.Fqn)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#getData(org.jboss.cache.Fqn)}
* <p/>
* This is the equivalent of the old MethodCallDefinitions.getDataMapMethodLocal method call from 2.1.x.
* <p/>
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.read;
import org.apache.commons.logging.Log;
@@ -31,7 +31,7 @@
import org.jboss.cache.notifications.Notifier;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#get(String, Object)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#get(String, Object)}
* <p/>
* This is the equivalent of the old MethodCallDefinitions.getKeyValueMethodLocal method call from 2.1.x.
* <p/>
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.read;
import org.jboss.cache.Fqn;
@@ -27,7 +27,7 @@
import org.jboss.cache.commands.Visitor;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#getKeys(org.jboss.cache.Fqn)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#getKeys(org.jboss.cache.Fqn)}
* <p/>
* This is the equivalent of the old MethodCallDefinitions.getKeysMethodLocal method call from 2.1.x.
* <p/>
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.read;
import org.apache.commons.logging.Log;
@@ -29,7 +29,7 @@
import org.jboss.cache.commands.Visitor;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#getNode(org.jboss.cache.Fqn)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#getNode(org.jboss.cache.Fqn)}
* <p/>
* This is the equivalent of the old MethodCallDefinitions.getNodeMethodLocal method call from 2.1.x.
* <p/>
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -56,7 +56,7 @@
public static final int METHOD_ID = 35;
/* dependencies */
- private CacheSPI spi;
+ private CacheSPI_Legacy spi;
/* parametres */
protected boolean searchSubtrees;
@@ -78,7 +78,7 @@
this.localAddress = localAddress;
}
- public void initialize(DataContainer dataContainer, CacheSPI spi, BuddyFqnTransformer transformer)
+ public void initialize(DataContainer dataContainer, CacheSPI_Legacy spi, BuddyFqnTransformer transformer)
{
this.dataContainer = dataContainer;
this.spi = spi;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -33,7 +33,7 @@
import java.util.Map;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#clearData(String)}}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#clearData(String)}}
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.write;
import org.apache.commons.logging.Log;
@@ -38,7 +38,7 @@
import java.util.List;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#evict(org.jboss.cache.Fqn)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#evict(org.jboss.cache.Fqn)}
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,29 +1,29 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.write;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -46,7 +46,7 @@
private static final boolean trace = log.isTraceEnabled();
/* dependencies*/
- protected CacheSPI spi;
+ protected CacheSPI_Legacy spi;
protected Notifier notifier;
public InvalidateCommand(Fqn fqn)
@@ -58,7 +58,7 @@
{
}
- public void initialize(CacheSPI cacheSpi, DataContainer dataContainer, Notifier notifier)
+ public void initialize(CacheSPI_Legacy cacheSpi, DataContainer dataContainer, Notifier notifier)
{
this.spi = cacheSpi;
this.dataContainer = dataContainer;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.write;
import org.apache.commons.logging.Log;
@@ -37,7 +37,7 @@
import java.util.Map;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#move(org.jboss.cache.Fqn, org.jboss.cache.Fqn)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#move(org.jboss.cache.Fqn, org.jboss.cache.Fqn)}
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -35,7 +35,7 @@
import java.util.Map;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#put(String, java.util.Map)}.
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#put(String, java.util.Map)}.
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -27,7 +27,7 @@
import org.jboss.cache.transaction.GlobalTransaction;
/**
- * Represents the {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn, Object, Object)} method call.
+ * Represents the {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn, Object, Object)} method call.
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 2.2.0
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -35,7 +35,7 @@
import java.util.Map;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#put(org.jboss.cache.Fqn, Object, Object)}.
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#put(org.jboss.cache.Fqn, Object, Object)}.
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -34,7 +34,7 @@
import java.util.Map;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#remove(org.jboss.cache.Fqn, Object)}
+ * Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#remove(org.jboss.cache.Fqn, Object)}
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -32,7 +32,7 @@
import java.util.Map;
/**
- * Implements functionality defined by {@link org.jboss.cache.CacheSPI#removeNode(org.jboss.cache.Fqn)}
+ * Implements functionality defined by {@link org.jboss.cache.CacheSPI_Legacy#removeNode(org.jboss.cache.Fqn)}
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -38,8 +38,6 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.context.ContextFactory;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
@@ -51,7 +49,9 @@
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.context.ContextFactory;
import javax.transaction.InvalidTransactionException;
import javax.transaction.Status;
@@ -351,8 +351,9 @@
{
// create a new transaction transactionContext
if (log.isDebugEnabled()) log.debug("creating new tx transactionContext");
- transactionContext = contextFactory.createTransactionContext(ltx);
- txTable.put(gtx, transactionContext);
+// transactionContext = contextFactory.createTransactionContext(ltx);
+ throw new RuntimeException("Delete this class!");
+// txTable.put(gtx, transactionContext);
}
setTransactionalContext(ltx, gtx, transactionContext, ctx);
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -33,7 +33,7 @@
* This is the base class for all interceptors to extend, and implements the {@link org.jboss.cache.commands.Visitor} interface
* allowing it to intercept invocations on {@link org.jboss.cache.commands.VisitableCommand}s.
* <p/>
- * Commands are created either by the {@link org.jboss.cache.invocation.CacheInvocationDelegate} (for invocations on the {@link org.jboss.cache.Cache}
+ * Commands are created either by the {@link org.jboss.cache.invocation.CacheInvocationDelegate} (for invocations on the {@link org.jboss.cache.Cache_Legacy}
* public interface), the {@link org.jboss.cache.invocation.NodeInvocationDelegate} for invocations on the {@link org.jboss.cache.Node}
* public interface, or by the {@link org.jboss.cache.marshall.CommandAwareRpcDispatcher} for remotely originating invocations, and
* are passed up the interceptor chain by using the {@link org.jboss.cache.interceptors.InterceptorChain} helper class.
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,9 +22,9 @@
package org.jboss.cache.invocation;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
/**
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
@@ -52,7 +52,6 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
@@ -67,6 +66,7 @@
import org.jboss.starobrno.config.Configuration.NodeLockingScheme;
import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jboss.starobrno.factories.annotations.Start;
@@ -87,7 +87,7 @@
* @since 2.1.0
*/
@NonVolatile
-public class CacheInvocationDelegate<K, V> extends AbstractInvocationDelegate implements CacheSPI<K, V>
+public class CacheInvocationDelegate<K, V> extends AbstractInvocationDelegate implements CacheSPI_Legacy<K, V>
{
private static final Log log = LogFactory.getLog(CacheInvocationDelegate.class);
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,9 +22,9 @@
package org.jboss.cache.invocation;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.factories.context.ContextFactory;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.context.ContextFactory;
/**
* Container and factory for thread locals
@@ -46,7 +46,9 @@
@Override
protected InvocationContext initialValue()
{
+ throw new RuntimeException("Delete this class!");
+ // todo - delete this class, do not use!!
// create if this is initially unset
- return contextFactory.createInvocationContext();
+// return contextFactory.createInvocationContext();
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -54,7 +54,7 @@
private static final boolean trace = log.isTraceEnabled();
protected volatile InternalNode<K, V> node;
- private CacheSPI<K, V> spi;
+ private CacheSPI_Legacy<K, V> spi;
public NodeInvocationDelegate(InternalNode<K, V> node)
{
@@ -66,7 +66,7 @@
return node;
}
- public void injectDependencies(CacheSPI<K, V> spi)
+ public void injectDependencies(CacheSPI_Legacy<K, V> spi)
{
this.spi = spi;
}
@@ -242,7 +242,7 @@
return node.getChildrenNames();
}
- public CacheSPI<K, V> getCache()
+ public CacheSPI_Legacy<K, V> getCache()
{
return spi;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,10 +23,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.CacheStatus;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.util.CachePrinter;
import org.jboss.starobrno.CacheException;
@@ -80,7 +80,7 @@
private MBeanServer server;
private String cacheObjectName;
private boolean jmxResourceRegistered;
- private CacheSPI<K, V> cache;
+ private CacheSPI_Legacy<K, V> cache;
private Configuration config;
private boolean registerJmxResource = true;
private final AtomicInteger listenerCount = new AtomicInteger(0);
@@ -113,7 +113,7 @@
cacheStatus = CacheStatus.INSTANTIATED;
}
- public CacheJmxWrapper(Cache<K, V> cache)
+ public CacheJmxWrapper(Cache_Legacy<K, V> cache)
{
this();
setCache(cache);
@@ -121,7 +121,7 @@
// --------------------------------------------------- CacheJmxWrapperMBean
- public Cache<K, V> getCache()
+ public Cache_Legacy<K, V> getCache()
{
return cache;
}
@@ -805,7 +805,7 @@
*
* @param cache
*/
- public void setCache(Cache<K, V> cache)
+ public void setCache(Cache_Legacy<K, V> cache)
{
if (cacheStatus != CacheStatus.INSTANTIATED
&& cacheStatus != CacheStatus.CREATING
@@ -814,7 +814,7 @@
throw new IllegalStateException("Cannot set underlying cache after call to create()");
}
- this.cache = (CacheSPI<K, V>) cache;
+ this.cache = (CacheSPI_Legacy<K, V>) cache;
this.config = (cache == null ? null : cache.getConfiguration());
synchronized (listenerCount)
{
@@ -946,11 +946,12 @@
{
log.debug("Constructing Cache");
CacheFactory<K, V> cf = new DefaultCacheFactory<K, V>();
- setCache(cf.createCache(config, false));
- if (multiplexerService != null)
- {
- injectMuxChannel();
- }
+ throw new UnsupportedOperationException("Fix me to use a flat cache!!");
+// setCache(cf.createCache(config, false));
+// if (multiplexerService != null)
+// {
+// injectMuxChannel();
+// }
}
protected boolean registerJmxResources() throws CacheException
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.jmx;
-import org.jboss.cache.Cache;
import org.jboss.cache.CacheStatus;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jgroups.Address;
@@ -30,7 +30,7 @@
import java.util.List;
/**
- * JMX interface to the {@link org.jboss.cache.Cache}. Full access to the cache is not supported, only a certain
+ * JMX interface to the {@link org.jboss.cache.Cache_Legacy}. Full access to the cache is not supported, only a certain
* set of operations are exposed via JMX:
* <p/>
* <ol>
@@ -108,9 +108,9 @@
int getState();
/**
- * Retrieves a reference to the underlying {@link Cache}
+ * Retrieves a reference to the underlying {@link org.jboss.cache.Cache_Legacy}
*/
- Cache<K, V> getCache();
+ Cache_Legacy<K, V> getCache();
/**
* @return an immutable configuration
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,11 +23,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.Cache_Legacy;
+import org.jboss.starobrno.Cache;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.ComponentRegistry;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
@@ -87,9 +88,14 @@
processBaseName(objectNameBase);
}
+ public JmxRegistrationManager(MBeanServer mBeanServer, Cache_Legacy cache, String objectNameBase)
+ {
+ throw new UnsupportedOperationException("Remove any code that relies on this!");
+ }
+
/**
* @throws IllegalArgumentException if the supplied objectNameBase name isn't valid
- * @see #JmxRegistrationManager(javax.management.MBeanServer, org.jboss.cache.Cache, javax.management.ObjectName)
+ * @see #JmxRegistrationManager(javax.management.MBeanServer, org.jboss.cache.Cache_Legacy , javax.management.ObjectName)
*/
public JmxRegistrationManager(MBeanServer mBeanServer, Cache cache, String objectNameBase)
{
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,6 +22,7 @@
package org.jboss.cache.jmx;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.starobrno.config.Configuration;
import javax.management.JMException;
@@ -61,7 +62,7 @@
}
}
- public static String getDefaultCacheObjectName(org.jboss.cache.Cache cache)
+ public static String getDefaultCacheObjectName(Cache_Legacy cache)
{
// get the cache's registration name
return getDefaultCacheObjectName(cache.getConfiguration(), cache.getClass().getName());
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.NonVolatile;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.Region;
@@ -60,7 +60,7 @@
*/
public abstract class AbstractCacheLoader implements CacheLoader
{
- protected CacheSPI cache;
+ protected CacheSPI_Legacy cache;
protected RegionManager regionManager;
private static final Log log = LogFactory.getLog(AbstractCacheLoader.class);
private static final boolean trace = log.isTraceEnabled();
@@ -166,7 +166,7 @@
}
- public void setCache(CacheSPI c)
+ public void setCache(CacheSPI_Legacy c)
{
this.cache = c;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
@@ -73,7 +73,7 @@
}
@Override
- public void setCache(CacheSPI c)
+ public void setCache(CacheSPI_Legacy c)
{
super.setCache(c);
cacheLoader.setCache(c);
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,7 +22,7 @@
package org.jboss.cache.loader;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
@@ -43,7 +43,7 @@
* <p/>
* Lifecycle: First an instance of the loader is created, then the
* configuration ({@link #setConfig(org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig)}) and cache ({@link
- * #setCache(CacheSPI)}) are set. After this, {@link #create()} is called.
+ * #setCache(org.jboss.cache.CacheSPI_Legacy)}) are set. After this, {@link #create()} is called.
* Then {@link #start()} is called. When re-deployed, {@link #stop()} will be
* called, followed by another {@link #start()}. Finally, when shut down,
* {@link #destroy()} is called, after which the loader is unusable.
@@ -56,7 +56,7 @@
* <p/>
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @see CacheSPI
+ * @see org.jboss.cache.CacheSPI_Legacy
* @see org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig
* @see org.jboss.cache.loader.AbstractCacheLoader
* @since 2.0.0
@@ -84,13 +84,13 @@
IndividualCacheLoaderConfig getConfig();
/**
- * Sets the {@link CacheSPI} that is maintaining this CacheLoader.
- * This method allows this CacheLoader to set a reference to the {@link CacheSPI}.
+ * Sets the {@link org.jboss.cache.CacheSPI_Legacy} that is maintaining this CacheLoader.
+ * This method allows this CacheLoader to set a reference to the {@link org.jboss.cache.CacheSPI_Legacy}.
* This method is called be called after the CacheLoader instance has been constructed.
*
* @param c The cache on which this loader works
*/
- void setCache(CacheSPI c);
+ void setCache(CacheSPI_Legacy c);
/**
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,10 +23,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.util.reflect.ReflectionUtil;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.CacheLoaderConfig;
@@ -34,6 +33,7 @@
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
import org.jboss.starobrno.factories.annotations.Stop;
@@ -83,7 +83,7 @@
{
private static final Log log = LogFactory.getLog(CacheLoaderManager.class);
private CacheLoaderConfig config;
- private CacheSPI cache;
+ private CacheSPI_Legacy cache;
private CacheLoader loader;
private boolean fetchPersistentState;
private Configuration configuration;
@@ -91,11 +91,12 @@
private ComponentRegistry registry;
@Inject
- public void injectDependencies(CacheSPI cache, Configuration configuration, RegionManager regionManager, ComponentRegistry registry)
+ public void injectDependencies(Configuration configuration, RegionManager regionManager, ComponentRegistry registry)
{
+ // TODO: Inject CacheSPI once we have the cache loaders not relying on a tree structure
this.regionManager = regionManager;
this.config = configuration.getCacheLoaderConfig();
- this.cache = cache;
+// this.cache = cache;
this.configuration = configuration;
this.registry = registry;
@@ -119,7 +120,7 @@
* @param cache
* @throws CacheException
*/
- public void setConfig(CacheLoaderConfig config, CacheSPI cache, Configuration configuration) throws CacheException
+ public void setConfig(CacheLoaderConfig config, CacheSPI_Legacy cache, Configuration configuration) throws CacheException
{
this.config = config == null ? configuration.getCacheLoaderConfig() : config;
this.cache = cache;
@@ -221,7 +222,7 @@
* @throws Exception
*/
@SuppressWarnings("deprecation")
- private CacheLoader createCacheLoader(CacheLoaderConfig.IndividualCacheLoaderConfig cfg, CacheSPI cache) throws Exception
+ private CacheLoader createCacheLoader(CacheLoaderConfig.IndividualCacheLoaderConfig cfg, CacheSPI_Legacy cache) throws Exception
{
// create loader
CacheLoader tmpLoader = cfg.getCacheLoader() == null ? createInstance(cfg.getClassName()) : cfg.getCacheLoader();
@@ -288,7 +289,7 @@
* @param c instance of cache to be set in cache loader
* @param loader cache loader to which assign the cache instance
*/
- protected void setCacheInLoader(CacheSPI c, CacheLoader loader)
+ protected void setCacheInLoader(CacheSPI_Legacy c, CacheLoader loader)
{
loader.setCache(c);
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -24,9 +24,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.starobrno.config.CacheLoaderConfig;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import java.io.ObjectInputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
@@ -53,14 +53,14 @@
{
IndividualCacheLoaderConfig config;
- CacheSPI delegate = null;
+ CacheSPI_Legacy delegate = null;
public void setConfig(IndividualCacheLoaderConfig config)
{
this.config = config;
if (config instanceof LocalDelegatingCacheLoaderConfig)
{
- delegate = (CacheSPI) ((LocalDelegatingCacheLoaderConfig) config).getDelegate();
+ delegate = (CacheSPI_Legacy) ((LocalDelegatingCacheLoaderConfig) config).getDelegate();
}
}
@@ -122,7 +122,7 @@
if (node != null) node.clearData();
}
- protected void setDelegateCache(CacheSPI delegate)
+ protected void setDelegateCache(CacheSPI_Legacy delegate)
{
this.delegate = delegate;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.Cache;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
@@ -30,7 +30,7 @@
{
private static final long serialVersionUID = 4626734068542420865L;
- private transient Cache delegate;
+ private transient Cache_Legacy delegate;
public LocalDelegatingCacheLoaderConfig()
{
@@ -74,12 +74,12 @@
return clone;
}
- public Cache getDelegate()
+ public Cache_Legacy getDelegate()
{
return delegate;
}
- public void setDelegate(Cache delegate)
+ public void setDelegate(Cache_Legacy delegate)
{
this.delegate = delegate;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
@@ -158,7 +158,7 @@
* @param c instance of CacheSPI
*/
@Override
- public void setCache(CacheSPI c)
+ public void setCache(CacheSPI_Legacy c)
{
super.setCache(c);
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -40,7 +40,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.loader.AbstractCacheLoader;
@@ -321,7 +321,7 @@
* Sets the CacheImpl owner of this cache loader.
*/
@Override
- public void setCache(CacheSPI c)
+ public void setCache(CacheSPI_Legacy c)
{
super.setCache(c);
checkNotOpen();
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -29,7 +29,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.FqnComparator;
import org.jboss.cache.Modification;
@@ -250,7 +250,7 @@
* Sets the CacheImpl owner of this cache loader.
*/
@Override
- public void setCache(CacheSPI c)
+ public void setCache(CacheSPI_Legacy c)
{
super.setCache(c);
checkNotOpen();
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,8 +23,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
@@ -63,7 +63,7 @@
private ServerSocket srv_sock;
private InetAddress bind_addr = null;
private int port = 7500;
- private CacheSPI cache;
+ private CacheSPI_Legacy cache;
private CacheJmxWrapperMBean wrapper;
private String config;
private boolean running = true;
@@ -109,12 +109,12 @@
this.config = config;
}
- public Cache getCache()
+ public Cache_Legacy getCache()
{
return cache;
}
- public void setCache(CacheSPI cache)
+ public void setCache(CacheSPI_Legacy cache)
{
this.cache = cache;
}
@@ -131,7 +131,7 @@
// cache not directly set; get from wrapper or create from config
if (wrapper != null)
{
- cache = (CacheSPI) wrapper.getCache();
+ cache = (CacheSPI_Legacy) wrapper.getCache();
if (cache == null)
{
@@ -142,7 +142,7 @@
}
else if (config != null)
{
- cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(this.config);
+ cache = (CacheSPI_Legacy) new DefaultCacheFactory<Object, Object>().createCache(this.config);
}
}
@@ -255,10 +255,10 @@
private Socket sock = null;
private ObjectInputStream input = null;
private ObjectOutputStream output = null;
- private CacheSPI c;
+ private CacheSPI_Legacy c;
private Thread t = null;
- public Connection(Socket sock, CacheSPI cache) throws IOException
+ public Connection(Socket sock, CacheSPI_Legacy cache) throws IOException
{
this.sock = sock;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServerMBean.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServerMBean.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServerMBean.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader.tcp;
-import org.jboss.cache.Cache;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.jmx.CacheJmxWrapperMBean;
import java.net.UnknownHostException;
@@ -55,7 +55,7 @@
void setConfig(String config);
- Cache getCache();
+ Cache_Legacy getCache();
void setCacheJmxWrapper(CacheJmxWrapperMBean wrapper);
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -72,14 +72,14 @@
LockContainer<Fqn> lockContainer;
DataContainer dataContainer;
private Set<Fqn> internalFqns;
- private CacheSPI<?, ?> cache;
+ private CacheSPI_Legacy<?, ?> cache;
private TransactionManager transactionManager;
private InvocationContextContainer invocationContextContainer;
private static final Log log = LogFactory.getLog(MVCCLockManager.class);
private static final boolean trace = log.isTraceEnabled();
@Inject
- public void injectDependencies(DataContainer dataContainer, CacheSPI cache, TransactionManager transactionManager, InvocationContextContainer invocationContextContainer)
+ public void injectDependencies(DataContainer dataContainer, CacheSPI_Legacy cache, TransactionManager transactionManager, InvocationContextContainer invocationContextContainer)
{
this.dataContainer = dataContainer;
this.cache = cache;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -81,10 +81,10 @@
protected boolean useRefs = false;
@Inject
- void injectDependencies(RegionManager regionManager, Configuration configuration, ClassLoader defaultClassLoader)
+ void injectDependencies(Configuration configuration, ClassLoader defaultClassLoader)
{
this.defaultClassLoader = defaultClassLoader;
- this.regionManager = regionManager;
+ this.regionManager = null;
this.configuration = configuration;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -27,11 +27,11 @@
import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.MembershipListener;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,9 +22,9 @@
package org.jboss.cache.marshall;
import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jgroups.Channel;
import org.jgroups.MembershipListener;
import org.jgroups.Message;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -24,10 +24,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.io.ByteBuffer;
import org.jboss.cache.io.ExposedByteArrayOutputStream;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
import org.jboss.util.stream.MarshalledValueInputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,7 +22,7 @@
package org.jboss.cache.mvcc;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
import org.jboss.cache.Node;
@@ -81,7 +81,7 @@
return delegate.getParent();
}
- public final CacheSPI<K, V> getCache()
+ public final CacheSPI_Legacy<K, V> getCache()
{
return delegate.getCache();
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -24,7 +24,7 @@
import org.jboss.starobrno.CacheException;
/**
- * Thrown when an incorrectly annotated class is added as a cache listener using the {@link org.jboss.cache.Cache#addCacheListener(Object)} API.
+ * Thrown when an incorrectly annotated class is added as a cache listener using the {@link org.jboss.cache.Cache_Legacy#addCacheListener(Object)} API.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
* @since 2.0.0
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,18 +23,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.marshall.MarshalledValueMap;
import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.*;
-import static org.jboss.cache.notifications.event.Event.Type.*;
import org.jboss.cache.util.Immutables;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
+import org.jboss.starobrno.Cache;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Destroy;
import org.jboss.starobrno.factories.annotations.Inject;
@@ -318,7 +317,7 @@
e.setPre(pre);
e.setFqn(fqn);
e.setTransaction(tx);
- e.setType(NODE_CREATED);
+// // e.setType(NODE_CREATED);
for (ListenerInvocation listener : nodeCreatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -340,7 +339,7 @@
e.setTransaction(tx);
e.setModificationType(modificationType);
e.setData(dataCopy);
- e.setType(NODE_MODIFIED);
+// // e.setType(NODE_MODIFIED);
for (ListenerInvocation listener : nodeModifiedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -366,7 +365,7 @@
e.setFqn(fqn);
e.setTransaction(tx);
e.setData(dataCopy);
- e.setType(NODE_REMOVED);
+// // e.setType(NODE_REMOVED);
for (ListenerInvocation listener : nodeRemovedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -383,7 +382,7 @@
e.setPre(pre);
e.setFqn(fqn);
e.setTransaction(tx);
- e.setType(NODE_VISITED);
+// // e.setType(NODE_VISITED);
for (ListenerInvocation listener : nodeVisitedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -403,7 +402,7 @@
e.setFqn(originalFqn);
e.setTargetFqn(newFqn);
e.setTransaction(tx);
- e.setType(NODE_MOVED);
+// // e.setType(NODE_MOVED);
for (ListenerInvocation listener : nodeMovedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -422,7 +421,7 @@
e.setPre(pre);
e.setFqn(fqn);
e.setTransaction(tx);
- e.setType(NODE_EVICTED);
+ // e.setType(NODE_EVICTED);
for (ListenerInvocation listener : nodeEvictedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -441,7 +440,7 @@
e.setPre(pre);
e.setFqn(fqn);
e.setTransaction(tx);
- e.setType(NODE_INVALIDATED);
+ // e.setType(NODE_INVALIDATED);
for (ListenerInvocation listener : nodeInvalidatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -462,7 +461,7 @@
e.setFqn(fqn);
e.setTransaction(tx);
e.setData(dataCopy);
- e.setType(NODE_LOADED);
+ // e.setType(NODE_LOADED);
for (ListenerInvocation listener : nodeLoadedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -483,7 +482,7 @@
e.setFqn(fqn);
e.setTransaction(tx);
e.setData(dataCopy);
- e.setType(NODE_ACTIVATED);
+ // e.setType(NODE_ACTIVATED);
for (ListenerInvocation listener : nodeActivatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -502,7 +501,7 @@
e.setFqn(fqn);
e.setTransaction(tx);
e.setData(dataCopy);
- e.setType(NODE_PASSIVATED);
+ // e.setType(NODE_PASSIVATED);
for (ListenerInvocation listener : nodePassivatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -518,7 +517,7 @@
{
EventImpl e = new EventImpl();
e.setCache(cache);
- e.setType(CACHE_STARTED);
+ // e.setType(CACHE_STARTED);
for (ListenerInvocation listener : cacheStartedListeners) listener.invoke(e);
}
}
@@ -533,7 +532,7 @@
{
EventImpl e = new EventImpl();
e.setCache(cache);
- e.setType(CACHE_STOPPED);
+ // e.setType(CACHE_STOPPED);
for (ListenerInvocation listener : cacheStoppedListeners) listener.invoke(e);
}
}
@@ -546,7 +545,7 @@
EventImpl e = new EventImpl();
e.setCache(cache);
e.setNewView(newView);
- e.setType(VIEW_CHANGED);
+ // e.setType(VIEW_CHANGED);
for (ListenerInvocation listener : viewChangedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -560,7 +559,7 @@
e.setCache(cache);
e.setBuddyGroup(buddyGroup);
e.setPre(pre);
- e.setType(BUDDY_GROUP_CHANGED);
+ // e.setType(BUDDY_GROUP_CHANGED);
for (ListenerInvocation listener : buddyGroupChangedListeners) listener.invoke(e);
}
}
@@ -576,7 +575,7 @@
e.setOriginLocal(isOriginLocal);
e.setTransaction(transaction);
e.setSuccessful(successful);
- e.setType(TRANSACTION_COMPLETED);
+ // e.setType(TRANSACTION_COMPLETED);
for (ListenerInvocation listener : transactionCompletedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -592,7 +591,7 @@
e.setCache(cache);
e.setOriginLocal(isOriginLocal);
e.setTransaction(transaction);
- e.setType(TRANSACTION_REGISTERED);
+ // e.setType(TRANSACTION_REGISTERED);
for (ListenerInvocation listener : transactionRegisteredListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -605,7 +604,7 @@
EventImpl e = new EventImpl();
e.setCache(this.cache);
e.setPre(pre);
- e.setType(CACHE_BLOCKED);
+ // e.setType(CACHE_BLOCKED);
for (ListenerInvocation listener : cacheBlockedListeners) listener.invoke(e);
}
}
@@ -617,7 +616,7 @@
EventImpl e = new EventImpl();
e.setCache(this.cache);
e.setPre(pre);
- e.setType(CACHE_UNBLOCKED);
+ // e.setType(CACHE_UNBLOCKED);
for (ListenerInvocation listener : cacheUnblockedListeners) listener.invoke(e);
}
}
@@ -633,9 +632,13 @@
private void restoreInvocationContext(InvocationContext backup)
{
- InvocationContext currentIC = cache.getInvocationContext();
- backup.putLookedUpNodes(currentIC.getLookedUpNodes());
- cache.setInvocationContext(backup);
+// InvocationContext currentIC = cache.getInvocationContext();
+// backup.clearLookedUpEntries();
+// for (MVCCEntry me : currentIC.getLookedUpEntries().values())
+// {
+// backup.putLookedUpEntry(me);
+// }
+// cache.setInvocationContext(backup);
}
/**
@@ -650,8 +653,11 @@
// wipe current context.
cache.setInvocationContext(null);
// get a new Invocation Context
- InvocationContext newContext = cache.getInvocationContext();
- newContext.putLookedUpNodes(ctx.getLookedUpNodes());
+// InvocationContext newContext = cache.getInvocationContext();
+// for (MVCCEntry me : ctx.getLookedUpEntries().values())
+// {
+// newContext.putLookedUpEntry(me);
+// }
return ctx;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/CacheListener.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/CacheListener.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/CacheListener.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -28,13 +28,13 @@
/**
* Class-level annotation used to annotate an object as being a valid cache listener. Used with the
- * {@link org.jboss.cache.Cache#addCacheListener(Object)} and related APIs.
+ * {@link org.jboss.cache.Cache_Legacy#addCacheListener(Object)} and related APIs.
* <p/>
* Note that even if a class is annotated with this annotation, it still needs method-level annotation (such as
* {@link org.jboss.cache.notifications.annotation.CacheStarted}) to actually receive notifications.
* <p/>
- * Objects annotated with this annotation - listeners - can be attached to a running {@link org.jboss.cache.Cache} so
- * users can be notified of {@link org.jboss.cache.Cache} events.
+ * Objects annotated with this annotation - listeners - can be attached to a running {@link org.jboss.cache.Cache_Legacy} so
+ * users can be notified of {@link org.jboss.cache.Cache_Legacy} events.
* <p/>
* <p/>
* There can be multiple methods that are annotated to receive the same event,
@@ -313,9 +313,9 @@
* @see TransactionRegistered
* @see BuddyGroupChanged
* @see NodeInvalidated
- * @see org.jboss.cache.Cache#addCacheListener(Object)
- * @see org.jboss.cache.Cache#removeCacheListener(Object)
- * @see org.jboss.cache.Cache#getCacheListeners()
+ * @see org.jboss.cache.Cache_Legacy#addCacheListener(Object)
+ * @see org.jboss.cache.Cache_Legacy#removeCacheListener(Object)
+ * @see org.jboss.cache.Cache_Legacy#getCacheListeners()
* @since 2.0.0
*/
@Retention(RetentionPolicy.RUNTIME)
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/NodeMoved.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/NodeMoved.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/annotation/NodeMoved.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -27,7 +27,7 @@
import java.lang.annotation.Target;
/**
- * This annotation should be used on methods that need to be notified when a node is moved using the {@link org.jboss.cache.Cache#move(org.jboss.cache.Fqn,org.jboss.cache.Fqn)}
+ * This annotation should be used on methods that need to be notified when a node is moved using the {@link org.jboss.cache.Cache_Legacy#move(org.jboss.cache.Fqn,org.jboss.cache.Fqn)}
* API.
* <p/>
* Methods annotated with this annotation should accept a single
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/event/Event.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/event/Event.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/event/Event.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.notifications.event;
-import org.jboss.cache.Cache;
+import org.jboss.starobrno.Cache;
/**
* An interface that defines common characteristics of events
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/event/EventImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/event/EventImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/event/EventImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,9 +21,9 @@
*/
package org.jboss.cache.notifications.event;
-import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.starobrno.Cache;
import org.jgroups.View;
import javax.transaction.Transaction;
Modified: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
import org.jboss.cache.Node;
@@ -31,7 +31,6 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
-import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
import java.io.IOException;
@@ -48,15 +47,16 @@
private Log log = LogFactory.getLog(getClass().getName());
- private CacheSPI cache;
+ private CacheSPI_Legacy cache;
private Set<Fqn> internalFqns;
- @Inject
- public void inject(CacheSPI cache)
- {
- this.cache = cache;
- }
+ // TODO: Inject CacheSPI when we have this working properly when we have State Transfer not relying on a tree struct.
+// @Inject
+// public void inject(CacheSPI_Legacy cache)
+// {
+// this.cache = cache;
+// }
@Start(priority = 14)
private void start()
Modified: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
import org.jboss.cache.InvocationContext;
@@ -56,16 +56,17 @@
private static final Log log = LogFactory.getLog(DefaultStateTransferIntegrator.class);
private static final boolean trace = log.isTraceEnabled();
- private CacheSPI<?, ?> cache;
+ private CacheSPI_Legacy<?, ?> cache;
private Set<Fqn> internalFqns;
private Configuration cfg;
private boolean needToPersistState; // for JBCACHE-131
@Inject
- public void inject(CacheSPI<?, ?> cache, Configuration cfg)
+ public void inject(Configuration cfg)
{
- this.cache = cache;
+ // TODO: Inject CacheSPI when we have this working properly when we have State Transfer not relying on a tree struct.
+// this.cache = cache;
this.cfg = cfg;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,18 +23,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
-import org.jboss.cache.InternalNode;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.RegionEmptyException;
import org.jboss.cache.RegionManager;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.marshall.InactiveRegionException;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataMarker;
-import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
@@ -88,6 +84,9 @@
public void getState(ObjectOutputStream out, Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Exception
{
+ throw new UnsupportedOperationException("Implement me properly!");
+ /*
+
// can't give state for regions currently being activated/inactivated
boolean canProvideState = (!regionManager.isInactive(fqn) && cache.peek(fqn, false) != null);
if (trace) log.trace("Can provide state? " + canProvideState);
@@ -132,10 +131,13 @@
marshaller.objectToObjectStream(e, out);
if (e != null) throw e;
}
+ */
}
public void setState(ObjectInputStream in, Fqn targetRoot) throws Exception
{
+ throw new UnsupportedOperationException("fix me!");
+ /*
cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
NodeSPI target = cache.getNode(targetRoot);
if (target == null)
@@ -160,6 +162,7 @@
throw new CacheException("Cache instance at " + cache.getLocalAddress()
+ " cannot integrate state since state provider could not provide state due to " + marshaller.objectFromObjectStream(in));
}
+ */
}
/**
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -187,7 +187,7 @@
/**
* Gets the value of the forceAsyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
*
* @return true if the forceAsyncReplication flag is set to true.
@@ -196,7 +196,7 @@
/**
* Sets the value of the forceAsyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context. Also used by OptimisticReplicationInterceptor when dealing
* with {@link org.jboss.cache.config.Option#setForceAsynchronous(boolean)} in a
* non-transactional context (i.e. with an implicit transaction).
@@ -207,7 +207,7 @@
/**
* Gets the value of the forceSyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
*
* @return true if the forceAsyncReplication flag is set to true.
@@ -216,7 +216,7 @@
/**
* Sets the value of the forceSyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
*
* @param forceSyncReplication value of forceSyncReplication
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,12 +21,10 @@
*/
package org.jboss.cache.transaction;
-import org.jboss.cache.Cache;
-
import javax.transaction.TransactionManager;
/**
- * Factory interface, allows {@link Cache} to use different transactional systems.
+ * Factory interface, allows {@link org.jboss.cache.Cache_Legacy} to use different transactional systems.
* Names of implementors of this class can be configured using
* {@link Configuration#setTransactionManagerLookupClass}.
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -25,10 +25,10 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.RPCManager;
-import org.jboss.cache.factories.context.ContextFactory;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.context.ContextFactory;
import org.jgroups.Address;
import javax.transaction.Status;
@@ -408,18 +408,19 @@
TransactionContext transactionContext;
try
{
- transactionContext = contextFactory.createTransactionContext(tx);
+ throw new RuntimeException("Delete this class!");
+// transactionContext = null; // contextFactory.createTransactionContext(tx); // todo do not use, delete this class!
}
catch (Exception e)
{
throw new CacheException("Unable to create a transaction entry!", e);
}
- put(gtx, transactionContext);
- if (trace)
- {
- log.trace("created new GTX: " + gtx + ", local TX=" + tx);
- }
+// put(gtx, transactionContext);
+// if (trace)
+// {
+// log.trace("created new GTX: " + gtx + ", local TX=" + tx);
+// }
}
return gtx;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,15 +21,15 @@
*/
package org.jboss.cache.util;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.DataContainer;
import org.jboss.cache.DataContainerImpl;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
/**
- * Helper that prints the contents of a {@link org.jboss.cache.Cache} to a string.
+ * Helper that prints the contents of a {@link org.jboss.cache.Cache_Legacy} to a string.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
* @since 2.0.0
@@ -42,7 +42,7 @@
* @param c cache to print
* @return a String representation of the cache
*/
- public static String printCacheDetails(Cache c)
+ public static String printCacheDetails(Cache_Legacy c)
{
// internal cast
DataContainer ci = ((CacheInvocationDelegate) c).getDataContainer();
@@ -55,14 +55,14 @@
* @param c cache to print
* @return a String representation of the cache
*/
- public static String printCacheLockingInfo(Cache c)
+ public static String printCacheLockingInfo(Cache_Legacy c)
{
// internal cast
DataContainerImpl cd = (DataContainerImpl) ((CacheInvocationDelegate) c).getDataContainer();
return cd.printLockInfo();
}
- public static String printCacheInterceptors(CacheSPI<?, ?> cache)
+ public static String printCacheInterceptors(CacheSPI_Legacy<?, ?> cache)
{
StringBuilder b = new StringBuilder();
int index = 0;
Modified: core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/Caches.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.util;
-import org.jboss.cache.Cache;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
@@ -35,7 +35,7 @@
import java.util.Set;
/**
- * Adaptors for {@link Cache} classes, such as {@link Node}.
+ * Adaptors for {@link org.jboss.cache.Cache_Legacy} classes, such as {@link Node}.
* This is useful for integration of JBoss Cache into existing applications.
* <p/>
* Example use:
@@ -61,7 +61,7 @@
* @return a map representation of the cache
* @see #asMap(Node)
*/
- public static <K, V> Map<K, V> asMap(Cache<K, V> cache)
+ public static <K, V> Map<K, V> asMap(Cache_Legacy<K, V> cache)
{
if (cache == null) throw new NullPointerException("cache");
return asMap(cache.getRoot());
@@ -179,7 +179,7 @@
* @param cache cache to use
* @return a Map representation of the cache
*/
- public static <K, V> Map<K, V> asPartitionedMap(Cache<K, V> cache)
+ public static <K, V> Map<K, V> asPartitionedMap(Cache_Legacy<K, V> cache)
{
return asPartitionedMap(cache.getRoot());
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/Cache.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,6 +21,7 @@
*/
package org.jboss.starobrno;
+import org.jboss.cache.CacheStatus;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.lifecycle.Lifecycle;
@@ -50,4 +51,6 @@
AtomicGroup putAtomicGroup(K key, AtomicGroup group);
AtomicGroup getAtomicGroup(K key);
+
+ CacheStatus getCacheStatus();
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheDelegate.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,6 +21,13 @@
*/
package org.jboss.starobrno;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.buddyreplication.GravitateResult;
+import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.loader.CacheLoaderManager;
+import org.jboss.cache.marshall.Marshaller;
+import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.starobrno.commands.CommandsFactory;
import org.jboss.starobrno.commands.read.GetKeyValueCommand;
import org.jboss.starobrno.commands.read.SizeCommand;
@@ -32,30 +39,56 @@
import org.jboss.starobrno.commands.write.ReplaceCommand;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.context.InvocationContext;
+import org.jboss.starobrno.factories.ComponentRegistry;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jboss.starobrno.interceptors.InterceptorChain;
import org.jboss.starobrno.invocation.InvocationContextContainer;
import org.jboss.starobrno.notifier.Notifier;
+import org.jboss.starobrno.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.TransactionTable;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Mircea.Markus at jboss.com
*/
-public class CacheDelegate implements Cache
+ at NonVolatile
+public class CacheDelegate<K, V> implements CacheSPI<K, V>
{
protected InvocationContextContainer invocationContextContainer;
protected CommandsFactory commandsFactory;
protected InterceptorChain invoker;
protected Configuration config;
protected Notifier notifier;
+ protected ComponentRegistry componentRegistry;
- public Object putIfAbsent(Object key, Object value)
+ @Inject
+ private void injectDependencies(InvocationContextContainer invocationContextContainer,
+ CommandsFactory commandsFactory,
+ InterceptorChain interceptorChain,
+ Configuration configuration,
+ Notifier notifier,
+ ComponentRegistry componentRegistry)
{
+ this.invocationContextContainer = invocationContextContainer;
+ this.commandsFactory = commandsFactory;
+ this.invoker = interceptorChain;
+ this.config = configuration;
+ this.notifier = notifier;
+ this.componentRegistry = componentRegistry;
+ }
+
+ public V putIfAbsent(K key, V value)
+ {
PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value);
command.setPutIfAbsent(true);
- return invoker.invoke(buildCtx(), command);
+ return (V) invoker.invoke(buildCtx(), command);
}
public boolean remove(Object key, Object value)
@@ -64,16 +97,16 @@
return (Boolean) invoker.invoke(buildCtx(), command);
}
- public boolean replace(Object key, Object oldValue, Object newValue)
+ public boolean replace(K key, V oldValue, V newValue)
{
ReplaceCommand command = commandsFactory.buildReplaceCommand(key, oldValue, newValue);
return (Boolean) invoker.invoke(buildCtx(), command);
}
- public Object replace(Object key, Object value)
+ public V replace(K key, V value)
{
ReplaceCommand command = commandsFactory.buildReplaceCommand(key, value, null);
- return invoker.invoke(buildCtx(), command);
+ return (V) invoker.invoke(buildCtx(), command);
}
public int size()
@@ -100,25 +133,25 @@
throw new UnsupportedOperationException("Go away");
}
- public Object get(Object key)
+ public V get(Object key)
{
GetKeyValueCommand command = commandsFactory.buildGetKeyValueCommand(key);
- return invoker.invoke(buildCtx(), command);
+ return (V) invoker.invoke(buildCtx(), command);
}
- public Object put(Object key, Object value)
+ public V put(K key, V value)
{
PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value);
- return invoker.invoke(buildCtx(), command);
+ return (V) invoker.invoke(buildCtx(), command);
}
- public Object remove(Object key)
+ public V remove(Object key)
{
RemoveCommand command = commandsFactory.buildRemoveCommand(key, null);
- return invoker.invoke(buildCtx(), command);
+ return (V) invoker.invoke(buildCtx(), command);
}
- public void putAll(Map t)
+ public void putAll(Map<? extends K, ? extends V> t)
{
PutMapCommand command = commandsFactory.buildPutMapCommand(t);
invoker.invoke(buildCtx(), command);
@@ -145,7 +178,7 @@
throw new UnsupportedOperationException("Go away");
}
- public void evict(Object key)
+ public void evict(K key)
{
EvictCommand command = commandsFactory.buildEvictCommand(key);
invoker.invoke(buildCtx(), command);
@@ -182,12 +215,12 @@
else invocationContextContainer.set(ctx);
}
- public AtomicGroup putAtomicGroup(Object key, AtomicGroup group)
+ public AtomicGroup putAtomicGroup(K key, AtomicGroup group)
{
return null; //TODO: Autogenerated. Implement me properly
}
- public AtomicGroup getAtomicGroup(Object key)
+ public AtomicGroup getAtomicGroup(K key)
{
return null; //TODO: Autogenerated. Implement me properly
}
@@ -206,4 +239,99 @@
{
return invocationContextContainer.get();
}
+
+ public TransactionManager getTransactionManager()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public List<CommandInterceptor> getInterceptorChain()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public Marshaller getMarshaller()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public void addInterceptor(CommandInterceptor i, int position)
+ {
+ //TODO: Autogenerated. Implement me properly
+ }
+
+ public void addInterceptor(CommandInterceptor i, Class<? extends CommandInterceptor> afterInterceptor)
+ {
+ //TODO: Autogenerated. Implement me properly
+ }
+
+ public void removeInterceptor(int position)
+ {
+ //TODO: Autogenerated. Implement me properly
+ }
+
+ public void removeInterceptor(Class<? extends CommandInterceptor> interceptorType)
+ {
+ //TODO: Autogenerated. Implement me properly
+ }
+
+ public CacheLoaderManager getCacheLoaderManager()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public BuddyManager getBuddyManager()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public TransactionTable getTransactionTable()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public Object getRPCManager()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public StateTransferManager getStateTransferManager()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public org.jboss.cache.notifications.Notifier getNotifier()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public String getClusterName()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public GlobalTransaction getCurrentTransaction(Transaction tx, boolean createIfNotExists)
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public GlobalTransaction getCurrentTransaction()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public GravitateResult gravitateData(K key, boolean searchBuddyBackupSubtrees, InvocationContext ctx)
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public ComponentRegistry getComponentRegistry()
+ {
+ return null; //TODO: Autogenerated. Implement me properly
+ }
+
+ public CacheStatus getCacheStatus()
+ {
+ return componentRegistry.getState();
+ }
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/CacheException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheException.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheException.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,7 +22,7 @@
package org.jboss.starobrno;
/**
- * Thrown when operations on {@link org.jboss.cache.Cache} or {@link org.jboss.cache.Node} fail unexpectedly.
+ * Thrown when operations on {@link Cache} or {@link org.jboss.cache.Node} fail unexpectedly.
* <p/>
* Specific subclasses such as {@link org.jboss.cache.lock.TimeoutException}, {@link org.jboss.cache.config.ConfigurationException} and {@link org.jboss.cache.lock.LockingException}
* have more specific uses.
Deleted: core/branches/flat/src/main/java/org/jboss/starobrno/CacheImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheImpl.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,200 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.starobrno;
-
-import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.context.InvocationContext;
-import org.jboss.util.NotImplementedException;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author Mircea.Markus at jboss.com
- */
-public class CacheImpl implements Cache
-{
- private ConcurrentHashMap data = new ConcurrentHashMap();
- private Map<String, AtomicGroup> atomicGroups = new ConcurrentHashMap<String, AtomicGroup>();
-// private CacheConfig cacheConfig;
-
-// public CacheImpl(CacheConfig cacheConfig)
-// {
-// this.cacheConfig = cacheConfig;
-// }
-
- public Object putIfAbsent(Object key, Object value)
- {
- return data.putIfAbsent(key, value);
- }
-
- public boolean remove(Object key, Object value)
- {
- return data.remove(key, value);
- }
-
- public boolean replace(Object key, Object oldValue, Object newValue)
- {
- return data.replace(key, oldValue, newValue);
- }
-
- public Object replace(Object key, Object value)
- {
- return data.replace(key, value);
- }
-
- public int size()
- {
- throw new NotImplementedException("not impl!");
- }
-
- public boolean isEmpty()
- {
- throw new NotImplementedException("not impl!");
- }
-
- public boolean containsKey(Object key)
- {
- return false;
- }
-
- public boolean containsValue(Object value)
- {
- return data.contains(value);
- }
-
- public Object get(Object key)
- {
- return data.get(key);
- }
-
- public Object put(Object key, Object value)
- {
- return data.put(key, value);
- }
-
- public Object remove(Object key)
- {
- return data.remove(key);
- }
-
- public void putAll(Map t)
- {
- data.putAll(t);
- }
-
- public void clear()
- {
- data.clear();
- }
-
- public Set keySet()
- {
- throw new NotImplementedException("not impl!");
- }
-
- public Collection values()
- {
- throw new NotImplementedException("not impl!");
- }
-
- public Set entrySet()
- {
- throw new NotImplementedException("not impl!");
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- CacheImpl cache = (CacheImpl) o;
-
- if (data != null ? !data.equals(cache.data) : cache.data != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- return (data != null ? data.hashCode() : 0);
- }
-
- public void evict(Object key)
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- public Configuration getConfiguration()
- {
- return null; //TODO: Autogenerated. Implement me properly
- }
-
- public void addCacheListener(Object listener)
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- public void removeCacheListener(Object listener)
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- public Set getCacheListeners()
- {
- return null; //TODO: Autogenerated. Implement me properly
- }
-
- public InvocationContext getInvocationContext()
- {
- return null; //TODO: Autogenerated. Implement me properly
- }
-
- public void setInvocationContext(InvocationContext ctx)
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- public void start()
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- public void stop()
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- public AtomicGroup getAtomicGroup(Object key)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public AtomicGroup putAtomicGroup(Object key, AtomicGroup group)
- {
- // TODO Auto-generated method stub
- return null;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/starobrno/CacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheManager.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.starobrno;
-
-import org.jboss.starobrno.config.Configuration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Mircea.Markus at jboss.com
- */
-public class CacheManager
-{
- private Configuration config;
- private Map<String, CacheImpl> caches = new HashMap<String, CacheImpl>();
-
- public CacheManager(Configuration config)
- {
- this.config = config;
- }
-
- public CacheImpl getCache(String confName)
- {
- return null; // TODO
-
- /*
- if (caches.containsKey(confName)) return caches.get(confName);
-
- CacheConfig config = this.config.getCacheConfig(confName);
- if (config == null) throw new IllegalArgumentException("No such cache config: " + confName);
- CacheImpl result = new CacheImpl(config);
- caches.put(confName, result);
- return result;*/
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -24,21 +24,20 @@
import net.jcip.annotations.ThreadSafe;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.statetransfer.StateTransferManager;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.context.InvocationContext;
+import org.jboss.starobrno.factories.ComponentRegistry;
+import org.jboss.starobrno.transaction.GlobalTransaction;
+import org.jboss.starobrno.transaction.TransactionTable;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.List;
-import java.util.Set;
/**
* A more detailed interface to {@link Cache}, which is used when writing plugins for or extending JBoss Cache. A reference
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/ReplicationException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/ReplicationException.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/ReplicationException.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,9 +21,6 @@
*/
package org.jboss.starobrno;
-import org.jboss.cache.*;
-import org.jboss.cache.CacheException;
-
/**
* Thrown when a replication problem occurred
*/
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/TxInterceptor.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,6 @@
*/
package org.jboss.starobrno;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
import org.jboss.starobrno.commands.CommandsFactory;
import org.jboss.starobrno.commands.ReplicableCommand;
@@ -29,22 +28,31 @@
import org.jboss.starobrno.commands.tx.CommitCommand;
import org.jboss.starobrno.commands.tx.PrepareCommand;
import org.jboss.starobrno.commands.tx.RollbackCommand;
+import org.jboss.starobrno.config.Option;
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.context.TransactionContext;
+import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.context.ContextFactory;
import org.jboss.starobrno.interceptors.BaseTransactionalContextInterceptor;
import org.jboss.starobrno.invocation.InvocationContextContainer;
+import org.jboss.starobrno.jmx.annotations.ManagedAttribute;
+import org.jboss.starobrno.jmx.annotations.ManagedOperation;
import org.jboss.starobrno.lock.LockManager;
import org.jboss.starobrno.notifier.Notifier;
import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.transaction.TransactionTable;
-import org.jboss.starobrno.jmx.annotations.ManagedOperation;
-import org.jboss.starobrno.jmx.annotations.ManagedAttribute;
-import org.jboss.starobrno.config.Option;
-import javax.transaction.*;
-import java.util.*;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,8 +23,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.DataContainer;
import org.jboss.starobrno.commands.Visitor;
import org.jboss.starobrno.context.InvocationContext;
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -27,7 +27,7 @@
import org.jboss.starobrno.mvcc.MVCCEntry;
/**
- * Implements functionality defined by {@link org.jboss.cache.Cache#put(org.jboss.cache.Fqn, Object, Object)}.
+ * Implements functionality defined by {@link Cache#put(org.jboss.cache.Fqn, Object, Object)}.
*
* @author Mircea.Markus at jboss.com
* @since 2.2
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/config/Configuration.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/config/Configuration.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/config/Configuration.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -298,8 +298,8 @@
}
/**
- * Enables invocation batching if set to <tt>true</tt>. You still need to use {@link org.jboss.cache.Cache#startBatch()}
- * and {@link org.jboss.cache.Cache#endBatch(boolean)} to demarcate the start and end of batches.
+ * Enables invocation batching if set to <tt>true</tt>. You still need to use {@link org.jboss.cache.Cache_Legacy#startBatch()}
+ * and {@link org.jboss.cache.Cache_Legacy#endBatch(boolean)} to demarcate the start and end of batches.
*
* @param enabled if true, batching is enabled.
* @since 3.0
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/config/ConfigurationComponent.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/config/ConfigurationComponent.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/config/ConfigurationComponent.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,8 +23,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/context/TransactionContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/context/TransactionContext.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/context/TransactionContext.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,8 +21,8 @@
*/
package org.jboss.starobrno.context;
+import org.jboss.starobrno.OrderedSynchronizationHandler;
import org.jboss.starobrno.commands.VisitableCommand;
-import org.jboss.starobrno.OrderedSynchronizationHandler;
import org.jboss.starobrno.config.Option;
import javax.transaction.Transaction;
@@ -186,7 +186,7 @@
/**
* Gets the value of the forceAsyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
*
* @return true if the forceAsyncReplication flag is set to true.
@@ -195,7 +195,7 @@
/**
* Sets the value of the forceAsyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context. Also used by OptimisticReplicationInterceptor when dealing
* with {@link org.jboss.cache.config.Option#setForceAsynchronous(boolean)} in a
* non-transactional context (i.e. with an implicit transaction).
@@ -206,7 +206,7 @@
/**
* Gets the value of the forceSyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
*
* @return true if the forceAsyncReplication flag is set to true.
@@ -215,7 +215,7 @@
/**
* Sets the value of the forceSyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
- * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+ * when dealing with {@link org.jboss.cache.Cache_Legacy#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
*
* @param forceSyncReplication value of forceSyncReplication
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/eviction/BaseEvictionAlgorithm.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/eviction/BaseEvictionAlgorithm.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/eviction/BaseEvictionAlgorithm.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.starobrno.config.Configuration;
@@ -61,7 +61,7 @@
protected boolean allowTombstones = false;
protected Configuration configuration;
protected Fqn regionFqn;
- protected CacheSPI<?, ?> cache;
+ protected CacheSPI_Legacy<?, ?> cache;
/**
* This method will create an EvictionQueue implementation and prepare it for use.
@@ -110,7 +110,7 @@
return evictionAlgorithmConfig;
}
- public void assignToRegion(Fqn fqn, CacheSPI<?, ?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration)
+ public void assignToRegion(Fqn fqn, CacheSPI_Legacy<?, ?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration)
{
this.regionFqn = fqn;
this.cache = cache;
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/eviction/DefaultEvictionActionPolicy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/eviction/DefaultEvictionActionPolicy.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/eviction/DefaultEvictionActionPolicy.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,21 +23,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.Fqn;
/**
- * Default eviction action policy that calls {@link org.jboss.cache.Cache#evict(org.jboss.cache.Fqn)} to evict a node.
+ * Default eviction action policy that calls {@link org.jboss.cache.Cache_Legacy#evict(org.jboss.cache.Fqn)} to evict a node.
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 3.0
*/
public class DefaultEvictionActionPolicy implements EvictionActionPolicy
{
- Cache<?, ?> cache;
+ Cache_Legacy<?, ?> cache;
private static final Log log = LogFactory.getLog(DefaultEvictionActionPolicy.class);
- public void setCache(Cache<?, ?> cache)
+ public void setCache(Cache_Legacy<?, ?> cache)
{
this.cache = cache;
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionActionPolicy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionActionPolicy.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionActionPolicy.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.starobrno.eviction;
-import org.jboss.cache.Cache;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.Fqn;
/**
@@ -37,7 +37,7 @@
*
* @param cache cache
*/
- void setCache(Cache<?, ?> cache);
+ void setCache(Cache_Legacy<?, ?> cache);
/**
* Performs an eviction on a given node.
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionAlgorithm.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionAlgorithm.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/eviction/EvictionAlgorithm.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.starobrno.eviction;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.EvictionAlgorithmConfig;
@@ -76,7 +76,7 @@
* @param evictionAlgorithmConfig configuration for the current algorithm instance.
* @param configuration for the entire cache.
*/
- void assignToRegion(Fqn fqn, CacheSPI<?, ?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration);
+ void assignToRegion(Fqn fqn, CacheSPI_Legacy<?, ?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration);
/**
* Tests whether the algorithm would ignore certain event types on certain Fqns.
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/eviction/NullEvictionAlgorithm.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/eviction/NullEvictionAlgorithm.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/eviction/NullEvictionAlgorithm.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,7 +21,7 @@
*/
package org.jboss.starobrno.eviction;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.EvictionAlgorithmConfig;
@@ -66,7 +66,7 @@
// no-op
}
- public void assignToRegion(Fqn fqn, CacheSPI<?, ?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration)
+ public void assignToRegion(Fqn fqn, CacheSPI_Legacy<?, ?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration)
{
// no-op
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/eviction/RemoveOnEvictActionPolicy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/eviction/RemoveOnEvictActionPolicy.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/eviction/RemoveOnEvictActionPolicy.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,21 +23,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
+import org.jboss.cache.Cache_Legacy;
import org.jboss.cache.Fqn;
/**
- * An eviction action policy that calls {@link org.jboss.cache.Cache#removeNode(org.jboss.cache.Fqn)} to evict a node.
+ * An eviction action policy that calls {@link org.jboss.cache.Cache_Legacy#removeNode(org.jboss.cache.Fqn)} to evict a node.
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 3.0
*/
public class RemoveOnEvictActionPolicy implements EvictionActionPolicy
{
- Cache<?, ?> cache;
+ Cache_Legacy<?, ?> cache;
private static final Log log = LogFactory.getLog(org.jboss.starobrno.eviction.DefaultEvictionActionPolicy.class);
- public void setCache(Cache<?, ?> cache)
+ public void setCache(Cache_Legacy<?, ?> cache)
{
this.cache = cache;
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/BootstrapFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/BootstrapFactory.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/BootstrapFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,8 +21,8 @@
*/
package org.jboss.starobrno.factories;
-import org.jboss.cache.CacheSPI;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
import org.jboss.starobrno.factories.annotations.NonVolatile;
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/ComponentRegistry.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/ComponentRegistry.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/ComponentRegistry.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -23,12 +23,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Version;
import org.jboss.cache.util.BeanUtils;
import org.jboss.cache.util.reflect.ReflectionUtil;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.config.RuntimeConfig;
@@ -66,10 +66,10 @@
* <ul>
* <li>INSTANTIATED - when first constructed</li>
* <li>CONSTRUCTED - when created using the DefaultCacheFactory</li>
- * <li>When {@link org.jboss.cache.Cache#create()} is called, the components are rewired.</li>
- * <li>STARTED - when {@link org.jboss.cache.Cache#start()} is called</li>
- * <li>STOPPED - when {@link org.jboss.cache.Cache#stop()} is called</li>
- * <li>DESTROYED - when {@link org.jboss.cache.Cache#destroy()} is called.</li>
+ * <li>When {@link org.jboss.cache.Cache_Legacy#create()} is called, the components are rewired.</li>
+ * <li>STARTED - when {@link org.jboss.cache.Cache_Legacy#start()} is called</li>
+ * <li>STOPPED - when {@link org.jboss.cache.Cache_Legacy#stop()} is called</li>
+ * <li>DESTROYED - when {@link org.jboss.cache.Cache_Legacy#destroy()} is called.</li>
* </ul>
* <p/>
* Cache configuration can only be changed and will only be reinjected if the cache is not in the {@link org.jboss.cache.CacheStatus#STARTED} state.
@@ -195,6 +195,7 @@
s.add(ReplicationQueueFactory.class);
s.add(StateTransferManagerFactory.class);
s.add(StateTransferFactory.class);
+ s.add(NullComponentFactory.class);
return s;
}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/EmptyConstructorFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -31,13 +31,14 @@
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.VersionAwareMarshaller;
import org.jboss.cache.mvcc.MVCCNodeHelper;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
import org.jboss.starobrno.DataContainer;
+import org.jboss.starobrno.commands.CommandsFactory;
import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
import org.jboss.starobrno.factories.context.ContextFactory;
import org.jboss.starobrno.invocation.InvocationContextContainer;
+import org.jboss.starobrno.notifier.Notifier;
import org.jboss.starobrno.transaction.TransactionTable;
/**
@@ -50,7 +51,7 @@
ChannelMessageListener.class, CacheLoaderManager.class, Marshaller.class, InvocationContextContainer.class,
CacheInvocationDelegate.class, TransactionTable.class, DataContainer.class,
LockStrategyFactory.class, BuddyFqnTransformer.class, BatchContainer.class,
- ContextFactory.class, EntryFactory.class})
+ ContextFactory.class, EntryFactory.class, CommandsFactory.class})
public class EmptyConstructorFactory extends ComponentFactory
{
@Override
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/InterceptorChainFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/InterceptorChainFactory.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/InterceptorChainFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,12 +22,15 @@
package org.jboss.starobrno.factories;
-import org.jboss.cache.interceptors.*;
+import org.jboss.starobrno.TxInterceptor;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.ConfigurationException;
import org.jboss.starobrno.config.CustomInterceptorConfig;
import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.interceptors.CallInterceptor;
import org.jboss.starobrno.interceptors.InterceptorChain;
+import org.jboss.starobrno.interceptors.InvocationContextInterceptor;
+import org.jboss.starobrno.interceptors.LockingInterceptor;
import org.jboss.starobrno.interceptors.base.CommandInterceptor;
import java.util.List;
@@ -52,101 +55,118 @@
return new InterceptorChainFactory();
}
- private CommandInterceptor createInterceptor(Class clazz) throws IllegalAccessException, InstantiationException
+ private CommandInterceptor createInterceptor(Class<? extends CommandInterceptor> clazz) throws IllegalAccessException, InstantiationException
{
- return null; // todo - un-hack!
-// CommandInterceptor chainedInterceptor = componentRegistry.getComponent(clazz);
-// if (chainedInterceptor == null)
-// {
-// chainedInterceptor = clazz.newInstance();
-// componentRegistry.registerComponent(chainedInterceptor, clazz);
-// }
-// else
-// {
-// // wipe next/last chaining!!
-// chainedInterceptor.setNext(null);
-// }
-// return chainedInterceptor;
+ CommandInterceptor chainedInterceptor = componentRegistry.getComponent(clazz);
+ if (chainedInterceptor == null)
+ {
+ chainedInterceptor = clazz.newInstance();
+ try
+ {
+ componentRegistry.registerComponent(chainedInterceptor, clazz);
+ }
+ catch (RuntimeException e)
+ {
+ log.warn("Problems creating interceptor " + clazz);
+ throw e;
+ }
+ }
+ else
+ {
+ // wipe next/last chaining!!
+ chainedInterceptor.setNext(null);
+ }
+ return chainedInterceptor;
}
public InterceptorChain buildInterceptorChain() throws IllegalAccessException, InstantiationException, ClassNotFoundException
{
boolean invocationBatching = configuration.isInvocationBatchingEnabled();
// load the icInterceptor first
- CommandInterceptor first = invocationBatching ? createInterceptor(BatchingInterceptor.class) : createInterceptor(InvocationContextInterceptor.class);
+ // TODO: Uncomment once the BatchingInterceptor has been moved to Starobrno
+// CommandInterceptor first = invocationBatching ? createInterceptor(BatchingInterceptor.class) : createInterceptor(InvocationContextInterceptor.class);
+ CommandInterceptor first = createInterceptor(InvocationContextInterceptor.class);
+
InterceptorChain interceptorChain = new InterceptorChain(first);
// add the interceptor chain to the registry first, since some interceptors may ask for it.
componentRegistry.registerComponent(interceptorChain, InterceptorChain.class);
// NOW add the ICI if we are using batching!
- if (invocationBatching)
- interceptorChain.appendIntereceptor(createInterceptor(InvocationContextInterceptor.class));
+// if (invocationBatching)
+// interceptorChain.appendIntereceptor(createInterceptor(InvocationContextInterceptor.class));
// load the cache management interceptor next
- if (configuration.getExposeManagementStatistics())
- interceptorChain.appendIntereceptor(createInterceptor(CacheMgmtInterceptor.class));
+ // TODO: Uncomment once the CacheMGMT has been moved to Starobrno
+// if (configuration.getExposeManagementStatistics())
+// interceptorChain.appendIntereceptor(createInterceptor(CacheMgmtInterceptor.class));
+
// load the tx interceptor
interceptorChain.appendIntereceptor(createInterceptor(TxInterceptor.class));
- if (configuration.isUseLazyDeserialization())
- interceptorChain.appendIntereceptor(createInterceptor(MarshalledValueInterceptor.class));
- interceptorChain.appendIntereceptor(createInterceptor(NotificationInterceptor.class));
+ // TODO: Uncomment once the MarshalledValue, Notification has been moved to Starobrno
+// if (configuration.isUseLazyDeserialization())
+// interceptorChain.appendIntereceptor(createInterceptor(MarshalledValueInterceptor.class));
+// interceptorChain.appendIntereceptor(createInterceptor(NotificationInterceptor.class));
- switch (configuration.getCacheMode())
- {
- case REPL_SYNC:
- case REPL_ASYNC:
- interceptorChain.appendIntereceptor(createInterceptor(ReplicationInterceptor.class));
- break;
- case INVALIDATION_SYNC:
- case INVALIDATION_ASYNC:
- interceptorChain.appendIntereceptor(createInterceptor(InvalidationInterceptor.class));
- break;
- case LOCAL:
- //Nothing...
- }
+ // TODO: Uncomment once the Repl and Inval interceptors has been moved to Starobrno
+// switch (configuration.getCacheMode())
+// {
+// case REPL_SYNC:
+// case REPL_ASYNC:
+// interceptorChain.appendIntereceptor(createInterceptor(ReplicationInterceptor.class));
+// break;
+// case INVALIDATION_SYNC:
+// case INVALIDATION_ASYNC:
+// interceptorChain.appendIntereceptor(createInterceptor(InvalidationInterceptor.class));
+// break;
+// case LOCAL:
+// //Nothing...
+// }
- if (configuration.isUsingCacheLoaders())
- {
- if (configuration.getCacheLoaderConfig().isPassivation())
- {
- interceptorChain.appendIntereceptor(createInterceptor(ActivationInterceptor.class));
- }
- else
- {
- interceptorChain.appendIntereceptor(createInterceptor(CacheLoaderInterceptor.class));
- }
- }
- interceptorChain.appendIntereceptor(createInterceptor(MVCCLockingInterceptor.class));
+ // TODO: Uncomment once the CacheLoader has been moved to Starobrno
+// if (configuration.isUsingCacheLoaders())
+// {
+// if (configuration.getCacheLoaderConfig().isPassivation())
+// {
+// interceptorChain.appendIntereceptor(createInterceptor(ActivationInterceptor.class));
+// }
+// else
+// {
+// interceptorChain.appendIntereceptor(createInterceptor(CacheLoaderInterceptor.class));
+// }
+// }
+ interceptorChain.appendIntereceptor(createInterceptor(LockingInterceptor.class));
- if (configuration.isUsingCacheLoaders())
- {
- if (configuration.getCacheLoaderConfig().isPassivation())
- {
+ // TODO: Uncomment once the CacheLoader has been moved to Starobrno
+// if (configuration.isUsingCacheLoaders())
+// {
+// if (configuration.getCacheLoaderConfig().isPassivation())
+// {
+//
+// interceptorChain.appendIntereceptor(createInterceptor(PassivationInterceptor.class));
+//
+// }
+// else
+// {
+//
+// interceptorChain.appendIntereceptor(createInterceptor(CacheStoreInterceptor.class));
+//
+// }
+// }
+//
+// if (configuration.isUsingBuddyReplication())
+// {
+//
+// interceptorChain.appendIntereceptor(createInterceptor(DataGravitatorInterceptor.class));
+//
+// }
- interceptorChain.appendIntereceptor(createInterceptor(PassivationInterceptor.class));
-
- }
- else
- {
-
- interceptorChain.appendIntereceptor(createInterceptor(CacheStoreInterceptor.class));
-
- }
- }
-
- if (configuration.isUsingBuddyReplication())
- {
-
- interceptorChain.appendIntereceptor(createInterceptor(DataGravitatorInterceptor.class));
-
- }
-
+ // TODO: Uncomment once the EvictionInterceptor has been moved to Starobrno
// eviction interceptor to come before the optimistic node interceptor
- if (configuration.getEvictionConfig() != null && configuration.getEvictionConfig().isValidConfig())
- interceptorChain.appendIntereceptor(createInterceptor(configuration.isUsingBuddyReplication() ? BuddyRegionAwareEvictionInterceptor.class : EvictionInterceptor.class));
+// if (configuration.getEvictionConfig() != null && configuration.getEvictionConfig().isValidConfig())
+// interceptorChain.appendIntereceptor(createInterceptor(configuration.isUsingBuddyReplication() ? BuddyRegionAwareEvictionInterceptor.class : EvictionInterceptor.class));
CommandInterceptor callInterceptor = createInterceptor(CallInterceptor.class);
interceptorChain.appendIntereceptor(callInterceptor);
Added: core/branches/flat/src/main/java/org/jboss/starobrno/factories/NullComponentFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/NullComponentFactory.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/NullComponentFactory.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.factories;
+
+import org.jboss.cache.RegionManager;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
+
+/**
+ * // TODO: MANIK: Document this
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+ at DefaultFactoryFor(classes = RegionManager.class)
+public class NullComponentFactory extends ComponentFactory
+{
+ protected <T> T construct(Class<T> componentType)
+ {
+ return null;
+ }
+}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/factories/annotations/NonVolatile.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/factories/annotations/NonVolatile.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/factories/annotations/NonVolatile.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -28,7 +28,7 @@
/**
* This annotation is used for components that will be registered in the {@link org.jboss.cache.factories.ComponentRegistry},
- * that are resilient to changes in configuration. Examples are the {@link org.jboss.cache.CacheSPI} implementation used, which does
+ * that are resilient to changes in configuration. Examples are the {@link org.jboss.cache.CacheSPI_Legacy} implementation used, which does
* not change regardless of the configuration. Components such as the {@link org.jboss.cache.lock.LockManager}, though, should
* <b>never</b> be marked as <tt>@NonVolatile</tt> since based on the configuration, different lock manager implementations
* may be selected. LockManager is, hence, <b>not</b> resilient to changes in the configuration.
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/base/CommandInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/base/CommandInterceptor.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/base/CommandInterceptor.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -33,7 +33,7 @@
* This is the base class for all interceptors to extend, and implements the {@link org.jboss.cache.commands.Visitor} interface
* allowing it to intercept invocations on {@link org.jboss.cache.commands.VisitableCommand}s.
* <p/>
- * Commands are created either by the {@link org.jboss.cache.invocation.CacheInvocationDelegate} (for invocations on the {@link org.jboss.cache.Cache}
+ * Commands are created either by the {@link org.jboss.cache.invocation.CacheInvocationDelegate} (for invocations on the {@link org.jboss.cache.Cache_Legacy}
* public interface), the {@link org.jboss.cache.invocation.NodeInvocationDelegate} for invocations on the {@link org.jboss.cache.Node}
* public interface, or by the {@link org.jboss.cache.marshall.CommandAwareRpcDispatcher} for remotely originating invocations, and
* are passed up the interceptor chain by using the {@link org.jboss.cache.interceptors.InterceptorChain} helper class.
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -22,10 +22,10 @@
package org.jboss.starobrno.loader;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.loader.AbstractCacheLoader;
+import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.ObjectInputStream;
@@ -42,7 +42,7 @@
* <p/>
* Lifecycle: First an instance of the loader is created, then the
* configuration ({@link #setConfig(org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig)}) and cache ({@link
- * #setCache(CacheSPI)}) are set. After this, {@link #create()} is called.
+ * #setCache(org.jboss.cache.CacheSPI_Legacy)}) are set. After this, {@link #create()} is called.
* Then {@link #start()} is called. When re-deployed, {@link #stop()} will be
* called, followed by another {@link #start()}. Finally, when shut down,
* {@link #destroy()} is called, after which the loader is unusable.
@@ -55,7 +55,7 @@
* <p/>
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @see CacheSPI
+ * @see org.jboss.cache.CacheSPI_Legacy
* @see org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig
* @see org.jboss.cache.loader.AbstractCacheLoader
* @since 2.0.0
@@ -83,8 +83,8 @@
IndividualCacheLoaderConfig getConfig();
/**
- * Sets the {@link CacheSPI} that is maintaining this CacheLoader.
- * This method allows this CacheLoader to set a reference to the {@link CacheSPI}.
+ * Sets the {@link org.jboss.cache.CacheSPI_Legacy} that is maintaining this CacheLoader.
+ * This method allows this CacheLoader to set a reference to the {@link org.jboss.cache.CacheSPI_Legacy}.
* This method is called be called after the CacheLoader instance has been constructed.
*
* @param c The cache on which this loader works
Added: core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/manager/CacheManager.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.manager;
+
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.lifecycle.Lifecycle;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * // TODO: MANIK: Document this
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class CacheManager implements Lifecycle
+{
+ Configuration c;
+ private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
+
+ public CacheManager(Configuration c)
+ {
+ this.c = c;
+ }
+
+ public void start()
+ {
+ // this will bootstrap the cache manager
+ }
+
+ public void stop()
+ {
+ // this will stop the cache manager.
+ }
+
+ public Cache createCache(String cacheName)
+ {
+ if (!caches.containsKey(cacheName))
+ caches.putIfAbsent(cacheName, createNewCache());
+
+ Cache c = caches.get(cacheName);
+ c.start();
+ return c;
+ }
+
+ public void destroyCache(String cacheName)
+ {
+ Cache c = caches.remove(cacheName);
+ if (c != null) c.stop();
+ }
+
+ private Cache createNewCache()
+ {
+ // for now latch on to the existing cache creation mechanisms
+ DefaultCacheFactory dcf = new DefaultCacheFactory();
+ return dcf.createCache(c);
+ }
+}
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/notifier/Notifier.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/notifier/Notifier.java 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/notifier/Notifier.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -21,9 +21,9 @@
*/
package org.jboss.starobrno.notifier;
+import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.notifier.event.NodeModifiedEvent;
-import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jgroups.View;
import javax.transaction.Transaction;
@@ -53,7 +53,7 @@
* listeners are registered for notification then it is pointless building this object - so guard the notification
* with this call.
*/
- public boolean shouldNotifyOnNodeModified();
+ boolean shouldNotifyOnNodeModified();
/**
* Notifies all registered listeners of a nodeRemoved event.
Added: core/branches/flat/src/main/java/org/jboss/starobrno/notifier/NotifierImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/notifier/NotifierImpl.java (rev 0)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/notifier/NotifierImpl.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -0,0 +1,744 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno.notifier;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.cache.marshall.MarshalledValueMap;
+import org.jboss.cache.notifications.IncorrectCacheListenerException;
+import org.jboss.cache.notifications.annotation.*;
+import org.jboss.cache.notifications.event.*;
+import static org.jboss.cache.notifications.event.Event.Type.*;
+import org.jboss.cache.util.Immutables;
+import org.jboss.cache.util.concurrent.WithinThreadExecutor;
+import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.CacheSPI;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.context.InvocationContext;
+import org.jboss.starobrno.factories.annotations.Destroy;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
+import org.jboss.starobrno.mvcc.MVCCEntry;
+import org.jboss.starobrno.notifier.event.NodeModifiedEvent;
+import org.jgroups.View;
+
+import javax.transaction.Transaction;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Helper class that handles all notifications to registered listeners.
+ *
+ * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
+ */
+ at NonVolatile
+public class NotifierImpl implements Notifier
+{
+ private static final Log log = LogFactory.getLog(NotifierImpl.class);
+
+ private static final Class emptyMap = Collections.emptyMap().getClass();
+
+ private static final Class singletonMap = Collections.singletonMap(null, null).getClass();
+ private static final Class[] allowedMethodAnnotations =
+ {
+ CacheStarted.class, CacheStopped.class, CacheBlocked.class, CacheUnblocked.class, NodeCreated.class, NodeRemoved.class, NodeVisited.class, NodeModified.class, NodeMoved.class,
+ NodeActivated.class, NodePassivated.class, NodeLoaded.class, NodeEvicted.class, TransactionRegistered.class, TransactionCompleted.class, ViewChanged.class, BuddyGroupChanged.class,
+ NodeInvalidated.class
+ };
+ private static final Class[] parameterTypes =
+ {
+ CacheStartedEvent.class, CacheStoppedEvent.class, CacheBlockedEvent.class, CacheUnblockedEvent.class, NodeCreatedEvent.class, NodeRemovedEvent.class, NodeVisitedEvent.class, NodeModifiedEvent.class, NodeMovedEvent.class,
+ NodeActivatedEvent.class, NodePassivatedEvent.class, NodeLoadedEvent.class, NodeEvictedEvent.class, TransactionRegisteredEvent.class, TransactionCompletedEvent.class, ViewChangedEvent.class, BuddyGroupChangedEvent.class,
+ NodeInvalidatedEvent.class
+ };
+
+ final Map<Class<? extends Annotation>, List<ListenerInvocation>> listenersMap = new HashMap<Class<? extends Annotation>, List<ListenerInvocation>>(32);
+ final List<ListenerInvocation> cacheStartedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> cacheStoppedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> cacheBlockedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> cacheUnblockedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeCreatedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeRemovedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeVisitedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeModifiedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeMovedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeActivatedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodePassivatedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeLoadedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeInvalidatedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> nodeEvictedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> transactionRegisteredListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> transactionCompletedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> viewChangedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+ final List<ListenerInvocation> buddyGroupChangedListeners = new CopyOnWriteArrayList<ListenerInvocation>();
+
+ // final Map<Class, List<ListenerInvocation>> listenerInvocations = new ConcurrentHashMap<Class, List<ListenerInvocation>>();
+ private Cache cache;
+ private boolean useMarshalledValueMaps;
+ private Configuration config;
+ // two separate executor services, one for sync and one for async listeners
+ private ExecutorService syncProcessor;
+ private ExecutorService asyncProcessor;
+ private static final AtomicInteger asyncNotifierThreadNumber = new AtomicInteger(0);
+
+ public NotifierImpl()
+ {
+ listenersMap.put(CacheStarted.class, cacheStartedListeners);
+ listenersMap.put(CacheStopped.class, cacheStoppedListeners);
+ listenersMap.put(CacheBlocked.class, cacheBlockedListeners);
+ listenersMap.put(CacheUnblocked.class, cacheUnblockedListeners);
+ listenersMap.put(NodeCreated.class, nodeCreatedListeners);
+ listenersMap.put(NodeRemoved.class, nodeRemovedListeners);
+ listenersMap.put(NodeVisited.class, nodeVisitedListeners);
+ listenersMap.put(NodeModified.class, nodeModifiedListeners);
+ listenersMap.put(NodeMoved.class, nodeMovedListeners);
+ listenersMap.put(NodeActivated.class, nodeActivatedListeners);
+ listenersMap.put(NodePassivated.class, nodePassivatedListeners);
+ listenersMap.put(NodeLoaded.class, nodeLoadedListeners);
+ listenersMap.put(NodeEvicted.class, nodeEvictedListeners);
+ listenersMap.put(TransactionRegistered.class, transactionRegisteredListeners);
+ listenersMap.put(TransactionCompleted.class, transactionCompletedListeners);
+ listenersMap.put(ViewChanged.class, viewChangedListeners);
+ listenersMap.put(BuddyGroupChanged.class, buddyGroupChangedListeners);
+ listenersMap.put(NodeInvalidated.class, nodeInvalidatedListeners);
+ }
+
+ @Inject
+ void injectDependencies(CacheSPI cache, Configuration config)
+ {
+ this.cache = cache;
+ this.config = config;
+ }
+
+ @Stop
+ void stop()
+ {
+ syncProcessor.shutdownNow();
+ asyncProcessor.shutdownNow();
+ }
+
+ @Destroy
+ void destroy()
+ {
+ removeAllCacheListeners();
+ }
+
+ @Start
+ void start()
+ {
+ useMarshalledValueMaps = config.isUseLazyDeserialization();
+ syncProcessor = new WithinThreadExecutor();
+
+ // first try and use an injected executor for async listeners
+ if ((asyncProcessor = config.getRuntimeConfig().getAsyncCacheListenerExecutor()) == null)
+ {
+ // create one if needed
+ if (config.getListenerAsyncPoolSize() > 0)
+ {
+ asyncProcessor = Executors.newFixedThreadPool(config.getListenerAsyncPoolSize(), new ThreadFactory()
+ {
+ public Thread newThread(Runnable r)
+ {
+ return new Thread(r, "AsyncNotifier-" + asyncNotifierThreadNumber.getAndIncrement());
+ }
+ });
+ }
+ else
+ {
+ // use the same sync executor
+ asyncProcessor = syncProcessor;
+ }
+ }
+ }
+
+ /**
+ * Loops through all valid methods on the object passed in, and caches the relevant methods as {@link NotifierImpl.ListenerInvocation}
+ * for invocation by reflection.
+ *
+ * @param listener object to be considered as a listener.
+ */
+ @SuppressWarnings("unchecked")
+ private void validateAndAddListenerInvocation(Object listener)
+ {
+ boolean sync = testListenerClassValidity(listener.getClass());
+
+ boolean foundMethods = false;
+ // now try all methods on the listener for anything that we like. Note that only PUBLIC methods are scanned.
+ for (Method m : listener.getClass().getMethods())
+ {
+ // loop through all valid method annotations
+ for (int i = 0; i < allowedMethodAnnotations.length; i++)
+ {
+ if (m.isAnnotationPresent(allowedMethodAnnotations[i]))
+ {
+ testListenerMethodValidity(m, parameterTypes[i], allowedMethodAnnotations[i].getName());
+ addListenerInvocation(allowedMethodAnnotations[i], new ListenerInvocation(listener, m, sync));
+ foundMethods = true;
+ }
+ }
+ }
+
+ if (!foundMethods && log.isWarnEnabled())
+ log.warn("Attempted to register listener of class " + listener.getClass() + ", but no valid, public methods annotated with method-level event annotations found! Ignoring listener.");
+ }
+
+ /**
+ * Tests if a class is properly annotated as a CacheListener and returns whether callbacks on this class should be invoked
+ * synchronously or asynchronously.
+ *
+ * @param listenerClass class to inspect
+ * @return true if callbacks on this class should use the syncProcessor; false if it should use the asyncProcessor.
+ */
+ private static boolean testListenerClassValidity(Class<?> listenerClass)
+ {
+ CacheListener cl = listenerClass.getAnnotation(CacheListener.class);
+ if (cl == null)
+ throw new IncorrectCacheListenerException("Cache listener class MUST be annotated with org.jboss.cache.notifications.annotation.CacheListener");
+ if (!Modifier.isPublic(listenerClass.getModifiers()))
+ throw new IncorrectCacheListenerException("Cache listener class MUST be public!");
+ return cl.sync();
+
+ }
+
+ private static void testListenerMethodValidity(Method m, Class allowedParameter, String annotationName)
+ {
+ if (m.getParameterTypes().length != 1 || !m.getParameterTypes()[0].isAssignableFrom(allowedParameter))
+ throw new IncorrectCacheListenerException("Methods annotated with " + annotationName + " must accept exactly one parameter, of assignable from type " + allowedParameter.getName());
+ if (!m.getReturnType().equals(void.class))
+ throw new IncorrectCacheListenerException("Methods annotated with " + annotationName + " should have a return type of void.");
+ }
+
+ private void addListenerInvocation(Class annotation, ListenerInvocation li)
+ {
+ List<ListenerInvocation> result = getListenerCollectionForAnnotation(annotation);
+ result.add(li);
+ }
+
+ public void addCacheListener(Object listener)
+ {
+ validateAndAddListenerInvocation(listener);
+ }
+
+ public void removeCacheListener(Object listener)
+ {
+ for (Class annotation : allowedMethodAnnotations) removeListenerInvocation(annotation, listener);
+ }
+
+ private void removeListenerInvocation(Class annotation, Object listener)
+ {
+ if (listener == null) return;
+ List<ListenerInvocation> l = getListenerCollectionForAnnotation(annotation);
+ Set<Object> markedForRemoval = new HashSet<Object>();
+ for (ListenerInvocation li : l)
+ {
+ if (listener.equals(li.target)) markedForRemoval.add(li);
+ }
+ l.removeAll(markedForRemoval);
+ }
+
+ /**
+ * Removes all listeners from the notifier, including the evictionPolicyListener.
+ */
+ @Stop(priority = 99)
+ public void removeAllCacheListeners()
+ {
+ cacheStartedListeners.clear();
+ cacheStoppedListeners.clear();
+ cacheBlockedListeners.clear();
+ cacheUnblockedListeners.clear();
+ nodeCreatedListeners.clear();
+ nodeRemovedListeners.clear();
+ nodeVisitedListeners.clear();
+ nodeModifiedListeners.clear();
+ nodeMovedListeners.clear();
+ nodeActivatedListeners.clear();
+ nodePassivatedListeners.clear();
+ nodeLoadedListeners.clear();
+ nodeEvictedListeners.clear();
+ transactionRegisteredListeners.clear();
+ transactionCompletedListeners.clear();
+ viewChangedListeners.clear();
+ buddyGroupChangedListeners.clear();
+ }
+
+ public Set<Object> getCacheListeners()
+ {
+ Set<Object> result = new HashSet<Object>();
+ for (List<ListenerInvocation> list : listenersMap.values())
+ {
+ for (ListenerInvocation li : list) result.add(li.target);
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+ public void notifyNodeCreated(Object key, boolean pre, InvocationContext ctx)
+ {
+ if (!nodeCreatedListeners.isEmpty())
+ {
+ boolean originLocal = ctx.isOriginLocal();
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setType(NODE_CREATED);
+ for (ListenerInvocation listener : nodeCreatedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeModified(Object key, boolean pre, NodeModifiedEvent.ModificationType modificationType, Map data, InvocationContext ctx)
+ {
+ if (!nodeModifiedListeners.isEmpty())
+ {
+ boolean originLocal = ctx.isOriginLocal();
+ Map dataCopy = copy(data, useMarshalledValueMaps);
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+// e.setModificationType(modificationType); // TODO fix types
+ e.setData(dataCopy);
+ e.setType(NODE_MODIFIED);
+ for (ListenerInvocation listener : nodeModifiedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public boolean shouldNotifyOnNodeModified()
+ {
+ return !nodeModifiedListeners.isEmpty();
+ }
+
+ public void notifyNodeRemoved(Object key, boolean pre, Map data, InvocationContext ctx)
+ {
+ if (!nodeRemovedListeners.isEmpty())
+ {
+ boolean originLocal = ctx.isOriginLocal();
+ Map dataCopy = copy(data, useMarshalledValueMaps);
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setData(dataCopy);
+ e.setType(NODE_REMOVED);
+ for (ListenerInvocation listener : nodeRemovedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeVisited(Object key, boolean pre, InvocationContext ctx)
+ {
+ if (!nodeVisitedListeners.isEmpty())
+ {
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setType(NODE_VISITED);
+ for (ListenerInvocation listener : nodeVisitedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeMoved(Fqn originalFqn, Fqn newFqn, boolean pre, InvocationContext ctx)
+ {
+ if (!nodeMovedListeners.isEmpty())
+ {
+ boolean originLocal = ctx.isOriginLocal();
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+ e.setFqn(originalFqn);
+ e.setTargetFqn(newFqn);
+ e.setTransaction(tx);
+ e.setType(NODE_MOVED);
+ for (ListenerInvocation listener : nodeMovedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeEvicted(final Object key, final boolean pre, InvocationContext ctx)
+ {
+ if (!nodeEvictedListeners.isEmpty())
+ {
+ final boolean originLocal = ctx.isOriginLocal();
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setType(NODE_EVICTED);
+ for (ListenerInvocation listener : nodeEvictedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeInvalidated(final Object key, final boolean pre, InvocationContext ctx)
+ {
+ if (!nodeInvalidatedListeners.isEmpty())
+ {
+ final boolean originLocal = ctx.isOriginLocal();
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setType(NODE_INVALIDATED);
+ for (ListenerInvocation listener : nodeInvalidatedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeLoaded(Object key, boolean pre, Map data, InvocationContext ctx)
+ {
+ if (!nodeLoadedListeners.isEmpty())
+ {
+ boolean originLocal = ctx.isOriginLocal();
+ Map dataCopy = copy(data, useMarshalledValueMaps);
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setData(dataCopy);
+ e.setType(NODE_LOADED);
+ for (ListenerInvocation listener : nodeLoadedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodeActivated(Object key, boolean pre, Map data, InvocationContext ctx)
+ {
+ if (!nodeActivatedListeners.isEmpty())
+ {
+ boolean originLocal = ctx.isOriginLocal();
+ Map dataCopy = copy(data, useMarshalledValueMaps);
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(originLocal);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setData(dataCopy);
+ e.setType(NODE_ACTIVATED);
+ for (ListenerInvocation listener : nodeActivatedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyNodePassivated(Object key, boolean pre, Map data, InvocationContext ctx)
+ {
+ if (!nodePassivatedListeners.isEmpty())
+ {
+ Map dataCopy = copy(data, useMarshalledValueMaps);
+ Transaction tx = ctx.getTransaction();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setPre(pre);
+// e.setFqn(fqn); // TODO - attach key
+ e.setTransaction(tx);
+ e.setData(dataCopy);
+ e.setType(NODE_PASSIVATED);
+ for (ListenerInvocation listener : nodePassivatedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ /**
+ * Notifies all registered listeners of a cacheStarted event.
+ */
+ @Start(priority = 99)
+ public void notifyCacheStarted()
+ {
+ if (!cacheStartedListeners.isEmpty())
+ {
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setType(CACHE_STARTED);
+ for (ListenerInvocation listener : cacheStartedListeners) listener.invoke(e);
+ }
+ }
+
+ /**
+ * Notifies all registered listeners of a cacheStopped event.
+ */
+ @Stop(priority = 98)
+ public void notifyCacheStopped()
+ {
+ if (!cacheStoppedListeners.isEmpty())
+ {
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setType(CACHE_STOPPED);
+ for (ListenerInvocation listener : cacheStoppedListeners) listener.invoke(e);
+ }
+ }
+
+ public void notifyViewChange(final View newView, InvocationContext ctx)
+ {
+ if (!viewChangedListeners.isEmpty())
+ {
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setNewView(newView);
+ e.setType(VIEW_CHANGED);
+ for (ListenerInvocation listener : viewChangedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyBuddyGroupChange(final BuddyGroup buddyGroup, boolean pre)
+ {
+ if (!buddyGroupChangedListeners.isEmpty())
+ {
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setBuddyGroup(buddyGroup);
+ e.setPre(pre);
+ e.setType(BUDDY_GROUP_CHANGED);
+ for (ListenerInvocation listener : buddyGroupChangedListeners) listener.invoke(e);
+ }
+ }
+
+ public void notifyTransactionCompleted(Transaction transaction, boolean successful, InvocationContext ctx)
+ {
+ if (!transactionCompletedListeners.isEmpty())
+ {
+ boolean isOriginLocal = ctx.isOriginLocal();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(isOriginLocal);
+ e.setTransaction(transaction);
+ e.setSuccessful(successful);
+ e.setType(TRANSACTION_COMPLETED);
+ for (ListenerInvocation listener : transactionCompletedListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyTransactionRegistered(Transaction transaction, InvocationContext ctx)
+ {
+ if (!transactionRegisteredListeners.isEmpty())
+ {
+ boolean isOriginLocal = ctx.isOriginLocal();
+ InvocationContext backup = resetInvocationContext(ctx);
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setOriginLocal(isOriginLocal);
+ e.setTransaction(transaction);
+ e.setType(TRANSACTION_REGISTERED);
+ for (ListenerInvocation listener : transactionRegisteredListeners) listener.invoke(e);
+ restoreInvocationContext(backup);
+ }
+ }
+
+ public void notifyCacheBlocked(boolean pre)
+ {
+ if (!cacheBlockedListeners.isEmpty())
+ {
+ EventImpl e = new EventImpl();
+ e.setCache(this.cache);
+ e.setPre(pre);
+ e.setType(CACHE_BLOCKED);
+ for (ListenerInvocation listener : cacheBlockedListeners) listener.invoke(e);
+ }
+ }
+
+ public void notifyCacheUnblocked(boolean pre)
+ {
+ if (!cacheUnblockedListeners.isEmpty())
+ {
+ EventImpl e = new EventImpl();
+ e.setCache(this.cache);
+ e.setPre(pre);
+ e.setType(CACHE_UNBLOCKED);
+ for (ListenerInvocation listener : cacheUnblockedListeners) listener.invoke(e);
+ }
+ }
+
+ private static Map copy(Map data, boolean useMarshalledValueMaps)
+ {
+ if (data == null) return null;
+ if (data.isEmpty()) return Collections.emptyMap();
+ if (safe(data)) return useMarshalledValueMaps ? new MarshalledValueMap(data) : data;
+ Map defensivelyCopiedData = Immutables.immutableMapCopy(data);
+ return useMarshalledValueMaps ? new MarshalledValueMap(defensivelyCopiedData) : defensivelyCopiedData;
+ }
+
+ private void restoreInvocationContext(InvocationContext backup)
+ {
+ InvocationContext currentIC = cache.getInvocationContext();
+ backup.clearLookedUpEntries();
+ for (MVCCEntry me : currentIC.getLookedUpEntries().values())
+ {
+ backup.putLookedUpEntry(me);
+ }
+ cache.setInvocationContext(backup);
+ }
+
+ /**
+ * Resets the current (passed-in) invocation, and returns a temp InvocationContext containing its state so it can
+ * be restored later using {@link #restoreInvocationContext(org.jboss.cache.InvocationContext)}
+ *
+ * @param ctx the current context to be reset
+ * @return a clone of ctx, before it was reset
+ */
+ private InvocationContext resetInvocationContext(InvocationContext ctx)
+ {
+ // wipe current context.
+ cache.setInvocationContext(null);
+ // get a new Invocation Context
+ InvocationContext newContext = cache.getInvocationContext();
+ for (MVCCEntry me : ctx.getLookedUpEntries().values())
+ {
+ newContext.putLookedUpEntry(me);
+ }
+ return ctx;
+ }
+
+ /**
+ * A map is deemed 'safe' to be passed as-is to a listener, if either of the following are true:
+ * <ul>
+ * <li>It is null</li>
+ * <li>It is an instance of {@link org.jboss.cache.util.ImmutableMapCopy}, which is immutable</li>
+ * <li>It is an instance of {@link java.util.Collections#emptyMap()}, which is also immutable</li>
+ * <li>It is an instance of {@link java.util.Collections#singletonMap(Object,Object)}, which is also immutable</li>
+ * </ul>
+ *
+ * @param map
+ * @return
+ */
+ private static boolean safe(Map map)
+ {
+ return map == null || Immutables.isImmutable(map) || map.getClass().equals(emptyMap) || map.getClass().equals(singletonMap);
+ }
+
+ /**
+ * Class that encapsulates a valid invocation for a given registered listener - containing a reference to the
+ * method to be invoked as well as the target object.
+ */
+ class ListenerInvocation
+ {
+ private final Object target;
+ private final Method method;
+ private final boolean sync;
+
+ public ListenerInvocation(Object target, Method method, boolean sync)
+ {
+ this.target = target;
+ this.method = method;
+ this.sync = sync;
+ }
+
+ public void invoke(final Event e)
+ {
+ Runnable r = new Runnable()
+ {
+
+ public void run()
+ {
+ try
+ {
+ method.invoke(target, e);
+ }
+ catch (InvocationTargetException exception)
+ {
+ Throwable cause = exception.getCause();
+ if (cause != null)
+ throw new CacheException("Caught exception invoking method " + method + " on listener instance " + target, cause);
+ else
+ throw new CacheException("Caught exception invoking method " + method + " on listener instance " + target, exception);
+ }
+ catch (IllegalAccessException exception)
+ {
+ log.warn("Unable to invoke method " + method + " on Object instance " + target + " - removing this target object from list of listeners!", exception);
+ removeCacheListener(target);
+ }
+ }
+ };
+
+ if (sync)
+ syncProcessor.execute(r);
+ else
+ asyncProcessor.execute(r);
+
+ }
+
+ }
+
+ private List<ListenerInvocation> getListenerCollectionForAnnotation(Class<? extends Annotation> annotation)
+ {
+ List<ListenerInvocation> list = listenersMap.get(annotation);
+ if (list == null) throw new CacheException("Unknown listener annotation: " + annotation);
+ return list;
+ }
+}
Added: core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java (rev 0)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java 2008-10-08 18:56:43 UTC (rev 6891)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.starobrno;
+
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.manager.CacheManager;
+import org.testng.annotations.Test;
+
+/**
+ * // TODO: MANIK: Document this
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+ at Test
+public class BasicTest
+{
+ public void basicTest()
+ {
+ // create a cache manager
+ Configuration c = new Configuration(); // LOCAL mode
+ c.setFetchInMemoryState(false);
+ CacheManager cm = new CacheManager(c);
+ try
+ {
+ cm.start();
+ Cache cache = cm.createCache("test");
+ String key = "key", value = "value";
+
+ assert cache.isEmpty();
+ assert cache.size() == 0;
+ assert !cache.containsKey(key);
+
+ cache.put(key, value);
+ assert cache.size() == 1;
+ assert cache.containsKey(key);
+ assert !cache.isEmpty();
+
+ assert cache.remove(key).equals(value);
+
+ assert cache.isEmpty();
+ assert cache.size() == 0;
+ assert !cache.containsKey(key);
+ }
+ finally
+ {
+ cm.destroyCache("test");
+ cm.stop();
+ }
+ }
+
+ public void concurrentMapMethodTest()
+ {
+
+ }
+
+ public void transactionalTest()
+ {
+
+ }
+}
Modified: core/branches/flat/src/test/resources/log4j.xml
===================================================================
--- core/branches/flat/src/test/resources/log4j.xml 2008-10-08 17:53:15 UTC (rev 6890)
+++ core/branches/flat/src/test/resources/log4j.xml 2008-10-08 18:56:43 UTC (rev 6891)
@@ -46,11 +46,11 @@
<!-- ================ -->
<category name="org.jboss.cache">
- <priority value="WARN"/>
+ <priority value="TRACE"/>
</category>
<category name="org.jboss.cache.factories">
- <priority value="WARN"/>
+ <priority value="TRACE"/>
</category>
<category name="org.jboss.tm">
@@ -66,8 +66,8 @@
<!-- ======================= -->
<root>
- <!--<appender-ref ref="CONSOLE"/>-->
- <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
+ <!--<appender-ref ref="FILE"/>-->
</root>
</log4j:configuration>
More information about the jbosscache-commits
mailing list