[jbosscache-commits] JBoss Cache SVN: r4284 - in cacheloader_migration/trunk/src: examples/java and 9 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Aug 15 05:25:11 EDT 2007


Author: manik.surtani at jboss.com
Date: 2007-08-15 05:25:11 -0400 (Wed, 15 Aug 2007)
New Revision: 4284

Added:
   cacheloader_migration/trunk/src/examples/data/filecacheloader-1x.zip
   cacheloader_migration/trunk/src/examples/data/jbossdb-1x.zip
   cacheloader_migration/trunk/src/examples/java/examples/
   cacheloader_migration/trunk/src/examples/java/examples/TransformStore.java
   cacheloader_migration/trunk/src/examples/misc/build.bat
   cacheloader_migration/trunk/src/examples/misc/build.properties
   cacheloader_migration/trunk/src/examples/misc/build.sh
   cacheloader_migration/trunk/src/examples/misc/build.xml
   cacheloader_migration/trunk/src/examples/misc/readme.txt
   cacheloader_migration/trunk/src/examples/resources/log4j-cache.xml
   cacheloader_migration/trunk/src/examples/resources/original-fcl-service.xml
   cacheloader_migration/trunk/src/examples/resources/original-jdbccl-service.xml
   cacheloader_migration/trunk/src/examples/resources/transform-fcl-service.xml
   cacheloader_migration/trunk/src/examples/resources/transform-jdbccl-service.xml
   cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingFileCacheLoader.java
   cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java
   cacheloader_migration/trunk/src/test/java/org/
   cacheloader_migration/trunk/src/test/java/org/jboss/
   cacheloader_migration/trunk/src/test/java/org/jboss/cache/
   cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/
   cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java
   cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
   cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
Log:
Moved cacheloader migration code to separate module

Copied: cacheloader_migration/trunk/src/examples/data/filecacheloader-1x.zip (from rev 4274, core/trunk/migration/examples/cacheloader-migration/data/filecacheloader-1x.zip)
===================================================================
(Binary files differ)

Copied: cacheloader_migration/trunk/src/examples/data/jbossdb-1x.zip (from rev 4274, core/trunk/migration/examples/cacheloader-migration/data/jbossdb-1x.zip)
===================================================================
(Binary files differ)

Copied: cacheloader_migration/trunk/src/examples/java/examples/TransformStore.java (from rev 4274, core/trunk/migration/examples/cacheloader-migration/src/examples/TransformStore.java)
===================================================================
--- cacheloader_migration/trunk/src/examples/java/examples/TransformStore.java	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/java/examples/TransformStore.java	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package examples;
+
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Cache;
+import org.jboss.cache.Node;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Cache store transforming example
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransformStore
+{
+   /* Type of cache loader, either use "jdbccl" for JDBCCacheLoader or "fcl" for FileCacheLoader */   
+   public static final String CL_TYPE = System.getProperty("cacheloader.type", "jdbccl");
+
+   private static Log log = LogFactory.getLog(TransformStore.class);
+   
+   public static void main(String[] args) throws Exception
+   {
+      TransformStore ts = new TransformStore();
+
+      String transformConfigName = "transform-" + CL_TYPE + "-service.xml";
+      log.info("Transforming configuration file: " + transformConfigName);
+      Cache transformingCache = ts.createAndStartCache(transformConfigName);
+      ts.transformCacheStore(transformingCache);
+      ts.stopAndDestroyCache(transformingCache);
+
+      String originalConfigName = "original-" + CL_TYPE + "-service.xml";
+      log.info("Original configuration file: " + originalConfigName);
+      Cache checkingCache = ts.createAndStartCache(originalConfigName);
+      ts.checkCacheStore(checkingCache);
+      ts.stopAndDestroyCache(checkingCache);
+   }
+
+   public Cache createAndStartCache(String configFile)
+   {
+      return DefaultCacheFactory.getInstance().createCache(configFile, true);
+   }
+
+   public void stopAndDestroyCache(Cache cache)
+   {
+      cache.stop();
+      cache.destroy();
+   }   
+
+   public void transformCacheStore(Cache cache)
+   {
+      log.info("Transforming 1.x cache store");
+      transformNode(cache, cache.getRoot());
+      log.info("Cache store transformed to 2.x format");
+   }
+
+   public void transformNode(Cache cache, Node<Object, Object> node)
+   {
+      cache.put(node.getFqn(), node.getData());
+      log.info(node.getFqn() + " transformed");               
+
+      for (Node child : node.getChildren())
+      {
+         transformNode(cache, child);
+      }
+   }
+
+   public void checkCacheStore(Cache cache)
+   {
+      checkNode(cache, cache.getRoot());
+   }
+
+   public void checkNode(Cache cache, Node<Object, Object> node)
+   {
+      log.info("Node: " + node.getFqn() + " | Data: " + node.getData());
+
+      for (Node child : node.getChildren())
+      {
+         checkNode(cache, child);
+      }
+   }
+}

Copied: cacheloader_migration/trunk/src/examples/misc/build.bat (from rev 4274, core/trunk/migration/examples/cacheloader-migration/build.bat)
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.bat	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/misc/build.bat	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,4 @@
+ at echo off
+set ANT_HOME=..\..\ant-dist
+REM java -cp %ANT_HOME%/lib/ant.jar;%ANT_HOME%/lib/optional.jar;%ANT_HOME%/lib/junit.jar;%JAVA_HOME%/lib/tools.jar org.apache.tools.ant.Main %*
+%ANT_HOME%\bin\ant %*

Copied: cacheloader_migration/trunk/src/examples/misc/build.properties (from rev 4274, core/trunk/migration/examples/cacheloader-migration/build.properties)
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.properties	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/misc/build.properties	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,17 @@
+# set up environment
+#
+
+#
+# Below should be transparent to you.
+#
+
+# basedir is a project attribute
+# 
+
+# create directory structure
+#
+cache.home=${basedir}/../..
+cache.lib=${cache.home}/lib
+
+#Directory for Junit test result. Subdirectory html contains the result in html format.
+reports=${output}/reports

