JBoss Cache SVN: r4293 - in pojo/trunk/src: examples and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 07:06:20 -0400 (Wed, 15 Aug 2007)
New Revision: 4293
Added:
pojo/trunk/src/examples/
pojo/trunk/src/examples/PojoCache/
Log:
Moved examples here from core
Copied: pojo/trunk/src/examples/PojoCache (from rev 4285, core/trunk/examples/PojoCache)
17 years, 4 months
JBoss Cache SVN: r4292 - core/trunk/examples.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 07:05:58 -0400 (Wed, 15 Aug 2007)
New Revision: 4292
Removed:
core/trunk/examples/PojoCache/
Log:
17 years, 4 months
JBoss Cache SVN: r4291 - in core/trunk: src/main/docbook/userguide/en and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 07:01:38 -0400 (Wed, 15 Aug 2007)
New Revision: 4291
Modified:
core/trunk/pom.xml
core/trunk/src/main/docbook/userguide/en/master.xml
core/trunk/src/main/java/org/jboss/cache/Version.java
Log:
Versioning
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2007-08-15 10:54:29 UTC (rev 4290)
+++ core/trunk/pom.xml 2007-08-15 11:01:38 UTC (rev 4291)
@@ -69,7 +69,8 @@
<groupId>jmock</groupId>
<artifactId>jmock</artifactId>
<version>1.2.0</version>
- </dependency>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: core/trunk/src/main/docbook/userguide/en/master.xml
===================================================================
--- core/trunk/src/main/docbook/userguide/en/master.xml 2007-08-15 10:54:29 UTC (rev 4290)
+++ core/trunk/src/main/docbook/userguide/en/master.xml 2007-08-15 11:01:38 UTC (rev 4291)
@@ -21,8 +21,8 @@
<subtitle>A clustered, transactional cache</subtitle>
<!-- Release version and date -->
- <releaseinfo>Release 2.0.0 Habanero</releaseinfo>
- <pubdate>June 2007</pubdate>
+ <releaseinfo>Release 2.1.0 Alegrias</releaseinfo>
+ <pubdate>October 2007</pubdate>
<!-- Authors/contributors -->
<author>
Modified: core/trunk/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Version.java 2007-08-15 10:54:29 UTC (rev 4290)
+++ core/trunk/src/main/java/org/jboss/cache/Version.java 2007-08-15 11:01:38 UTC (rev 4291)
@@ -10,9 +10,9 @@
*/
public class Version
{
- public static final String version = "2.0.0.GA";
- public static final String codename = "Habanero";
- public static byte[] version_id = {'0', '2', '0', '0'};
+ public static final String version = "2.1.0-SNAPSHOT";
+ public static final String codename = "Alegrias";
+ public static byte[] version_id = {'0', '2', '1', '0', 'S'};
public static final String cvs = "$Id$";
private static final int MAJOR_SHIFT = 11;
17 years, 4 months
JBoss Cache SVN: r4290 - /.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 06:54:29 -0400 (Wed, 15 Aug 2007)
New Revision: 4290
Added:
cacheloader-migration/
Removed:
cacheloader_migration/
Log:
Renamed
Copied: cacheloader-migration (from rev 4289, cacheloader_migration)
17 years, 4 months
JBoss Cache SVN: r4289 - cacheloader_migration/trunk/src/examples/misc.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 06:50:03 -0400 (Wed, 15 Aug 2007)
New Revision: 4289
Removed:
cacheloader_migration/trunk/src/examples/misc/build.bat
cacheloader_migration/trunk/src/examples/misc/build.sh
Modified:
cacheloader_migration/trunk/src/examples/misc/build.properties
Log:
Removed scripts (users should use ant directly) and updated props file.
Deleted: cacheloader_migration/trunk/src/examples/misc/build.bat
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.bat 2007-08-15 10:48:03 UTC (rev 4288)
+++ cacheloader_migration/trunk/src/examples/misc/build.bat 2007-08-15 10:50:03 UTC (rev 4289)
@@ -1,4 +0,0 @@
-@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 %*
Modified: cacheloader_migration/trunk/src/examples/misc/build.properties
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.properties 2007-08-15 10:48:03 UTC (rev 4288)
+++ cacheloader_migration/trunk/src/examples/misc/build.properties 2007-08-15 10:50:03 UTC (rev 4289)
@@ -10,7 +10,7 @@
# create directory structure
#
-cache.home=${basedir}/../..
+cache.home=${basedir}/..
cache.lib=${cache.home}/lib
#Directory for Junit test result. Subdirectory html contains the result in html format.
Deleted: cacheloader_migration/trunk/src/examples/misc/build.sh
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/build.sh 2007-08-15 10:48:03 UTC (rev 4288)
+++ cacheloader_migration/trunk/src/examples/misc/build.sh 2007-08-15 10:50:03 UTC (rev 4289)
@@ -1,26 +0,0 @@
-#!/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
17 years, 4 months
JBoss Cache SVN: r4288 - in cacheloader_migration/trunk: src/examples/misc and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 06:48:03 -0400 (Wed, 15 Aug 2007)
New Revision: 4288
Modified:
cacheloader_migration/trunk/assembly.xml
cacheloader_migration/trunk/src/examples/misc/readme.txt
Log:
Fixed assembly paths and readme doc
Modified: cacheloader_migration/trunk/assembly.xml
===================================================================
--- cacheloader_migration/trunk/assembly.xml 2007-08-15 10:43:05 UTC (rev 4287)
+++ cacheloader_migration/trunk/assembly.xml 2007-08-15 10:48:03 UTC (rev 4288)
@@ -20,7 +20,19 @@
<!-- examples -->
<fileSet>
- <directory>src/examples</directory>
+ <directory>src/examples/java</directory>
+ <outputDirectory>examples/src</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/examples/resources</directory>
+ <outputDirectory>examples/resources</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/examples/data</directory>
+ <outputDirectory>examples/data</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/examples/misc</directory>
<outputDirectory>examples</outputDirectory>
</fileSet>
Modified: cacheloader_migration/trunk/src/examples/misc/readme.txt
===================================================================
--- cacheloader_migration/trunk/src/examples/misc/readme.txt 2007-08-15 10:43:05 UTC (rev 4287)
+++ cacheloader_migration/trunk/src/examples/misc/readme.txt 2007-08-15 10:48:03 UTC (rev 4288)
@@ -2,6 +2,8 @@
stores generated with JBoss Cache 1.x to a format that it's readable by JBossCache
2.x.
+NB: Ant >= 1.6.0 is required for this example.
+
Both of the examples rely on zipped cache stores containing the following structure
stored in it:
@@ -31,9 +33,9 @@
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
+- Run "ant 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
+- Run "ant 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
17 years, 4 months
JBoss Cache SVN: r4287 - in cacheloader_migration/trunk: src/main/java/org/jboss/cache/loader and 5 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 06:43:05 -0400 (Wed, 15 Aug 2007)
New Revision: 4287
Added:
cacheloader_migration/trunk/README.txt
cacheloader_migration/trunk/assembly.xml
cacheloader_migration/trunk/pom.xml
cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/AbstractCacheLoaderTestBase.java
cacheloader_migration/trunk/src/test/java/org/jboss/cache/misc/
cacheloader_migration/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
cacheloader_migration/trunk/src/test/resources/
cacheloader_migration/trunk/src/test/resources/cache-jdbc.properties
cacheloader_migration/trunk/src/test/resources/log4j.xml
Modified:
cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java
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 to standalone module
Added: cacheloader_migration/trunk/README.txt
===================================================================
--- cacheloader_migration/trunk/README.txt (rev 0)
+++ cacheloader_migration/trunk/README.txt 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,7 @@
+Usage
+
+mvn compile - to compile srcs
+mvn test - to run tests
+mvn package - to build the distribution
+mvn install - to install to local repository
+mvn deploy - to deploy this to public repositories
Added: cacheloader_migration/trunk/assembly.xml
===================================================================
--- cacheloader_migration/trunk/assembly.xml (rev 0)
+++ cacheloader_migration/trunk/assembly.xml 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,55 @@
+<assembly>
+ <id>all</id>
+
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>true</includeBaseDirectory>
+
+ <fileSets>
+
+ <!-- code -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory/>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+
+ <!-- examples -->
+ <fileSet>
+ <directory>src/examples</directory>
+ <outputDirectory>examples</outputDirectory>
+ </fileSet>
+
+ <!-- srcs -->
+ <fileSet>
+ <directory>src/main/java</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+
+ <!-- tests -->
+ <fileSet>
+ <directory>src/test/java</directory>
+ <outputDirectory>test</outputDirectory>
+ </fileSet>
+
+ <!-- test resources -->
+ <fileSet>
+ <directory>src/test/resources</directory>
+ <outputDirectory>test</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
Added: cacheloader_migration/trunk/pom.xml
===================================================================
--- cacheloader_migration/trunk/pom.xml (rev 0)
+++ cacheloader_migration/trunk/pom.xml 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <properties>
+ <jbosscache-core-version>2.0.0</jbosscache-core-version>
+ </properties>
+ <parent>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-common-parent</artifactId>
+ <version>1.0</version>
+ </parent>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-cacheloader-migration</artifactId>
+ <version>${jbosscache-core-version}</version>
+ <name>JBoss Cache - CacheLoader Migration</name>
+ <description>JBoss Cache - CacheLoader Migration utility package for migrating data stores from JBoss Cache 1.x
+ format to 2.x format.
+ </description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <!-- dependency on just JBoss Cache 2.0.0 - perhaps we should change this to 2.1.0 as soon as we can. -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-cache</artifactId>
+ <version>2.0.0.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-1</version>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>install</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ <finalName>${artifactId}-${jbosscache-core-version}</finalName>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Modified: cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java
===================================================================
--- cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java 2007-08-15 09:26:13 UTC (rev 4286)
+++ cacheloader_migration/trunk/src/main/java/org/jboss/cache/loader/TransformingJDBCCacheLoader.java 2007-08-15 10:43:05 UTC (rev 4287)
@@ -6,10 +6,10 @@
*/
package org.jboss.cache.loader;
-import org.jboss.invocation.MarshalledValue;
+import org.jboss.aop.util.MarshalledValue;
+import java.io.InputStream;
import java.io.ObjectInputStream;
-import java.io.InputStream;
import java.rmi.MarshalledObject;
/**
@@ -27,11 +27,11 @@
Object marshalledNode = ois.readObject();
// de-marshall value if possible
- if(marshalledNode instanceof MarshalledValue)
+ if (marshalledNode instanceof MarshalledValue)
{
return ((MarshalledValue) marshalledNode).get();
}
- else if(marshalledNode instanceof MarshalledObject)
+ else if (marshalledNode instanceof MarshalledObject)
{
return ((MarshalledObject) marshalledNode).get();
}
Added: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/AbstractCacheLoaderTestBase.java
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/AbstractCacheLoaderTestBase.java (rev 0)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/AbstractCacheLoaderTestBase.java 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.loader;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.xml.XmlHelper;
+import org.w3c.dom.Element;
+
+/**
+ * Very basic test case that provides methods to create a cache loader config.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
+ */
+public abstract class AbstractCacheLoaderTestBase
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ protected CacheLoaderConfig getSingleCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared) throws Exception
+ {
+ return getSingleCacheLoaderConfig(preload, cacheloaderClass, properties, async, fetchPersistentState, shared, false);
+ }
+
+ protected CacheLoaderConfig getSingleCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared, boolean purgeOnStartup) throws Exception
+ {
+ return getSingleCacheLoaderConfig(false, preload, cacheloaderClass, properties, async, fetchPersistentState, shared, purgeOnStartup);
+ }
+
+ protected CacheLoaderConfig getSingleCacheLoaderConfig(boolean passivation, String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared, boolean purgeOnStartup) throws Exception
+ {
+ String xml = "<config>\n" +
+ "<passivation>" + passivation + "</passivation>\n" +
+ "<preload>" + preload + "</preload>\n" +
+ "<cacheloader>\n" +
+ "<class>" + cacheloaderClass + "</class>\n" +
+ "<properties>" + properties + "</properties>\n" +
+ "<async>" + async + "</async>\n" +
+ "<shared>" + shared + "</shared>\n" +
+ "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
+ "<purgeOnStartup>" + purgeOnStartup + "</purgeOnStartup>\n" +
+ "</cacheloader>\n" +
+ "</config>";
+ Element element = XmlHelper.stringToElement(xml);
+ return XmlConfigurationParser.parseCacheLoaderConfig(element);
+ }
+}
Modified: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java 2007-08-15 09:26:13 UTC (rev 4286)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java 2007-08-15 10:43:05 UTC (rev 4287)
@@ -23,7 +23,7 @@
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";
+ private static final String EUROPE_NODE = "Europe";
protected CacheImpl createCache() throws Exception
{
@@ -65,22 +65,22 @@
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));
+ assert "Vienna".equals(cache.get("Europe/Austria", CAPITAL));
+ assert "Euro".equals(cache.get("Europe/Austria", CURRENCY));
+ assert cache.get("Europe/Austria", POPULATION).equals(8184691);
- assertEquals("London", cache.get("Europe/England", CAPITAL));
- assertEquals("British Pound", cache.get("Europe/England", CURRENCY));
- assertEquals(60441457, cache.get("Europe/England", POPULATION));
+ assert "London".equals(cache.get("Europe/England", CAPITAL));
+ assert "British Pound".equals(cache.get("Europe/England", CURRENCY));
+ assert cache.get("Europe/England", POPULATION).equals(60441457);
- 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));
+ assert "Tirana".equals(cache.get("Europe/Albania", CAPITAL));
+ assert "Lek".equals(cache.get("Europe/Albania", CURRENCY));
+ assert cache.get("Europe/Albania", POPULATION).equals(3563112);
+ assert cache.get("Europe/Albania", AREA).equals(28748);
- 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));
+ assert "Budapest".equals(cache.get("Europe/Hungary", CAPITAL));
+ assert "Forint".equals(cache.get("Europe/Hungary", CURRENCY));
+ assert cache.get("Europe/Hungary", POPULATION).equals(10006835);
+ assert cache.get("Europe/Hungary", AREA).equals(93030);
}
}
Modified: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-08-15 09:26:13 UTC (rev 4286)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-08-15 10:43:05 UTC (rev 4287)
@@ -6,58 +6,52 @@
*/
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;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
+
/**
* Unit tests for TransformingFileCacheLoader
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
*/
+@Test
public class TransformingFileCacheLoaderTest extends TransformingCacheLoaderTestBase
{
private CacheImpl cache;
private String targetLoc;
- @Override
+ @BeforeTest
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));
+ "org.jboss.cache.loader.TransformingFileCacheLoaderTest$LegacyFileCacheLoader",
+ "location=" + targetLoc, false, true, false));
- TestingUtil.recursiveFileRemove(targetLoc);
+ TestingUtil.recursiveFileRemove(targetLoc);
}
- @Override
+ @AfterTest
protected void tearDown() throws Exception
{
cache.stop();
cache.destroy();
- TestingUtil.recursiveFileRemove(targetLoc);
+ TestingUtil.recursiveFileRemove(targetLoc);
}
+ @Test
public void testPutGetData() throws Exception
{
cache.start();
@@ -79,5 +73,5 @@
output.writeObject(obj);
out.close();
}
- }
+ }
}
Modified: cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-08-15 09:26:13 UTC (rev 4286)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-08-15 10:43:05 UTC (rev 4287)
@@ -6,30 +6,30 @@
*/
package org.jboss.cache.loader;
+import org.jboss.aop.util.MarshalledValue;
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 org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
-import java.util.Properties;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
+import java.util.Properties;
/**
* Unit tests for TransformingJDBCCacheLoader
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
*/
+@Test
public class TransformingJDBCCacheLoaderTest extends TransformingCacheLoaderTestBase
{
private CacheImpl cache;
- @Override
+ @BeforeTest
protected void setUp() throws Exception
{
- super.setUp();
-
cache = createCache();
Properties prop = getProperties();
@@ -37,32 +37,33 @@
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.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));
+ "org.jboss.cache.loader.TransformingJDBCCacheLoaderTest$LegacyJDBCCacheLoader", props, false, true, false));
}
- @Override
+ @AfterTest
protected void tearDown() throws Exception
{
cache.stop();
cache.destroy();
}
+ @Test
public void testPutGetData() throws Exception
{
cache.start();
-
+
loadCache(cache);
cache.evict(Fqn.fromString("/"), true);
- checkData(cache);
+ checkData(cache);
}
protected Properties getProperties() throws Exception
Added: cacheloader_migration/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
===================================================================
--- cacheloader_migration/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java (rev 0)
+++ cacheloader_migration/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,385 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.cache.misc;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.interceptors.Interceptor;
+import org.jboss.cache.util.CachePrinter;
+
+import java.io.File;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Utilities for unit testing JBossCache.
+ *
+ * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class TestingUtil
+{
+
+ private static Random random = new Random();
+ public static final Object ALWAYS_EQUALS_OBJECT = new Object()
+ {
+ public boolean equals()
+ {
+ return true;
+ }
+ };
+
+ public static <T extends Interceptor> T findInterceptor(CacheSPI<?, ?> cache, Class<T> interceptorToFind)
+ {
+ for (Interceptor i : cache.getInterceptorChain())
+ {
+ if (interceptorToFind.isInstance(i)) return interceptorToFind.cast(i);
+ }
+ return null;
+ }
+
+ /**
+ * Injects an interceptor after a specified interceptor in a running cache. Your new interceptor need not be
+ * initialised with pointers to the next interceptor, etc. as this method does all that for you, including calling
+ * setCache().
+ *
+ * @param cache running cache instance
+ * @param interceptorToInject interceptor instance to inject.
+ * @param interceptorAfterWhichToInject class of interceptor to search for in the chain and after which to add your interceptor
+ */
+ public static void injectInterceptor(CacheSPI<?, ?> cache, Interceptor interceptorToInject, Class<? extends Interceptor> interceptorAfterWhichToInject)
+ {
+ System.out.println("Old interceptor chain: " + CachePrinter.printCacheInterceptors(cache));
+ interceptorToInject.setCache(cache);
+ int index = -1;
+ for (Interceptor i : cache.getInterceptorChain())
+ {
+ index++;
+ if (interceptorAfterWhichToInject.isInstance(i)) break;
+ }
+
+ cache.addInterceptor(interceptorToInject, index + 1);
+ System.out.println("New interceptor chain: " + CachePrinter.printCacheInterceptors(cache));
+ }
+
+ /**
+ * Loops, continually calling {@link #areCacheViewsComplete(org.jboss.cache.Cache[])}
+ * until it either returns true or <code>timeout</code> ms have elapsed.
+ *
+ * @param caches caches which must all have consistent views
+ * @param timeout max number of ms to loop
+ * @throws RuntimeException if <code>timeout</code> ms have elapse without
+ * all caches having the same number of members.
+ */
+ public static void blockUntilViewsReceived(Cache[] caches, long timeout)
+ {
+ long failTime = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < failTime)
+ {
+ sleepThread(100);
+ if (areCacheViewsComplete(caches))
+ {
+ return;
+ }
+ }
+
+ throw new RuntimeException("timed out before caches had complete views");
+ }
+
+ /**
+ * Version of blockUntilViewsReceived that uses varargs
+ */
+ public static void blockUntilViewsReceived(long timeout, Cache... caches)
+ {
+ blockUntilViewsReceived(caches, timeout);
+ }
+
+ /**
+ * Loops, continually calling {@link #areCacheViewsComplete(CacheImpl[])}
+ * until it either returns true or <code>timeout</code> ms have elapsed.
+ *
+ * @param caches caches which must all have consistent views
+ * @param timeout max number of ms to loop
+ * @throws RuntimeException if <code>timeout</code> ms have elapse without
+ * all caches having the same number of members.
+ */
+ public static void blockUntilViewsReceived(CacheImpl[] caches, long timeout)
+ {
+ long failTime = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < failTime)
+ {
+ sleepThread(100);
+ if (areCacheViewsComplete(caches))
+ {
+ return;
+ }
+ }
+
+ throw new RuntimeException("timed out before caches had complete views");
+ }
+
+ /**
+ * An overloaded version of {@link #blockUntilViewsReceived(long,org.jboss.cache.Cache[])} that allows for 'shrinking' clusters.
+ * I.e., the usual method barfs if there are more members than expected. This one takes a param (barfIfTooManyMembers) which,
+ * if false, will NOT barf but will wait until the cluster 'shrinks' to the desired size. Useful if in tests, you kill
+ * a member and want to wait until this fact is known across the cluster.
+ *
+ * @param timeout
+ * @param barfIfTooManyMembers
+ * @param caches
+ */
+ public static void blockUntilViewsReceived(long timeout, boolean barfIfTooManyMembers, Cache... caches)
+ {
+ long failTime = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < failTime)
+ {
+ sleepThread(100);
+ if (areCacheViewsComplete(caches, barfIfTooManyMembers))
+ {
+ return;
+ }
+ }
+
+ throw new RuntimeException("timed out before caches had complete views");
+ }
+
+ /**
+ * Loops, continually calling {@link #areCacheViewsComplete(CacheImpl[])}
+ * until it either returns true or <code>timeout</code> ms have elapsed.
+ *
+ * @param groupSize number of caches expected in the group
+ * @param timeout max number of ms to loop
+ * @throws RuntimeException if <code>timeout</code> ms have elapse without
+ * all caches having the same number of members.
+ */
+ public static void blockUntilViewReceived(CacheSPI cache, int groupSize, long timeout)
+ {
+ long failTime = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < failTime)
+ {
+ sleepThread(100);
+ if (isCacheViewComplete(cache, groupSize))
+ {
+ return;
+ }
+ }
+
+ throw new RuntimeException("timed out before caches had complete views");
+ }
+
+ /**
+ * Loops, continually calling {@link #areCacheViewsComplete(CacheImpl[])}
+ * until it either returns true or <code>timeout</code> ms have elapsed.
+ *
+ * @param groupSize number of caches expected in the group
+ * @param timeout max number of ms to loop
+ * @throws RuntimeException if <code>timeout</code> ms have elapse without
+ * all caches having the same number of members.
+ */
+ public static void blockUntilViewReceived(CacheImpl cache, int groupSize, long timeout)
+ {
+ long failTime = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < failTime)
+ {
+ sleepThread(100);
+ if (isCacheViewComplete(cache, groupSize))
+ {
+ return;
+ }
+ }
+
+ throw new RuntimeException("timed out before caches had complete views");
+ }
+
+ /**
+ * Checks each cache to see if the number of elements in the array
+ * returned by {@link CacheSPI#getMembers()} matches the size of
+ * the <code>caches</code> parameter.
+ *
+ * @param caches caches that should form a View
+ * @return <code>true</code> if all caches have
+ * <code>caches.length</code> members; false otherwise
+ * @throws IllegalStateException if any of the caches have MORE view
+ * members than caches.length
+ */
+ public static boolean areCacheViewsComplete(Cache[] caches)
+ {
+ return areCacheViewsComplete(caches, true);
+ }
+
+ public static boolean areCacheViewsComplete(Cache[] caches, boolean barfIfTooManyMembers)
+ {
+ int memberCount = caches.length;
+
+ for (int i = 0; i < memberCount; i++)
+ {
+ if (!isCacheViewComplete(caches[i], memberCount, barfIfTooManyMembers))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks each cache to see if the number of elements in the array
+ * returned by {@link CacheImpl#getMembers()} matches the size of
+ * the <code>caches</code> parameter.
+ *
+ * @param caches caches that should form a View
+ * @return <code>true</code> if all caches have
+ * <code>caches.length</code> members; false otherwise
+ * @throws IllegalStateException if any of the caches have MORE view
+ * members than caches.length
+ */
+ public static boolean areCacheViewsComplete(CacheImpl[] caches)
+ {
+ if (caches == null) throw new NullPointerException("Cache impl array is null");
+ Cache[] c = new Cache[caches.length];
+ for (int i = 0; i < caches.length; i++) c[i] = caches[i];
+ return areCacheViewsComplete(c);
+ }
+
+ /**
+ * @param cache
+ * @param memberCount
+ */
+ public static boolean isCacheViewComplete(CacheImpl cache, int memberCount)
+ {
+ List members = cache.getMembers();
+ if (members == null || memberCount > members.size())
+ {
+ return false;
+ }
+ else if (memberCount < members.size())
+ {
+ // This is an exceptional condition
+ StringBuffer sb = new StringBuffer("Cache at address ");
+ sb.append(cache.getLocalAddress());
+ sb.append(" had ");
+ sb.append(members.size());
+ sb.append(" members; expecting ");
+ sb.append(memberCount);
+ sb.append(". Members were (");
+ for (int j = 0; j < members.size(); j++)
+ {
+ if (j > 0)
+ {
+ sb.append(", ");
+ }
+ sb.append(members.get(j));
+ }
+ sb.append(')');
+
+ throw new IllegalStateException(sb.toString());
+ }
+
+ return true;
+ }
+
+ /**
+ * @param c
+ * @param memberCount
+ */
+ public static boolean isCacheViewComplete(Cache c, int memberCount)
+ {
+ return isCacheViewComplete(c, memberCount, true);
+ }
+
+ public static boolean isCacheViewComplete(Cache c, int memberCount, boolean barfIfTooManyMembers)
+ {
+ CacheSPI cache = (CacheSPI) c;
+ List members = cache.getMembers();
+ if (members == null || memberCount > members.size())
+ {
+ return false;
+ }
+ else if (memberCount < members.size())
+ {
+ if (barfIfTooManyMembers)
+ {
+ // This is an exceptional condition
+ StringBuffer sb = new StringBuffer("Cache at address ");
+ sb.append(cache.getLocalAddress());
+ sb.append(" had ");
+ sb.append(members.size());
+ sb.append(" members; expecting ");
+ sb.append(memberCount);
+ sb.append(". Members were (");
+ for (int j = 0; j < members.size(); j++)
+ {
+ if (j > 0)
+ {
+ sb.append(", ");
+ }
+ sb.append(members.get(j));
+ }
+ sb.append(')');
+
+ throw new IllegalStateException(sb.toString());
+ }
+ else return false;
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Puts the current thread to sleep for the desired number of ms, suppressing
+ * any exceptions.
+ *
+ * @param sleeptime number of ms to sleep
+ */
+ public static void sleepThread(long sleeptime)
+ {
+ try
+ {
+ Thread.sleep(sleeptime);
+ }
+ catch (InterruptedException ie)
+ {
+ }
+ }
+
+ public static void sleepRandom(int maxTime)
+ {
+ sleepThread(random.nextInt(maxTime));
+ }
+
+ public static void recursiveFileRemove(String directoryName)
+ {
+ File file = new File(directoryName);
+ if (file.exists())
+ {
+ System.out.println("Deleting file " + file);
+ recursivedelete(file);
+ }
+ }
+
+ private static void recursivedelete(File f)
+ {
+ if (f.isDirectory())
+ {
+ File[] files = f.listFiles();
+ for (File file : files)
+ {
+ recursivedelete(file);
+ }
+ }
+ //System.out.println("File " + f.toURI() + " deleted = " + f.delete());
+ f.delete();
+ }
+}
Added: cacheloader_migration/trunk/src/test/resources/cache-jdbc.properties
===================================================================
--- cacheloader_migration/trunk/src/test/resources/cache-jdbc.properties (rev 0)
+++ cacheloader_migration/trunk/src/test/resources/cache-jdbc.properties 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,65 @@
+##
+# Standard JBC table 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
+# Specify your DBMS's string concatenation function syntax in the following manner: concat(1 , 2) -> '12'.
+# This syntax should work an most popular DBMS like oracle, db2, mssql, mysql, PostgreSQL. Derby - on which
+#the tests are run does not support 'concat', but '1 || 2' . If no value is sepcified then concat(1 , 2) is used by default.
+cache.jdbc.sql-concat=1 || 2
+
+# JBoss Cache Table properties for Hypersonic, just overrides
+#cache.jdbc.node.type=OBJECT
+
+##
+# DataSource
+#cache.jdbc.datasource=DefaultDS
+
+##
+# JDBC driver specific properties
+
+# Hypersonic
+#cache.jdbc.node.type=OBJECT
+
+## MySql
+#cache.jdbc.driver=com.mysql.jdbc.Driver
+#cache.jdbc.url=jdbc:mysql://localhost:3306/jbossdb
+#cache.jdbc.user=root
+#cache.jdbc.password=admin
+
+## Oracle
+#cache.jdbc.driver=oracle.jdbc.OracleDriver
+#cache.jdbc.url=jdbc:oracle:thin:@192.168.0.100:1521:JBOSSDB
+#cache.jdbc.user=jboss
+#cache.jdbc.password=sa
+
+## MS Sql Server
+#cache.jdbc.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
+#cache.jdbc.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jbossdb;SelectMethod=cursor
+#cache.jdbc.user=sa
+#cache.jdbc.password=
+#cache.jdbc.node.type=image
+
+## Pointbase
+#cache.jdbc.driver=com.pointbase.jdbc.jdbcUniversalDriver
+#cache.jdbc.url=jdbc:pointbase:server://localhost:9092/jboss,new
+#cache.jdbc.user=PBPUBLIC
+#cache.jdbc.password=PBPUBLIC
+
+## PostgreSQL
+#cache.jdbc.driver = org.postgresql.Driver
+#cache.jdbc.url=jdbc:postgresql://192.168.0.100:5432/jbossdb
+#cache.jdbc.user=postgres
+#cache.jdbc.password=admin
+
+## Derby
+cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+cache.jdbc.url=jdbc:derby:jbossdb;create=true
+cache.jdbc.user=user1
+cache.jdbc.password=user1
\ No newline at end of file
Property changes on: cacheloader_migration/trunk/src/test/resources/cache-jdbc.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: cacheloader_migration/trunk/src/test/resources/log4j.xml
===================================================================
--- cacheloader_migration/trunk/src/test/resources/log4j.xml (rev 0)
+++ cacheloader_migration/trunk/src/test/resources/log4j.xml 2007-08-15 10:43:05 UTC (rev 4287)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 4263 2007-08-15 06:43:55Z manik.surtani(a)jboss.com $ -->
+
+<!--
+ | 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="output/jbosscache.log"/>
+ <param name="Append" value="true"/>
+
+ <!-- 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="DEBUG"/>
+
+ <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="TRACE"/>
+ <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>
+ -->
+
+ <category name="org.jboss.cache">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jboss.tm">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="org.jgroups">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="ERROR"/>
+ <appender-ref ref="CONSOLE"/>
+ <!--<appender-ref ref="FILE"/>-->
+ </root>
+
+</log4j:configuration>
17 years, 4 months
JBoss Cache SVN: r4286 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 05:26:13 -0400 (Wed, 15 Aug 2007)
New Revision: 4286
Removed:
core/trunk/migration/
Log:
Moved cacheloader migration code
17 years, 4 months
JBoss Cache SVN: r4285 - in core/trunk/migration: examples/cacheloader-migration/data and 4 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-08-15 05:25:32 -0400 (Wed, 15 Aug 2007)
New Revision: 4285
Removed:
core/trunk/migration/examples/cacheloader-migration/build.bat
core/trunk/migration/examples/cacheloader-migration/build.properties
core/trunk/migration/examples/cacheloader-migration/build.sh
core/trunk/migration/examples/cacheloader-migration/build.xml
core/trunk/migration/examples/cacheloader-migration/data/filecacheloader-1x.zip
core/trunk/migration/examples/cacheloader-migration/data/jbossdb-1x.zip
core/trunk/migration/examples/cacheloader-migration/log4j-cache.xml
core/trunk/migration/examples/cacheloader-migration/readme.txt
core/trunk/migration/examples/cacheloader-migration/resources/original-fcl-service.xml
core/trunk/migration/examples/cacheloader-migration/resources/original-jdbccl-service.xml
core/trunk/migration/examples/cacheloader-migration/resources/transform-fcl-service.xml
core/trunk/migration/examples/cacheloader-migration/resources/transform-jdbccl-service.xml
core/trunk/migration/examples/cacheloader-migration/src/examples/TransformStore.java
core/trunk/migration/src/org/jboss/cache/loader/TransformingFileCacheLoader.java
core/trunk/migration/src/org/jboss/cache/loader/TransformingJDBCCacheLoader.java
core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java
core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
Log:
Deleted: core/trunk/migration/examples/cacheloader-migration/build.bat
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/build.bat 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/build.bat 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,4 +0,0 @@
-@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 %*
Deleted: core/trunk/migration/examples/cacheloader-migration/build.properties
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/build.properties 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/build.properties 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,17 +0,0 @@
-# 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
Deleted: core/trunk/migration/examples/cacheloader-migration/build.sh
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/build.sh 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/build.sh 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,26 +0,0 @@
-#!/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
Deleted: core/trunk/migration/examples/cacheloader-migration/build.xml
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/build.xml 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/build.xml 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,91 +0,0 @@
-<?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 <command> 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>
Deleted: core/trunk/migration/examples/cacheloader-migration/data/filecacheloader-1x.zip
===================================================================
(Binary files differ)
Deleted: core/trunk/migration/examples/cacheloader-migration/data/jbossdb-1x.zip
===================================================================
(Binary files differ)
Deleted: core/trunk/migration/examples/cacheloader-migration/log4j-cache.xml
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/log4j-cache.xml 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/log4j-cache.xml 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,106 +0,0 @@
-<?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>
Deleted: core/trunk/migration/examples/cacheloader-migration/readme.txt
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/readme.txt 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/readme.txt 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,39 +0,0 @@
-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
Deleted: core/trunk/migration/examples/cacheloader-migration/resources/original-fcl-service.xml
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/resources/original-fcl-service.xml 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/resources/original-fcl-service.xml 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,174 +0,0 @@
-<?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>
Deleted: core/trunk/migration/examples/cacheloader-migration/resources/original-jdbccl-service.xml
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/resources/original-jdbccl-service.xml 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/resources/original-jdbccl-service.xml 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,187 +0,0 @@
-<?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>
Deleted: core/trunk/migration/examples/cacheloader-migration/resources/transform-fcl-service.xml
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/resources/transform-fcl-service.xml 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/resources/transform-fcl-service.xml 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,174 +0,0 @@
-<?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>
Deleted: core/trunk/migration/examples/cacheloader-migration/resources/transform-jdbccl-service.xml
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/resources/transform-jdbccl-service.xml 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/resources/transform-jdbccl-service.xml 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,187 +0,0 @@
-<?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>
Deleted: core/trunk/migration/examples/cacheloader-migration/src/examples/TransformStore.java
===================================================================
--- core/trunk/migration/examples/cacheloader-migration/src/examples/TransformStore.java 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/examples/cacheloader-migration/src/examples/TransformStore.java 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,87 +0,0 @@
-/*
- * 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@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);
- }
- }
-}
Deleted: core/trunk/migration/src/org/jboss/cache/loader/TransformingFileCacheLoader.java
===================================================================
--- core/trunk/migration/src/org/jboss/cache/loader/TransformingFileCacheLoader.java 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/src/org/jboss/cache/loader/TransformingFileCacheLoader.java 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,31 +0,0 @@
-/*
- * 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@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;
- }
-}
Deleted: core/trunk/migration/src/org/jboss/cache/loader/TransformingJDBCCacheLoader.java
===================================================================
--- core/trunk/migration/src/org/jboss/cache/loader/TransformingJDBCCacheLoader.java 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/src/org/jboss/cache/loader/TransformingJDBCCacheLoader.java 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,41 +0,0 @@
-/*
- * 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@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;
- }
-}
Deleted: core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java
===================================================================
--- core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingCacheLoaderTestBase.java 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,86 +0,0 @@
-/*
- * 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@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));
- }
-}
Deleted: core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
===================================================================
--- core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,83 +0,0 @@
-/*
- * 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@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();
- }
- }
-}
Deleted: core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
===================================================================
--- core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-08-15 09:25:11 UTC (rev 4284)
+++ core/trunk/migration/tests/functional/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-08-15 09:25:32 UTC (rev 4285)
@@ -1,99 +0,0 @@
-/*
- * 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@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();
- }
- }
-}
17 years, 4 months
JBoss Cache SVN: r4284 - in cacheloader_migration/trunk/src: examples/java and 9 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)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@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 @@
+@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 <command> 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@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@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@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@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@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();
+ }
+ }
+}
17 years, 4 months