Copied: cacheloader_migration/trunk/src/examples/misc/build.sh (from rev 4274, core/trunk/migration/examples/cacheloader-migration/build.sh)
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.sh	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/misc/build.sh	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+CACHE_HOME=`dirname $0`
+ANT_HOME=$CACHE_HOME/../../ant-dist
+
+CLASSPATH=$ANT_HOME/lib/ant.jar:$ANT_HOME/lib/optional.jar:$ANT_HOME/lib/junit.jar:$JAVA_HOME/lib/tools.jar
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+case "`uname`" in
+    CYGWIN*)
+        cygwin=true
+        ;;
+esac
+
+if [ $cygwin = "true" ]; then
+# Note that JAVA_HOME evn needs to be set under cygwin explictly,
+# /cygdrive/e:/j2sdkxxx, for this to work correctly. Otherwise,
+# javac can't be located correctly.
+   CP=`cygpath -wp $CLASSPATH`
+else
+   CP=$CLASSPATH
+fi
+
+#java -cp $CP org.apache.tools.ant.Main "$@"
+$ANT_HOME/bin/ant "$@"
\ No newline at end of file

Copied: cacheloader_migration/trunk/src/examples/misc/build.xml (from rev 4274, core/trunk/migration/examples/cacheloader-migration/build.xml)
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.xml	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/misc/build.xml	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+
+<project name="JBossCache examples Cache Loader Migration" default="help">
+
+   <property file="./build.properties"/>
+
+   <property name="output" value="${basedir}/output"/>
+   <property name="source" value="${basedir}/src"/>
+   <property name="resources" value="${basedir}/resources"/>
+   <property name="data" value="${basedir}/data"/>
+   <property name="build" value="${output}/classes"/>
+
+   <property name="db.dir" value="jbossdb-1x"/>
+   <property name="db.zip" value="jbossdb-1x.zip"/>
+
+   <property name="tmp.dir" value="/tmp"/>
+   <property name="filestore.dir" value="filecacheloader-1x"/>
+   <property name="filestore.zip" value="filecacheloader-1x.zip"/>
+
+   <path id="lib.classpath">
+      <fileset dir="${cache.lib}">
+         <include name="**/*.jar"/>
+      </fileset>
+   </path>
+
+   <path id="user.classpath">
+      <pathelement path="${build}"/>
+      <path refid="lib.classpath"/>
+   </path>
+
+   <target name="help" description="help page">
+      <echo message="build.sh &lt;command&gt; where command is:"/>
+      <echo message="         compile       -- compile the examples code"/>
+      <echo message="         run.jdbccacheloader.example -- run JDBC store migration example"/>
+      <echo message="         run.filecacheloader.example -- run file store migration example"/>      
+   </target>
+
+   <target name="init" description="Prepare to build.">
+      <tstamp/>
+      <mkdir dir="${build}"/>
+   </target>
+
+   <target name="clean" description="Clean up compiled classes">
+      <delete dir="${output}"/>
+      <delete dir="${db.dir}"/>
+   </target>
+
+   <target name="compile" depends="init" description="Build example">
+      <javac srcdir="${source}"
+             destdir="${build}"
+             includes="**/**"
+             debug="true"
+             deprecation="true">
+         <classpath>
+            <path refid="lib.classpath"/>
+         </classpath>
+      </javac>
+
+      <copy todir="${build}">
+         <fileset dir="${resources}">
+            <include name="**/*"/>
+         </fileset>
+      </copy>
+   </target>
+
+   <target name="run.jdbccacheloader.example" depends="compile" description="run JDBC store migration example.">
+      <delete dir="${db.dir}"/>
+      <unzip src="${data}/${db.zip}" dest="."/>
+
+      <java classname="examples.TransformStore" fork="yes">
+         <jvmarg value="-Dcacheloader.type=jdbccl"/>
+         <jvmarg value="-Dlog4j.configuration=file:${basedir}/log4j-cache.xml"/>
+         <classpath refid="lib.classpath"/>
+         <classpath path="${build}"/>
+      </java>
+   </target>
+
+   <target name="run.filecacheloader.example" depends="compile" description="run file store migration example.">
+      <delete dir="${tmp.dir}/${filestore.dir}"/>
+      <mkdir dir="${tmp.dir}"/>
+      <unzip src="${data}/${filestore.zip}" dest="${tmp.dir}"/>
+
+      <java classname="examples.TransformStore" fork="yes">
+         <jvmarg value="-Dcacheloader.type=fcl"/>
+         <jvmarg value="-Dlog4j.configuration=file:${basedir}/log4j-cache.xml"/>
+         <classpath refid="lib.classpath"/>
+         <classpath path="${build}"/>
+      </java>
+   </target>
+
+</project>

Copied: cacheloader_migration/trunk/src/examples/misc/readme.txt (from rev 4274, core/trunk/migration/examples/cacheloader-migration/readme.txt)
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/readme.txt	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/misc/readme.txt	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,39 @@
+This is an example that illustrates how to migrate existing file or jdbc cache
+stores generated with JBoss Cache 1.x to a format that it's readable by JBossCache
+2.x.
+
+Both of the examples rely on zipped cache stores containing the following structure
+stored in it:
+
+/
+  /Europe
+    /Austria {capital="Vienna",currency="Euro",population=8184691}
+    /England {capital="London",currency="British Pound",population=8184691}
+    /Albania {capital="Tirana",currency="Lek",population=3563112,area=28748}
+    /Hungary {capital="Budapest",currency="Forint",population=10006835,area=93030}
+
+The idea of this example, both for the jdbc and the file versions, is to loop through
+the data stored in 1.x format, and put it back again in the cache store in 2.x format.
+So, in both cases, the example starts creating an instance of a transform*-service.xml
+whose only difference with the original one is that it uses a transforming cache loader
+which reads in 1.x and writes in 2.x format.
+
+Starting from the root node, the example then loops through the whole cache, which will
+delegate the get() calls into the cache store. Each node retrieved is put back into the
+cache, which results on the node being put in the new format. You should see INFO level
+messages indicating the success of the transformation.
+
+At this point, the transforming cache instance is stopped and destroyed, and a new cache
+instance is created with the original cache configuration file, i.e original*-service.xml,
+which specifies the traditional cache loader.
+
+The example now loops through the entire cache again, checking that it can get the newly
+transformed node and prints out its details.
+
+To run the JDBC cache store version:
+- Run "build.bat/sh run.jdbccacheloader.example". It first unzips data/jbossdb-1x.zip into the
+current directory and uses this generated DB (Apache Derby) as store for the example.
+
+- Run "build.bat/sh run.filecacheloader.example". It first unzips data/filecacheloader-1x.zip
+into the /tmp directory (C:\tmp in Windows) and uses this generated file store for the
+example.
\ No newline at end of file

Copied: cacheloader_migration/trunk/src/examples/resources/log4j-cache.xml (from rev 4274, core/trunk/migration/examples/cacheloader-migration/log4j-cache.xml)
===================================================================
--- cacheloader_migration/trunk/src/examples/resources/log4j-cache.xml	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/resources/log4j-cache.xml	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id$ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A time/date based rolling appender -->
+   <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+      <param name="File" value="/tmp/jbosscache.log"/>
+      <param name="Append" value="false"/>
+
+      <!-- Rollover at midnight each day -->
+      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+      <!-- Rollover at the top of each hour
+      <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+      -->
+      <!-- param name="Threshold" value="TRACE"/ -->
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
+
+         <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+        <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+         -->
+      </layout>
+   </appender>
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Threshold" value="DEBUG"/>
+      <param name="Target" value="System.out"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d %-5p [%c{1}] (%t) %m%n"/>
+      </layout>
+   </appender>
+
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <!-- Limit JBoss categories to INFO
+   <category name="org.jboss">
+     <priority value="INFO"/>
+   </category>
+   -->
+
+   <!--
+      | An example of enabling the custom TRACE level priority that is used
+      | by the JBoss internals to diagnose low level details. This example
+      | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+      | subpackages. This will produce A LOT of logging output.
+   <category name="org.jboss.system">
+     <priority value="TRACE"/>
+   </category>
+   -->
+
+   <category name="org.jboss.cache">
+      <priority value="INFO"/>
+   </category>
+
+   <category name="org.jboss.serial">
+      <priority value="INFO"/>
+   </category>
+
+   <category name="org.jboss.tm">
+      <priority value="WARN"/>
+   </category>
+
+   <category name="org.jgroups">
+      <priority value="WARN"/>
+   </category>
+
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Copied: cacheloader_migration/trunk/src/examples/resources/original-fcl-service.xml (from rev 4274, core/trunk/migration/examples/cacheloader-migration/resources/original-fcl-service.xml)
===================================================================
--- cacheloader_migration/trunk/src/examples/resources/original-fcl-service.xml	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/resources/original-fcl-service.xml	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Sample TreeCache Service Configuration                               -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+   <!-- ==================================================================== -->
+   <!-- Defines TreeCache configuration                                      -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.cache.CacheImpl"
+          name="jboss.cache:service=TreeCache">
+
+      <depends>jboss:service=Naming</depends>
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!--
+          Configure the TransactionManager
+      -->
+      <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+      </attribute>
+
+      <!--
+          Isolation level : SERIALIZABLE
+                            REPEATABLE_READ (default)
+                            READ_COMMITTED
+                            READ_UNCOMMITTED
+                            NONE
+      -->
+      <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+      <!--
+           Valid modes are LOCAL
+                           REPL_ASYNC
+                           REPL_SYNC
+                           INVALIDATION_ASYNC
+                           INVALIDATION_SYNC
+      -->
+      <attribute name="CacheMode">LOCAL</attribute>
+
+      <!--
+      Just used for async repl: use a replication queue
+      -->
+      <attribute name="UseReplQueue">false</attribute>
+
+      <!--
+          Replication interval for replication queue (in ms)
+      -->
+      <attribute name="ReplQueueInterval">0</attribute>
+
+      <!--
+          Max number of elements which trigger replication
+      -->
+      <attribute name="ReplQueueMaxElements">0</attribute>
+
+      <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+           cluster in order to find each other.
+      -->
+      <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+      <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS.  -->
+      <!--
+      <depends>jgroups.mux:name=Multiplexer</depends>
+      <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+      <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+      -->
+
+      <!-- JGroups protocol stack properties.
+         ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
+      -->
+      <attribute name="ClusterConfig">
+         <config>
+            <!-- UDP: if you have a multihomed machine,
+  set the bind_addr attribute to the appropriate NIC IP address -->
+            <!-- UDP: On Windows machines, because of the media sense feature
+      being broken with multicast (even after disabling media sense)
+      set the loopback attribute to true -->
+            <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+                 ip_ttl="64" ip_mcast="true"
+                 mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+                 ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+                 loopback="false"/>
+            <PING timeout="2000" num_initial_members="3"
+                  up_thread="false" down_thread="false"/>
+            <MERGE2 min_interval="10000" max_interval="20000"/>
+            <!--        <FD shun="true" up_thread="true" down_thread="true" />-->
+            <FD_SOCK/>
+            <VERIFY_SUSPECT timeout="1500"
+                            up_thread="false" down_thread="false"/>
+            <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+                           max_xmit_size="8192" up_thread="false" down_thread="false"/>
+            <UNICAST timeout="600,1200,2400" down_thread="false"/>
+            <pbcast.STABLE desired_avg_gossip="20000"
+                           up_thread="false" down_thread="false"/>
+            <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+                        shun="true" print_local_addr="true"/>
+            <FC max_credits="2000000" down_thread="false" up_thread="false"
+                min_threshold="0.20"/>
+            <FRAG frag_size="8192" down_thread="false" up_thread="true"/>
+            <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+         </config>
+      </attribute>
+
+
+      <!--
+          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
+      -->
+      <attribute name="InitialStateRetrievalTimeout">20000</attribute>
+
+      <!--
+          Number of milliseconds to wait until all responses for a
+          synchronous call have been received.
+      -->
+      <attribute name="SyncReplTimeout">20000</attribute>
+
+      <!-- Max number of milliseconds to wait for a lock acquisition -->
+      <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+      <!--
+       Whether or not to fetch state on joining a cluster
+       NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+      -->
+      <attribute name="FetchInMemoryState">false</attribute>
+
+      <attribute name="CacheLoaderConfiguration">
+         <config>
+            <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+            <passivation>false</passivation>
+            <shared>false</shared>
+
+            <!-- we can now have multiple cache loaders, which get chained -->
+            <cacheloader>
+               <class>org.jboss.cache.loader.FileCacheLoader</class>
+               <!-- same as the old CacheLoaderConfig attribute -->
+               <properties>
+                  location=/tmp/filecacheloader-1x
+               </properties>
+               <!-- whether the cache loader writes are asynchronous -->
+               <async>false</async>
+               <!-- only one cache loader in the chain may set fetchPersistentState to true.
+               An exception is thrown if more than one cache loader sets this to true. -->
+               <fetchPersistentState>false</fetchPersistentState>
+               <!-- determines whether this cache loader ignores writes - defaults to false. -->
+               <ignoreModifications>false</ignoreModifications>
+               <!-- if set to true, purges the contents of this cache loader when the cache starts up.
+               Defaults to false.  -->
+               <purgeOnStartup>false</purgeOnStartup>
+            </cacheloader>
+
+         </config>
+      </attribute>
+
+   </mbean>
+
+
+   <!--  Uncomment to get a graphical view of the TreeCache MBean above -->
+   <!--   <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
+   <!--      <depends>jboss.cache:service=TreeCache</depends>-->
+   <!--      <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+   <!--   </mbean>-->
+
+
+</server>

Copied: cacheloader_migration/trunk/src/examples/resources/original-jdbccl-service.xml (from rev 4274, core/trunk/migration/examples/cacheloader-migration/resources/original-jdbccl-service.xml)
===================================================================
--- cacheloader_migration/trunk/src/examples/resources/original-jdbccl-service.xml	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/resources/original-jdbccl-service.xml	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Sample TreeCache Service Configuration                               -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+   <!-- ==================================================================== -->
+   <!-- Defines TreeCache configuration                                      -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.cache.CacheImpl"
+          name="jboss.cache:service=TreeCache">
+
+      <depends>jboss:service=Naming</depends>
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!--
+          Configure the TransactionManager
+      -->
+      <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+      </attribute>
+
+      <!--
+          Isolation level : SERIALIZABLE
+                            REPEATABLE_READ (default)
+                            READ_COMMITTED
+                            READ_UNCOMMITTED
+                            NONE
+      -->
+      <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+      <!--
+           Valid modes are LOCAL
+                           REPL_ASYNC
+                           REPL_SYNC
+                           INVALIDATION_ASYNC
+                           INVALIDATION_SYNC
+      -->
+      <attribute name="CacheMode">LOCAL</attribute>
+
+      <!--
+      Just used for async repl: use a replication queue
+      -->
+      <attribute name="UseReplQueue">false</attribute>
+
+      <!--
+          Replication interval for replication queue (in ms)
+      -->
+      <attribute name="ReplQueueInterval">0</attribute>
+
+      <!--
+          Max number of elements which trigger replication
+      -->
+      <attribute name="ReplQueueMaxElements">0</attribute>
+
+      <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+           cluster in order to find each other.
+      -->
+      <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+      <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS.  -->
+      <!--
+      <depends>jgroups.mux:name=Multiplexer</depends>
+      <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+      <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+      -->
+
+      <!-- JGroups protocol stack properties.
+         ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
+      -->
+      <attribute name="ClusterConfig">
+         <config>
+            <!-- UDP: if you have a multihomed machine,
+  set the bind_addr attribute to the appropriate NIC IP address -->
+            <!-- UDP: On Windows machines, because of the media sense feature
+      being broken with multicast (even after disabling media sense)
+      set the loopback attribute to true -->
+            <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+                 ip_ttl="64" ip_mcast="true"
+                 mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+                 ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+                 loopback="false"/>
+            <PING timeout="2000" num_initial_members="3"
+                  up_thread="false" down_thread="false"/>
+            <MERGE2 min_interval="10000" max_interval="20000"/>
+            <!--        <FD shun="true" up_thread="true" down_thread="true" />-->
+            <FD_SOCK/>
+            <VERIFY_SUSPECT timeout="1500"
+                            up_thread="false" down_thread="false"/>
+            <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+                           max_xmit_size="8192" up_thread="false" down_thread="false"/>
+            <UNICAST timeout="600,1200,2400" down_thread="false"/>
+            <pbcast.STABLE desired_avg_gossip="20000"
+                           up_thread="false" down_thread="false"/>
+            <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+                        shun="true" print_local_addr="true"/>
+            <FC max_credits="2000000" down_thread="false" up_thread="false"
+                min_threshold="0.20"/>
+            <FRAG frag_size="8192" down_thread="false" up_thread="true"/>
+            <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+         </config>
+      </attribute>
+
+
+      <!--
+          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
+      -->
+      <attribute name="InitialStateRetrievalTimeout">20000</attribute>
+
+      <!--
+          Number of milliseconds to wait until all responses for a
+          synchronous call have been received.
+      -->
+      <attribute name="SyncReplTimeout">20000</attribute>
+
+      <!-- Max number of milliseconds to wait for a lock acquisition -->
+      <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+      <!--
+       Whether or not to fetch state on joining a cluster
+       NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+      -->
+      <attribute name="FetchInMemoryState">false</attribute>
+
+      <attribute name="CacheLoaderConfiguration">
+         <config>
+            <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+            <passivation>false</passivation>
+            <shared>false</shared>
+
+            <!-- we can now have multiple cache loaders, which get chained -->
+            <cacheloader>
+               <class>org.jboss.cache.loader.JDBCCacheLoader</class>
+               <!-- same as the old CacheLoaderConfig attribute -->
+               <properties>
+                  cache.jdbc.table.name=jbosscache
+                  cache.jdbc.table.create=true
+                  cache.jdbc.table.drop=false
+                  cache.jdbc.table.primarykey=jbosscache_pk
+                  cache.jdbc.fqn.column=fqn
+                  cache.jdbc.fqn.type=varchar(255)
+                  cache.jdbc.node.column=node
+                  cache.jdbc.node.type=blob
+                  cache.jdbc.parent.column=parent
+                  cache.jdbc.sql-concat=1 || 2
+                  cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+                  cache.jdbc.url=jdbc:derby:jbossdb-1x;create=true
+                  cache.jdbc.user=user1
+                  cache.jdbc.password=user1 
+               </properties>
+               <!-- whether the cache loader writes are asynchronous -->
+               <async>false</async>
+               <!-- only one cache loader in the chain may set fetchPersistentState to true.
+               An exception is thrown if more than one cache loader sets this to true. -->
+               <fetchPersistentState>false</fetchPersistentState>
+               <!-- determines whether this cache loader ignores writes - defaults to false. -->
+               <ignoreModifications>false</ignoreModifications>
+               <!-- if set to true, purges the contents of this cache loader when the cache starts up.
+               Defaults to false.  -->
+               <purgeOnStartup>false</purgeOnStartup>
+            </cacheloader>
+
+         </config>
+      </attribute>
+
+   </mbean>
+
+
+   <!--  Uncomment to get a graphical view of the TreeCache MBean above -->
+   <!--   <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
+   <!--      <depends>jboss.cache:service=TreeCache</depends>-->
+   <!--      <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+   <!--   </mbean>-->
+
+
+</server>

Copied: cacheloader_migration/trunk/src/examples/resources/transform-fcl-service.xml (from rev 4274, core/trunk/migration/examples/cacheloader-migration/resources/transform-fcl-service.xml)
===================================================================
--- cacheloader_migration/trunk/src/examples/resources/transform-fcl-service.xml	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/resources/transform-fcl-service.xml	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Sample TreeCache Service Configuration                               -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+   <!-- ==================================================================== -->
+   <!-- Defines TreeCache configuration                                      -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.cache.CacheImpl"
+          name="jboss.cache:service=TreeCache">
+
+      <depends>jboss:service=Naming</depends>
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!--
+          Configure the TransactionManager
+      -->
+      <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+      </attribute>
+
+      <!--
+          Isolation level : SERIALIZABLE
+                            REPEATABLE_READ (default)
+                            READ_COMMITTED
+                            READ_UNCOMMITTED
+                            NONE
+      -->
+      <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+      <!--
+           Valid modes are LOCAL
+                           REPL_ASYNC
+                           REPL_SYNC
+                           INVALIDATION_ASYNC
+                           INVALIDATION_SYNC
+      -->
+      <attribute name="CacheMode">LOCAL</attribute>
+
+      <!--
+      Just used for async repl: use a replication queue
+      -->
+      <attribute name="UseReplQueue">false</attribute>
+
+      <!--
+          Replication interval for replication queue (in ms)
+      -->
+      <attribute name="ReplQueueInterval">0</attribute>
+
+      <!--
+          Max number of elements which trigger replication
+      -->
+      <attribute name="ReplQueueMaxElements">0</attribute>
+
+      <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+           cluster in order to find each other.
+      -->
+      <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+      <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS.  -->
+      <!--
+      <depends>jgroups.mux:name=Multiplexer</depends>
+      <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+      <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+      -->
+
+      <!-- JGroups protocol stack properties.
+         ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
+      -->
+      <attribute name="ClusterConfig">
+         <config>
+            <!-- UDP: if you have a multihomed machine,
+  set the bind_addr attribute to the appropriate NIC IP address -->
+            <!-- UDP: On Windows machines, because of the media sense feature
+      being broken with multicast (even after disabling media sense)
+      set the loopback attribute to true -->
+            <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+                 ip_ttl="64" ip_mcast="true"
+                 mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+                 ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+                 loopback="false"/>
+            <PING timeout="2000" num_initial_members="3"
+                  up_thread="false" down_thread="false"/>
+            <MERGE2 min_interval="10000" max_interval="20000"/>
+            <!--        <FD shun="true" up_thread="true" down_thread="true" />-->
+            <FD_SOCK/>
+            <VERIFY_SUSPECT timeout="1500"
+                            up_thread="false" down_thread="false"/>
+            <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+                           max_xmit_size="8192" up_thread="false" down_thread="false"/>
+            <UNICAST timeout="600,1200,2400" down_thread="false"/>
+            <pbcast.STABLE desired_avg_gossip="20000"
+                           up_thread="false" down_thread="false"/>
+            <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+                        shun="true" print_local_addr="true"/>
+            <FC max_credits="2000000" down_thread="false" up_thread="false"
+                min_threshold="0.20"/>
+            <FRAG frag_size="8192" down_thread="false" up_thread="true"/>
+            <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+         </config>
+      </attribute>
+
+
+      <!--
+          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
+      -->
+      <attribute name="InitialStateRetrievalTimeout">20000</attribute>
+
+      <!--
+          Number of milliseconds to wait until all responses for a
+          synchronous call have been received.
+      -->
+      <attribute name="SyncReplTimeout">20000</attribute>
+
+      <!-- Max number of milliseconds to wait for a lock acquisition -->
+      <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+      <!--
+       Whether or not to fetch state on joining a cluster
+       NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+      -->
+      <attribute name="FetchInMemoryState">false</attribute>
+
+      <attribute name="CacheLoaderConfiguration">
+         <config>
+            <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+            <passivation>false</passivation>
+            <shared>false</shared>
+
+            <!-- we can now have multiple cache loaders, which get chained -->
+            <cacheloader>
+               <class>org.jboss.cache.loader.TransformingFileCacheLoader</class>
+               <!-- same as the old CacheLoaderConfig attribute -->
+               <properties>
+                  location=/tmp/filecacheloader-1x
+               </properties>
+               <!-- whether the cache loader writes are asynchronous -->
+               <async>false</async>
+               <!-- only one cache loader in the chain may set fetchPersistentState to true.
+               An exception is thrown if more than one cache loader sets this to true. -->
+               <fetchPersistentState>false</fetchPersistentState>
+               <!-- determines whether this cache loader ignores writes - defaults to false. -->
+               <ignoreModifications>false</ignoreModifications>
+               <!-- if set to true, purges the contents of this cache loader when the cache starts up.
+               Defaults to false.  -->
+               <purgeOnStartup>false</purgeOnStartup>
+            </cacheloader>
+
+         </config>
+      </attribute>
+
+   </mbean>
+
+
+   <!--  Uncomment to get a graphical view of the TreeCache MBean above -->
+   <!--   <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
+   <!--      <depends>jboss.cache:service=TreeCache</depends>-->
+   <!--      <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+   <!--   </mbean>-->
+
+
+</server>

Copied: cacheloader_migration/trunk/src/examples/resources/transform-jdbccl-service.xml (from rev 4274, core/trunk/migration/examples/cacheloader-migration/resources/transform-jdbccl-service.xml)
===================================================================
--- cacheloader_migration/trunk/src/examples/resources/transform-jdbccl-service.xml	                        (rev 0)
+++ cacheloader_migration/trunk/src/examples/resources/transform-jdbccl-service.xml	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Sample TreeCache Service Configuration                               -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+   <!-- ==================================================================== -->
+   <!-- Defines TreeCache configuration                                      -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.cache.CacheImpl"
+          name="jboss.cache:service=TreeCache">
+
+      <depends>jboss:service=Naming</depends>
+      <depends>jboss:service=TransactionManager</depends>
+
+      <!--
+          Configure the TransactionManager
+      -->
+      <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+      </attribute>
+
+      <!--
+          Isolation level : SERIALIZABLE
+                            REPEATABLE_READ (default)
+                            READ_COMMITTED
+                            READ_UNCOMMITTED
+                            NONE
+      -->
+      <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+      <!--
+           Valid modes are LOCAL
+                           REPL_ASYNC
+                           REPL_SYNC
+                           INVALIDATION_ASYNC
+                           INVALIDATION_SYNC
+      -->
+      <attribute name="CacheMode">LOCAL</attribute>
+
+      <!--
+      Just used for async repl: use a replication queue
+      -->
+      <attribute name="UseReplQueue">false</attribute>
+
+      <!--
+          Replication interval for replication queue (in ms)
+      -->
+      <attribute name="ReplQueueInterval">0</attribute>
+
+      <!--
+          Max number of elements which trigger replication
+      -->
+      <attribute name="ReplQueueMaxElements">0</attribute>
+
+      <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+           cluster in order to find each other.
+      -->
+      <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+      <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS.  -->
+      <!--
+      <depends>jgroups.mux:name=Multiplexer</depends>
+      <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+      <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+      -->
+
+      <!-- JGroups protocol stack properties.
+         ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
+      -->
+      <attribute name="ClusterConfig">
+         <config>
+            <!-- UDP: if you have a multihomed machine,
+  set the bind_addr attribute to the appropriate NIC IP address -->
+            <!-- UDP: On Windows machines, because of the media sense feature
+      being broken with multicast (even after disabling media sense)
+      set the loopback attribute to true -->
+            <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+                 ip_ttl="64" ip_mcast="true"
+                 mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+                 ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+                 loopback="false"/>
+            <PING timeout="2000" num_initial_members="3"
+                  up_thread="false" down_thread="false"/>
+            <MERGE2 min_interval="10000" max_interval="20000"/>
+            <!--        <FD shun="true" up_thread="true" down_thread="true" />-->
+            <FD_SOCK/>
+            <VERIFY_SUSPECT timeout="1500"
+                            up_thread="false" down_thread="false"/>
+            <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+                           max_xmit_size="8192" up_thread="false" down_thread="false"/>
+            <UNICAST timeout="600,1200,2400" down_thread="false"/>
+            <pbcast.STABLE desired_avg_gossip="20000"
+                           up_thread="false" down_thread="false"/>
+            <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+                        shun="true" print_local_addr="true"/>
+            <FC max_credits="2000000" down_thread="false" up_thread="false"
+                min_threshold="0.20"/>
+            <FRAG frag_size="8192" down_thread="false" up_thread="true"/>
+            <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+         </config>
+      </attribute>
+
+
+      <!--
+          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
+      -->
+      <attribute name="InitialStateRetrievalTimeout">20000</attribute>
+
+      <!--
+          Number of milliseconds to wait until all responses for a
+          synchronous call have been received.
+      -->
+      <attribute name="SyncReplTimeout">20000</attribute>
+
+      <!-- Max number of milliseconds to wait for a lock acquisition -->
+      <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+      <!--
+       Whether or not to fetch state on joining a cluster
+       NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+      -->
+      <attribute name="FetchInMemoryState">false</attribute>
+
+      <attribute name="CacheLoaderConfiguration">
+         <config>
+            <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+            <passivation>false</passivation>
+            <shared>false</shared>
+
+            <!-- we can now have multiple cache loaders, which get chained -->
+            <cacheloader>
+               <class>org.jboss.cache.loader.TransformingJDBCCacheLoader</class>
+               <!-- same as the old CacheLoaderConfig attribute -->
+               <properties>
+                  cache.jdbc.table.name=jbosscache
+                  cache.jdbc.table.create=true
+                  cache.jdbc.table.drop=false
+                  cache.jdbc.table.primarykey=jbosscache_pk
+                  cache.jdbc.fqn.column=fqn
+                  cache.jdbc.fqn.type=varchar(255)
+                  cache.jdbc.node.column=node
+                  cache.jdbc.node.type=blob
+                  cache.jdbc.parent.column=parent
+                  cache.jdbc.sql-concat=1 || 2
+                  cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+                  cache.jdbc.url=jdbc:derby:jbossdb-1x;create=true
+                  cache.jdbc.user=user1
+                  cache.jdbc.password=user1 
+               </properties>
+               <!-- whether the cache loader writes are asynchronous -->
+               <async>false</async>
+               <!-- only one cache loader in the chain may set fetchPersistentState to true.
+               An exception is thrown if more than one cache loader sets this to true. -->
+               <fetchPersistentState>false</fetchPersistentState>
+               <!-- determines whether this cache loader ignores writes - defaults to false. -->
+               <ignoreModifications>false</ignoreModifications>
+               <!-- if set to true, purges the contents of this cache loader when the cache starts up.
+               Defaults to false.  -->
+               <purgeOnStartup>false</purgeOnStartup>
+            </cacheloader>
+
+         </config>
+      </attribute>
+
+   </mbean>
+
+
+   <!--  Uncomment to get a graphical view of the TreeCache MBean above -->
+   <!--   <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
+   <!--      <depends>jboss.cache:service=TreeCache</depends>-->
+   <!--      <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+   <!--   </mbean>-->
+
+
+</server>

Copied: cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingFileCacheLoader.java (from rev 4274, core/trunk/migration/src/org/jboss/cache/loader/TransformingFileCacheLoader.java)
===================================================================
--- cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingFileCacheLoader.java	                        (rev 0)
+++ cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingFileCacheLoader.java	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import org.jboss.util.stream.MarshalledValueInputStream;
+
+import java.io.FileInputStream;
+import java.io.File;
+
+/**
+ * Transforming file cache loader. It unmarshalls (read from file store) data in the way
+ * JBossCache 1.x did.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransformingFileCacheLoader extends FileCacheLoader
+{
+   @Override
+   protected Object unmarshall(File from) throws Exception
+   {
+      FileInputStream in = new FileInputStream(from);
+      MarshalledValueInputStream input = new MarshalledValueInputStream(in);
+      Object unmarshalledObj = input.readObject();
+      in.close();
+      return unmarshalledObj;
+   }
+}

Copied: cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java (from rev 4274, core/trunk/migration/src/org/jboss/cache/loader/TransformingJDBCCacheLoader.java)
===================================================================
--- cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java	                        (rev 0)
+++ cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import org.jboss.invocation.MarshalledValue;
+
+import java.io.ObjectInputStream;
+import java.io.InputStream;
+import java.rmi.MarshalledObject;
+
+/**
+ * Transforming JDBC cache loader. It unmarshalls (read from JDBC db store) data in the way
+ * JBossCache 1.x did.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransformingJDBCCacheLoader extends JDBCCacheLoader
+{
+   @Override
+   protected Object unmarshall(InputStream from) throws Exception
+   {
+      ObjectInputStream ois = new ObjectInputStream(from);
+      Object marshalledNode = ois.readObject();
+
+      // de-marshall value if possible
+      if(marshalledNode instanceof MarshalledValue)
+      {
+         return ((MarshalledValue) marshalledNode).get();
+      }
+      else if(marshalledNode instanceof MarshalledObject)
+      {
+         return ((MarshalledObject) marshalledNode).get();
+      }
+
+      return null;
+   }
+}

Copied: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java (from rev 4274, core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java)
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java	                        (rev 0)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.Configuration;
+
+import java.util.HashMap;
+
+/**
+ * Transforming cache loader test base.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransformingCacheLoaderTestBase extends AbstractCacheLoaderTestBase
+{
+   private static final String CAPITAL = "capital";
+   private static final String CURRENCY = "currency";
+   private static final String POPULATION = "population";
+   private static final String AREA = "area";
+   private static final String EUROPE_NODE = "Europe";      
+
+   protected CacheImpl createCache() throws Exception
+   {
+      CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = new Configuration();
+      cache.setConfiguration(c);
+      c.setCacheMode(Configuration.CacheMode.LOCAL);
+      c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      return cache;
+   }
+
+   protected void loadCache(CacheImpl cache) throws Exception
+   {
+      cache.put(EUROPE_NODE, new HashMap());
+      cache.put("Europe/Austria", new HashMap());
+      cache.put("Europe/Austria", CAPITAL, "Vienna");
+      cache.put("Europe/Austria", CURRENCY, "Euro");
+      cache.put("Europe/Austria", POPULATION, new Integer(8184691));
+
+      cache.put("Europe/England", new HashMap());
+      cache.put("Europe/England", CAPITAL, "London");
+      cache.put("Europe/England", CURRENCY, "British Pound");
+      cache.put("Europe/England", POPULATION, new Integer(60441457));
+
+      HashMap albania = new HashMap(4);
+      albania.put(CAPITAL, "Tirana");
+      albania.put(CURRENCY, "Lek");
+      albania.put(POPULATION, new Integer(3563112));
+      albania.put(AREA, new Integer(28748));
+      cache.put("Europe/Albania", albania);
+
+      HashMap hungary = new HashMap(4);
+      hungary.put(CAPITAL, "Budapest");
+      hungary.put(CURRENCY, "Forint");
+      hungary.put(POPULATION, new Integer(10006835));
+      hungary.put(AREA, new Integer(93030));
+      cache.put("Europe/Hungary", hungary);
+   }
+
+   protected void checkData(CacheImpl cache) throws Exception
+   {
+      assertEquals("Vienna", cache.get("Europe/Austria", CAPITAL));
+      assertEquals("Euro", cache.get("Europe/Austria", CURRENCY));
+      assertEquals(8184691, cache.get("Europe/Austria", POPULATION));
+
+      assertEquals("London", cache.get("Europe/England", CAPITAL));
+      assertEquals("British Pound", cache.get("Europe/England", CURRENCY));
+      assertEquals(60441457, cache.get("Europe/England", POPULATION));
+
+      assertEquals("Tirana", cache.get("Europe/Albania", CAPITAL));
+      assertEquals("Lek", cache.get("Europe/Albania", CURRENCY));
+      assertEquals(3563112, cache.get("Europe/Albania", POPULATION));
+      assertEquals(28748, cache.get("Europe/Albania", AREA));
+
+      assertEquals("Budapest", cache.get("Europe/Hungary", CAPITAL));
+      assertEquals("Forint", cache.get("Europe/Hungary", CURRENCY));
+      assertEquals(10006835, cache.get("Europe/Hungary", POPULATION));
+      assertEquals(93030, cache.get("Europe/Hungary", AREA));      
+   }
+}

Copied: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java (from rev 4274, core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java)
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java	                        (rev 0)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import junit.framework.TestCase;
+
+import java.io.FileOutputStream;
+import java.io.File;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.nio.channels.FileChannel;
+import java.util.HashMap;
+
+import org.jboss.cache.marshall.ObjectSerializationFactory;
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.config.Configuration;
+
+/**
+ * Unit tests for TransformingFileCacheLoader
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransformingFileCacheLoaderTest extends TransformingCacheLoaderTestBase
+{
+   private CacheImpl cache;
+   private String targetLoc;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();    //To change body of overridden methods use File | Settings | File Templates.
+
+      String targetDir = System.getProperty("java.io.tmpdir", "/tmp");
+      targetLoc = targetDir + "/filecacheloader-1x";
+
+      cache = createCache();
+
+      cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
+            "org.jboss.cache.loader.TransformingFileCacheLoaderTest$LegacyFileCacheLoader",
+            "location=" + targetLoc, false, true, false));
+
+      TestingUtil.recursiveFileRemove(targetLoc);      
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      cache.stop();
+      cache.destroy();
+      TestingUtil.recursiveFileRemove(targetLoc);      
+   }
+
+   public void testPutGetData() throws Exception
+   {
+      cache.start();
+
+      loadCache(cache);
+
+      cache.evict(Fqn.fromString("/"), true);
+
+      checkData(cache);
+   }
+
+   public static class LegacyFileCacheLoader extends TransformingFileCacheLoader
+   {
+      @Override
+      protected void marshall(Object obj, File to) throws Exception
+      {
+         FileOutputStream out = new FileOutputStream(to);
+         ObjectOutputStream output = new ObjectOutputStream(out);
+         output.writeObject(obj);
+         out.close();
+      }
+   } 
+}

Copied: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java (from rev 4274, core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java)
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java	                        (rev 0)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java	2007-08-15 09:25:11 UTC (rev 4284)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.Fqn;
+import org.jboss.invocation.MarshalledValue;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Properties;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * Unit tests for TransformingJDBCCacheLoader
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransformingJDBCCacheLoaderTest extends TransformingCacheLoaderTestBase
+{
+   private CacheImpl cache;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      cache = createCache();
+
+      Properties prop = getProperties();
+
+      String cacheJdbcUrl = changeDbName(prop.getProperty("cache.jdbc.url"));
+
+      String props = "cache.jdbc.driver =" + prop.getProperty("cache.jdbc.driver") + "\n" +
+            "cache.jdbc.url=" + cacheJdbcUrl + "\n" +
+            "cache.jdbc.user=" + prop.getProperty("cache.jdbc.user") + "\n" +
+            "cache.jdbc.password=" + prop.getProperty("cache.jdbc.password") + "\n" +
+            "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type") + "\n" +
+            "cache.jdbc.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat");
+
+      cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("",
+            "org.jboss.cache.loader.TransformingJDBCCacheLoaderTest$LegacyJDBCCacheLoader", props, false, true, false));
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      cache.stop();
+      cache.destroy();
+   }
+
+   public void testPutGetData() throws Exception
+   {
+      cache.start();
+                          
+      loadCache(cache);
+
+      cache.evict(Fqn.fromString("/"), true);
+
+      checkData(cache);      
+   }
+
+   protected Properties getProperties() throws Exception
+   {
+      Properties properties = new Properties();
+      try
+      {
+         properties.load(this.getClass().getClassLoader().getResourceAsStream("cache-jdbc.properties"));
+         return properties;
+      }
+      catch (Exception e)
+      {
+         throw new Exception("Error loading jdbc properties ", e);
+      }
+   }
+
+   private String changeDbName(String url)
+   {
+      return url.replaceFirst("jbossdb", "jbossdb-1x");
+   }
+
+   public static class LegacyJDBCCacheLoader extends TransformingJDBCCacheLoader
+   {
+      @Override
+      protected byte[] marshall(Object obj) throws Exception
+      {
+         Object marshalledNode = new MarshalledValue(obj);
+         ByteArrayOutputStream baos = new ByteArrayOutputStream();
+         ObjectOutputStream oos = new ObjectOutputStream(baos);
+         oos.writeObject(marshalledNode);
+         return baos.toByteArray();
+      }
+   }
+}




More information about the jbosscache-commits mailing list