[infinispan-commits] Infinispan SVN: r317 - in trunk: core/src/main/resources and 3 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Sun May 17 23:57:41 EDT 2009
Author: mircea.markus
Date: 2009-05-17 23:57:41 -0400 (Sun, 17 May 2009)
New Revision: 317
Added:
trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java
trunk/core/src/main/resources/importConfig.bat
trunk/core/src/main/resources/importConfig.sh
trunk/core/src/main/resources/xslt/
trunk/core/src/main/resources/xslt/indent.xslt
trunk/core/src/main/resources/xslt/jbc3x2infinispan4x.xslt
trunk/core/src/main/resources/xslt/jgroupsFileGen.xslt
Removed:
trunk/core/src/test/java/org/infinispan/config/ConfigFilesConvertor.java
trunk/src/main/resources/xslt/indent.xslt
trunk/src/main/resources/xslt/jbc3x2infinispan4x.xslt
trunk/src/main/resources/xslt/jgroupsFileGen.xslt
Log:
ongoing config inport work
Copied: trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java (from rev 315, trunk/core/src/test/java/org/infinispan/config/ConfigFilesConvertor.java)
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java 2009-05-18 03:57:41 UTC (rev 317)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.config.parsing;
+
+import org.infinispan.util.FileLookup;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Class used for converting different configuration files to INFINISPAN format.
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 4.0
+ */
+public class ConfigFilesConvertor {
+
+
+ private static final String JBOSS_CACHE3X = "JBossCache3x";
+ public static final String[] SUPPORTED_FORMATS = {JBOSS_CACHE3X};
+
+ public void parse(InputStream is, OutputStream os, String xsltFile) throws Exception {
+ InputStream xsltInStream = new FileLookup().lookupFile(xsltFile);
+ if (xsltInStream == null) {
+ throw new IllegalStateException("Cold not find xslt file! : " + xsltFile);
+ }
+
+ Document document = getInputDocument(is);
+
+ // Use a Transformer for output
+ Transformer transformer = getTransformer(xsltInStream);
+
+ DOMSource source = new DOMSource(document);
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(byteArrayOutputStream);
+ transformer.transform(source, result);
+
+ InputStream indentation = new FileLookup().lookupFile("xslt/indent.xslt");
+ // Use a Transformer for output
+ transformer = getTransformer(indentation);
+ StreamResult finalResult = new StreamResult(os);
+ StreamSource rawResult = new StreamSource(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
+ transformer.transform(rawResult, finalResult);
+ xsltInStream.close();
+ }
+
+ /**
+ * Writes to the <b>os</b> the 3.x configuration file resulted by transforming the 2.x configuration file passed in
+ * as <b>inputFile</b>. Transformation is performed according to the <b>xsltFile</b>. Both <b>inputFile</b> and he
+ * xslt file are looked up using a {@link org.jboss.cache.util.FileLookup}
+ */
+ public void parse(String inputFile, OutputStream os, String xsltFile) throws Exception {
+ InputStream stream = new FileLookup().lookupFile(inputFile);
+ try {
+ parse(stream, os, xsltFile);
+ }
+ finally {
+ stream.close();
+ }
+ }
+
+ /**
+ * usage : java org.jboss.cache.config.parsing.ConfigFilesConvertor -Dsource=config-2.x.xml
+ * -Ddestination=config-3.x.xnl
+ */
+ public static void main(String[] argv) throws Exception {
+ String sourceName = System.getProperty("source");
+ if (sourceName == null) {
+ System.err.println("Missing property 'source'.");
+ System.exit(1);
+ }
+ String destinationName = System.getProperty("destination");
+ if (destinationName == null) {
+ System.err.println("Missing property 'destination'.");
+ System.exit(1);
+ }
+ String type = System.getProperty("type");
+ if (type == null) {
+ System.err.println("Missing property 'type'.");
+ System.exit(1);
+ }
+
+ List<String> stringList = Arrays.asList(SUPPORTED_FORMATS);
+ if (!stringList.contains(type)) {
+ System.err.println("Unsupported transformation type: " + type + ". Supported formats are: " + stringList);
+ }
+
+ if (type.equals(JBOSS_CACHE3X)) {
+ transformFromJbossCache3x(sourceName, destinationName);
+ }
+
+ System.out.println("---");
+ System.out.println("New configuration file [" + destinationName + "] successfully created.");
+ System.out.println("---");
+ }
+
+ private static void transformFromJbossCache3x(String sourceName, String destinationName) throws Exception {
+ File oldConfig = new File(sourceName);
+ if (!oldConfig.exists()) {
+ System.err.println("File specified as input ('" + sourceName + ") does not exist.");
+ System.exit(1);
+ }
+ ConfigFilesConvertor convertor = new ConfigFilesConvertor();
+ FileInputStream is = new FileInputStream(oldConfig);
+ File destination = new File(destinationName);
+ if (!destination.exists()) destination.createNewFile();
+ FileOutputStream fos = new FileOutputStream(destinationName);
+ convertor.parse(is, fos, "xslt/jbc3x2infinispan4x.xslt");
+ fos.close();
+ is.close();
+
+ String jgroupsConfig = destination.getParent() + File.separator + "jgroupsConfig.xml";
+ File jgroupsConfigFile = new File(jgroupsConfig);
+ if (jgroupsConfigFile.exists()) jgroupsConfigFile.delete();
+ jgroupsConfigFile.createNewFile();
+ is = new FileInputStream(oldConfig);
+ fos = new FileOutputStream(jgroupsConfigFile);
+ convertor = new ConfigFilesConvertor();
+ convertor.parse(is, fos, "xslt/jgroupsFileGen.xslt");
+ is.close();
+ fos.close();
+
+ System.out.println("jgroupsConfigFile.length() = " + jgroupsConfigFile.length());
+ //now this means that the generated file is basically empty, so delete ie
+ if (jgroupsConfigFile.length() < 5) {
+ jgroupsConfigFile.delete();
+ }
+ }
+
+ private Transformer getTransformer(InputStream xsltInStream) throws TransformerConfigurationException {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ StreamSource stylesource = new StreamSource(xsltInStream);
+ return tFactory.newTransformer(stylesource);
+ }
+
+ private Document getInputDocument(InputStream is) throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder.parse(is);
+ }
+}
\ No newline at end of file
Property changes on: trunk/core/src/main/java/org/infinispan/config/parsing/ConfigFilesConvertor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/core/src/main/resources/importConfig.bat
===================================================================
--- trunk/core/src/main/resources/importConfig.bat (rev 0)
+++ trunk/core/src/main/resources/importConfig.bat 2009-05-18 03:57:41 UTC (rev 317)
@@ -0,0 +1,24 @@
+ at echo off
+
+if "%1a" == "a" goto noParams
+if "%2a" == "a" goto noParams
+if "%3a" == "a" goto noParams
+
+setlocal enabledelayedexpansion
+
+set LIB=
+for %%f in (..\modules\core\lib\*.jar) do set LIB=!LIB!;%%f
+rem echo libs: %LIB%
+
+set CP=%LIB%;..\modules\core\infinispan-core.jar;%CP%
+rem echo cp is %CP%
+
+java -classpath "%CP%" -Dsource=%1 -Ddestination=%2 -Dtype=%3 org.infinispan.config.parsing.ConfigFilesConvertor
+
+goto fileEnd
+
+:noParams
+echo usage: "%0 <file_to_transform> <destination_file> <source_file_type>"
+echo supported source types are: "JBossCache3x"
+
+:fileEnd
\ No newline at end of file
Added: trunk/core/src/main/resources/importConfig.sh
===================================================================
--- trunk/core/src/main/resources/importConfig.sh (rev 0)
+++ trunk/core/src/main/resources/importConfig.sh 2009-05-18 03:57:41 UTC (rev 317)
@@ -0,0 +1,18 @@
+#!/bin/bash
+if [ -z $1 ]
+then
+ echo Usage:
+ echo $0 [source_file] [destination_file] [source_file_type]
+ echo supported source types are: "JBossCache3x"
+ exit 1;
+fi
+if [ -e ../modules/core/lib ]
+then
+ for JAR in ../modules/core/lib/*
+ do
+ CLASSPATH=$CLASSPATH:$JAR
+ done
+fi
+CLASSPATH=../modules/core/infinispan-core.jar:$CLASSPATH
+echo classpath is $CLASSPATH
+java -classpath $CLASSPATH -Dsource=$1 -Ddestination=$2 org.jboss.cache.config.parsing.ConfigFilesConvertor
\ No newline at end of file
Property changes on: trunk/core/src/main/resources/importConfig.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/core/src/main/resources/xslt/indent.xslt (from rev 315, trunk/src/main/resources/xslt/indent.xslt)
===================================================================
--- trunk/core/src/main/resources/xslt/indent.xslt (rev 0)
+++ trunk/core/src/main/resources/xslt/indent.xslt 2009-05-18 03:57:41 UTC (rev 317)
@@ -0,0 +1,27 @@
+ <xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="xml"/>
+ <xsl:param name="indent-increment" select="' '" />
+
+ <xsl:template match="*">
+ <xsl:param name="indent" select="'
'"/>
+
+ <xsl:value-of select="$indent"/>
+ <xsl:copy>
+ <xsl:copy-of select="@*" />
+ <xsl:apply-templates>
+ <xsl:with-param name="indent"
+ select="concat($indent, $indent-increment)"/>
+ </xsl:apply-templates>
+ <xsl:if test="*">
+ <xsl:value-of select="$indent"/>
+ </xsl:if>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="comment()|processing-instruction()">
+ <xsl:copy />
+ </xsl:template>
+ <xsl:template match="text()[normalize-space(.)='']"/>
+
+</xsl:stylesheet>
\ No newline at end of file
Copied: trunk/core/src/main/resources/xslt/jbc3x2infinispan4x.xslt (from rev 315, trunk/src/main/resources/xslt/jbc3x2infinispan4x.xslt)
===================================================================
--- trunk/core/src/main/resources/xslt/jbc3x2infinispan4x.xslt (rev 0)
+++ trunk/core/src/main/resources/xslt/jbc3x2infinispan4x.xslt 2009-05-18 03:57:41 UTC (rev 317)
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
+
+ <xsl:template match="/jbosscache">
+
+ <xsl:element name="infinispan">
+ <xsl:element name="global">
+ <xsl:element name="asyncListenerExecutor">
+ <xsl:attribute name="factory">org.infinispan.executors.DefaultExecutorFactory</xsl:attribute>
+ <xsl:if test="listeners[@asyncPoolSize]">
+ <xsl:element name="property">
+ <xsl:attribute name="name">maxThreads</xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="normalize-space(listeners/@asyncPoolSize)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="listeners[@asyncQueueSize]">
+ <xsl:element name="property">
+ <xsl:attribute name="name">queueSize</xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="listeners/@asyncQueueSize"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <property name="threadNamePrefix" value="AsyncListenerThread"/>
+ </xsl:element>
+
+ <xsl:element name="asyncTransportExecutor">
+ <xsl:attribute name="factory">org.infinispan.executors.DefaultExecutorFactory</xsl:attribute>
+ <xsl:if test="clustering/async[@serializationExecutorPoolSize]">
+ <xsl:element name="property">
+ <xsl:attribute name="name">maxThreads</xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="clustering/async/@serializationExecutorPoolSize"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="clustering/async[@serializationExecutorQueueSize]">
+ <xsl:element name="property">
+ <xsl:attribute name="name">queueSize</xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="clustering/async/@serializationExecutorQueueSize"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <property name="threadNamePrefix" value="AsyncSerializationThread"/>
+ </xsl:element>
+
+ <evictionScheduledExecutor factory="org.infinispan.executors.DefaultScheduledExecutorFactory">
+ <property name="threadNamePrefix" value="EvictionThread"/>
+ </evictionScheduledExecutor>
+
+ <replicationQueueScheduledExecutor factory="org.infinispan.executors.DefaultScheduledExecutorFactory">
+ <property name="threadNamePrefix" value="ReplicationQueueThread"/>
+ </replicationQueueScheduledExecutor>
+
+ <xsl:element name="globalJmxStatistics">
+ <xsl:attribute name="jmxDomain">infinispan</xsl:attribute>
+ <xsl:if test="jmxStatistics[@enabled]">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="jmxStatistics/@enabled"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+
+ <xsl:element name="transport">
+ <xsl:attribute name="transportClass">org.infinispan.remoting.transport.jgroups.JGroupsTransport</xsl:attribute>
+ <xsl:if test="clustering[@clusterName]">
+ <xsl:attribute name="clusterName">
+ <xsl:value-of select="clustering/@clusterName"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/sync[@replTimeout]"> <!-- this defaults to 6000 -->
+ <xsl:attribute name="distributedSyncTimeout">
+ <xsl:value-of select="clustering/sync/@replTimeout"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/jgroupsConfig[@configFile]">
+ <xsl:element name="property">
+ <xsl:attribute name="name">configurationFile</xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="clustering/jgroupsConfig/@configFile"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="clustering/jgroupsConfig/*">
+ <xsl:element name="property">
+ <xsl:attribute name="name">configurationFile</xsl:attribute>
+ <xsl:attribute name="value">jgroupsConfig.xml</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ </xsl:element>
+
+
+ <xsl:element name="serialization">
+ <xsl:attribute name="marshallerClass">org.infinispan.marshall.VersionAwareMarshaller</xsl:attribute>
+ <xsl:attribute name="version">1.0</xsl:attribute>
+ <xsl:if test="serialization[@objectInputStreamPoolSize]">
+ <xsl:attribute name="objectInputStreamPoolSize">
+ <xsl:value-of select="serialization/@objectInputStreamPoolSize"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="serialization[@objectOutputStreamPoolSize]">
+ <xsl:attribute name="objectOutputStreamPoolSize">
+ <xsl:value-of select="serialization/@objectOutputStreamPoolSize"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+
+ <xsl:if test="shutdown[@hookBehavior]">
+ <xsl:element name="shutdown">
+ <xsl:attribute name="hookBehavior">
+ <xsl:value-of select="shutdown/@hookBehavior"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+
+ <default>
+
+ <xsl:if test="locking">
+ <xsl:element name="locking">
+ <xsl:if test="locking[@isolationLevel]">
+ <xsl:attribute name="isolationLevel">
+ <xsl:value-of select="locking/@isolationLevel"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="locking[@lockAcquisitionTimeout]">
+ <xsl:attribute name="lockAcquisitionTimeout">
+ <xsl:value-of select="locking/@lockAcquisitionTimeout"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="locking[@writeSkewCheck]">
+ <xsl:attribute name="writeSkewCheck">
+ <xsl:value-of select="locking/@writeSkewCheck"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="locking[@concurrencyLevel]">
+ <xsl:attribute name="concurrencyLevel">
+ <xsl:value-of select="locking/@concurrencyLevel"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+
+
+ <xsl:if test="transaction">
+ <xsl:element name="transaction">
+ <xsl:if test="transaction[@transactionManagerLookupClass]">
+ <xsl:if
+ test="not(starts-with(transaction/@transactionManagerLookupClass,'org.jboss.cache'))">
+ <xsl:message terminate="no">WARNING!!! Custom 'transactionManagerLookupClass' is being used.
+ This cannot
+ be automatically transformed.
+ </xsl:message>
+ </xsl:if>
+ <xsl:attribute name="transactionManagerLookupClass">
+ <xsl:value-of
+ select="concat('org.infinispan.transaction.lookup', substring-after(transaction/@transactionManagerLookupClass,'org.jboss.cache.transaction'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="transaction[@syncRollbackPhase]">
+ <xsl:attribute name="syncRollbackPhase">
+ <xsl:value-of select="transaction/@syncRollbackPhase"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="transaction[@syncCommitPhase]">
+ <xsl:attribute name="syncCommitPhase">
+ <xsl:value-of select="transaction/@syncCommitPhase"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:if test="jmxStatistics[@enabled]">
+ <xsl:element name="jmxStatistics">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="jmxStatistics/@enabled"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:if test="serialization[@useLazyDeserialization]">
+ <xsl:element name="lazyDeserialization">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="serialization/@useLazyDeserialization"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:if test="invocationBatching[@enabled]">
+ <xsl:element name="invocationBatching">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="invocationBatching/@enabled"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:if test="clustering">
+ <xsl:element name="clustering">
+ <xsl:if test="clustering[@mode]">
+ <xsl:attribute name="mode">
+ <xsl:value-of select="clustering/@mode"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/stateRetrieval">
+ <xsl:element name="stateRetrieval">
+ <xsl:if test="clustering/stateRetrieval[@timeout]">
+ <xsl:attribute name="timeout">
+ <xsl:value-of select="clustering/stateRetrieval/@timeout"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/stateRetrieval[@fetchInMemoryState]">
+ <xsl:attribute name="fetchInMemoryState">
+ <xsl:value-of select="clustering/stateRetrieval/@fetchInMemoryState"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="clustering/sync">
+ <xsl:element name="sync">
+ <xsl:if test="clustering/sync[@replTimeout]">
+ <xsl:attribute name="replTimeout">
+ <xsl:value-of select="clustering/sync/@replTimeout"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="async">
+ <xsl:if test="clustering/async[@useReplQueue]">
+ <xsl:attribute name="useReplQueue">
+ <xsl:value-of select="clustering/async/@useReplQueue"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/async[@replQueueInterval]">
+ <xsl:attribute name="replQueueInterval">
+ <xsl:value-of select="clustering/async/@replQueueInterval"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/async[@replQueueMaxElements]">
+ <xsl:attribute name="replQueueMaxElements">
+ <xsl:value-of select="clustering/async/@replQueueMaxElements"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="clustering/async[@serializationExecutorPoolSize > 1]">
+ <xsl:attribute name="asyncMarshalling">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:if test="loaders">
+ <xsl:element name="loaders">
+ <xsl:if test="loaders[@passivation]">
+ <xsl:attribute name="passivation">
+ <xsl:value-of select="loaders/@passivation"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="loaders[@shared]">
+ <xsl:attribute name="shared">
+ <xsl:value-of select="loaders/@shared"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="loaders/preload">
+ <xsl:message terminate="no">WARNING!!! Preload elements cannot be automatically transformed, please
+ do it manually!
+ </xsl:message>
+ </xsl:if>
+ <xsl:for-each select="loaders/loader">
+ <xsl:element name="loader">
+ <xsl:attribute name="class">
+ <xsl:value-of select="@class"/>
+ </xsl:attribute>
+ <xsl:if test="@fetchPersistentState">
+ <xsl:attribute name="fetchPersistentState">
+ <xsl:value-of select="@fetchPersistentState"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ignoreModifications">
+ <xsl:attribute name="ignoreModifications">
+ <xsl:value-of select="@ignoreModifications"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@purgeOnStartup">
+ <xsl:attribute name="purgeOnStartup">
+ <xsl:value-of select="@purgeOnStartup"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="properties">
+ <xsl:message terminate="no">INFO: Please configure cache loader props manually!</xsl:message>
+ <properties>
+ <property name="...set name here..." value="...set value here..."/>
+ <property name="...set name here..." value="...set value here..."/>
+ </properties>
+ </xsl:if>
+ <xsl:if test="singletonStore">
+ <xsl:element name="singletonStore">
+ <xsl:if test="singletonStore[@enabled]">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="singletonStore/@enabled"/>
+ </xsl:attribute>
+ <xsl:if test="singletonStore/properties">
+ <xsl:message terminate="no">WARNING!!! Singleton store was changed and needs to be
+ configured manually!!!!
+ </xsl:message>
+ </xsl:if>
+ </xsl:if>
+ </xsl:element>
+
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </default>
+
+ <xsl:for-each select="eviction/*">
+ <xsl:element name="namedCache">
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="@name">
+ <xsl:value-of select="@name"/>
+ </xsl:when>
+ <xsl:otherwise>default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:element name="eviction">
+ <xsl:if test="/jbosscache/eviction[@wakeUpInterval]">
+ <xsl:attribute name="wakeUpInterval">
+ <xsl:value-of select="/jbosscache/eviction/@wakeUpInterval"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="property[@name='maxNodes']">
+ <xsl:attribute name="maxEntries">
+ <xsl:value-of select="normalize-space(property[@name='maxNodes']/@value)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@algorithmClass and not(starts-with(@algorithmClass,'org.jboss.cache'))">
+ <xsl:message terminate="no">WARNING!!! Custom eviction 'algorithmClass' is being used.
+ This cannot be automatically transformed. Plese do this manually.
+ </xsl:message>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@algorithmClass">
+ <xsl:attribute name="strategy">
+ <xsl:value-of
+ select="substring-before(substring-after(@algorithmClass,'org.jboss.cache.eviction.'),'Algorithm')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="strategy">
+ <xsl:value-of
+ select="substring-before(substring-after(/jbosscache/eviction/default/@algorithmClass,'org.jboss.cache.eviction.'),'Algorithm')"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:element>
+
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+</xsl:stylesheet>
Copied: trunk/core/src/main/resources/xslt/jgroupsFileGen.xslt (from rev 315, trunk/src/main/resources/xslt/jgroupsFileGen.xslt)
===================================================================
--- trunk/core/src/main/resources/xslt/jgroupsFileGen.xslt (rev 0)
+++ trunk/core/src/main/resources/xslt/jgroupsFileGen.xslt 2009-05-18 03:57:41 UTC (rev 317)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"
+ xmlns="urn:jboss:jbosscache-core:config:3.0"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/jbosscache/clustering/jgroupsConfig">
+ <xsl:element name="config">
+ <xsl:apply-templates mode="copy-no-ns" select="/jbosscache/clustering/jgroupsConfig/*"/>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template mode="copy-no-ns" match="*">
+ <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="copy-no-ns"/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="/jbosscache/loaders"/>
+</xsl:stylesheet>
Deleted: trunk/core/src/test/java/org/infinispan/config/ConfigFilesConvertor.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/ConfigFilesConvertor.java 2009-05-18 03:03:39 UTC (rev 316)
+++ trunk/core/src/test/java/org/infinispan/config/ConfigFilesConvertor.java 2009-05-18 03:57:41 UTC (rev 317)
@@ -1,155 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config;
-
-import org.infinispan.util.FileLookup;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.ByteArrayInputStream;
-
-/**
- * Class used for converting different configuration files to INFINISPAN format.
- *
- * @author Mircea.Markus at jboss.com
- * @since 4.0
- */
-public class ConfigFilesConvertor {
-
- public void parse(InputStream is, OutputStream os, String xsltFile) throws Exception {
- InputStream xsltInStream = new FileLookup().lookupFile(xsltFile);
- if (xsltInStream == null) {
- throw new IllegalStateException("Cold not find xslt file! : " + xsltFile);
- }
-
- Document document = getInputDocument(is);
-
- // Use a Transformer for output
- Transformer transformer = getTransformer(xsltInStream);
-
- DOMSource source = new DOMSource(document);
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- StreamResult result = new StreamResult(byteArrayOutputStream);
- transformer.transform(source, result);
-
- InputStream indentation = new FileLookup().lookupFile("C:\\jboss\\ifspn\\zzzz_trunk_pristine\\src\\main\\resources\\xslt\\indent.xslt");
- // Use a Transformer for output
- transformer = getTransformer(indentation);
- StreamResult finalResult = new StreamResult(os);
- StreamSource rawResult = new StreamSource(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
- transformer.transform(rawResult, finalResult);
- xsltInStream.close();
- }
-
- /**
- * Writes to the <b>os</b> the 3.x configuration file resulted by transforming the 2.x configuration file passed in
- * as <b>inputFile</b>. Transformation is performed according to the <b>xsltFile</b>. Both <b>inputFile</b> and he
- * xslt file are looked up using a {@link org.jboss.cache.util.FileLookup}
- */
- public void parse(String inputFile, OutputStream os, String xsltFile) throws Exception {
- InputStream stream = new FileLookup().lookupFile(inputFile);
- try {
- parse(stream, os, xsltFile);
- }
- finally {
- stream.close();
- }
- }
-
- /**
- * usage : java org.jboss.cache.config.parsing.ConfigFilesConvertor -Dsource=config-2.x.xml
- * -Ddestination=config-3.x.xnl
- */
- public static void main(String[] argv) throws Exception {
- String sourceName = System.getProperty("source");
- if (sourceName == null) {
- System.err.println("Missing property 'source'.");
- System.exit(1);
- }
- String destinationName = System.getProperty("destination");
- if (destinationName == null) {
- System.err.println("Missing property 'destination'.");
- System.exit(1);
- }
- File oldConfig = new File(sourceName);
- if (!oldConfig.exists()) {
- System.err.println("File specified as input ('" + sourceName + ") does not exist.");
- System.exit(1);
- }
- ConfigFilesConvertor convertor = new ConfigFilesConvertor();
- FileInputStream is = new FileInputStream(oldConfig);
- File destination = new File(destinationName);
- if (!destination.exists()) destination.createNewFile();
- FileOutputStream fos = new FileOutputStream(destinationName);
- convertor.parse(is, fos, "C:\\jboss\\ifspn\\zzzz_trunk_pristine\\src\\main\\resources\\xslt\\jbc3x2infinispan4x.xslt");
- fos.close();
- is.close();
-
- String jgroupsConfig = destination.getParent() + File.separator + "jgroupsConfig.xml";
- File jgroupsConfigFile = new File(jgroupsConfig);
- if (jgroupsConfigFile.exists()) jgroupsConfigFile.delete();
- jgroupsConfigFile.createNewFile();
- is = new FileInputStream(oldConfig);
- fos = new FileOutputStream(jgroupsConfigFile);
- convertor = new ConfigFilesConvertor();
- convertor.parse(is, fos, "C:\\jboss\\ifspn\\zzzz_trunk_pristine\\src\\main\\resources\\xslt\\jgroupsFileGen.xslt");
- is.close();
- fos.close();
-
- System.out.println("jgroupsConfigFile.length() = " + jgroupsConfigFile.length());
- //now this means that the generated file is basically empty, so delete ie
- if (jgroupsConfigFile.length() < 5) {
- jgroupsConfigFile.delete();
- }
- System.out.println("---");
- System.out.println("New configuration file [" + destinationName + "] successfully created.");
- System.out.println("---");
- }
-
- private Transformer getTransformer(InputStream xsltInStream) throws TransformerConfigurationException {
- TransformerFactory tFactory = TransformerFactory.newInstance();
- StreamSource stylesource = new StreamSource(xsltInStream);
- return tFactory.newTransformer(stylesource);
- }
-
- private Document getInputDocument(InputStream is) throws ParserConfigurationException, SAXException, IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- return builder.parse(is);
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/resources/xslt/indent.xslt
===================================================================
--- trunk/src/main/resources/xslt/indent.xslt 2009-05-18 03:03:39 UTC (rev 316)
+++ trunk/src/main/resources/xslt/indent.xslt 2009-05-18 03:57:41 UTC (rev 317)
@@ -1,27 +0,0 @@
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml"/>
- <xsl:param name="indent-increment" select="' '" />
-
- <xsl:template match="*">
- <xsl:param name="indent" select="'
'"/>
-
- <xsl:value-of select="$indent"/>
- <xsl:copy>
- <xsl:copy-of select="@*" />
- <xsl:apply-templates>
- <xsl:with-param name="indent"
- select="concat($indent, $indent-increment)"/>
- </xsl:apply-templates>
- <xsl:if test="*">
- <xsl:value-of select="$indent"/>
- </xsl:if>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="comment()|processing-instruction()">
- <xsl:copy />
- </xsl:template>
- <xsl:template match="text()[normalize-space(.)='']"/>
-
-</xsl:stylesheet>
\ No newline at end of file
Deleted: trunk/src/main/resources/xslt/jbc3x2infinispan4x.xslt
===================================================================
--- trunk/src/main/resources/xslt/jbc3x2infinispan4x.xslt 2009-05-18 03:03:39 UTC (rev 316)
+++ trunk/src/main/resources/xslt/jbc3x2infinispan4x.xslt 2009-05-18 03:57:41 UTC (rev 317)
@@ -1,368 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
-
- <xsl:template match="/jbosscache">
-
- <xsl:element name="infinispan">
- <xsl:element name="global">
- <xsl:element name="asyncListenerExecutor">
- <xsl:attribute name="factory">org.infinispan.executors.DefaultExecutorFactory</xsl:attribute>
- <xsl:if test="listeners[@asyncPoolSize]">
- <xsl:element name="property">
- <xsl:attribute name="name">maxThreads</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="normalize-space(listeners/@asyncPoolSize)"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <xsl:if test="listeners[@asyncQueueSize]">
- <xsl:element name="property">
- <xsl:attribute name="name">queueSize</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="listeners/@asyncQueueSize"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <property name="threadNamePrefix" value="AsyncListenerThread"/>
- </xsl:element>
-
- <xsl:element name="asyncTransportExecutor">
- <xsl:attribute name="factory">org.infinispan.executors.DefaultExecutorFactory</xsl:attribute>
- <xsl:if test="clustering/async[@serializationExecutorPoolSize]">
- <xsl:element name="property">
- <xsl:attribute name="name">maxThreads</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="clustering/async/@serializationExecutorPoolSize"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <xsl:if test="clustering/async[@serializationExecutorQueueSize]">
- <xsl:element name="property">
- <xsl:attribute name="name">queueSize</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="clustering/async/@serializationExecutorQueueSize"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <property name="threadNamePrefix" value="AsyncSerializationThread"/>
- </xsl:element>
-
- <evictionScheduledExecutor factory="org.infinispan.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix" value="EvictionThread"/>
- </evictionScheduledExecutor>
-
- <replicationQueueScheduledExecutor factory="org.infinispan.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix" value="ReplicationQueueThread"/>
- </replicationQueueScheduledExecutor>
-
- <xsl:element name="globalJmxStatistics">
- <xsl:attribute name="jmxDomain">infinispan</xsl:attribute>
- <xsl:if test="jmxStatistics[@enabled]">
- <xsl:attribute name="enabled">
- <xsl:value-of select="jmxStatistics/@enabled"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
-
- <xsl:element name="transport">
- <xsl:attribute name="transportClass">org.infinispan.remoting.transport.jgroups.JGroupsTransport</xsl:attribute>
- <xsl:if test="clustering[@clusterName]">
- <xsl:attribute name="clusterName">
- <xsl:value-of select="clustering/@clusterName"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/sync[@replTimeout]"> <!-- this defaults to 6000 -->
- <xsl:attribute name="distributedSyncTimeout">
- <xsl:value-of select="clustering/sync/@replTimeout"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/jgroupsConfig[@configFile]">
- <xsl:element name="property">
- <xsl:attribute name="name">configurationFile</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="clustering/jgroupsConfig/@configFile"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- <xsl:if test="clustering/jgroupsConfig/*">
- <xsl:element name="property">
- <xsl:attribute name="name">configurationFile</xsl:attribute>
- <xsl:attribute name="value">jgroupsConfig.xml</xsl:attribute>
- </xsl:element>
- </xsl:if>
-
- </xsl:element>
-
-
- <xsl:element name="serialization">
- <xsl:attribute name="marshallerClass">org.infinispan.marshall.VersionAwareMarshaller</xsl:attribute>
- <xsl:attribute name="version">1.0</xsl:attribute>
- <xsl:if test="serialization[@objectInputStreamPoolSize]">
- <xsl:attribute name="objectInputStreamPoolSize">
- <xsl:value-of select="serialization/@objectInputStreamPoolSize"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="serialization[@objectOutputStreamPoolSize]">
- <xsl:attribute name="objectOutputStreamPoolSize">
- <xsl:value-of select="serialization/@objectOutputStreamPoolSize"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
-
- <xsl:if test="shutdown[@hookBehavior]">
- <xsl:element name="shutdown">
- <xsl:attribute name="hookBehavior">
- <xsl:value-of select="shutdown/@hookBehavior"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- </xsl:element>
-
- <default>
-
- <xsl:if test="locking">
- <xsl:element name="locking">
- <xsl:if test="locking[@isolationLevel]">
- <xsl:attribute name="isolationLevel">
- <xsl:value-of select="locking/@isolationLevel"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="locking[@lockAcquisitionTimeout]">
- <xsl:attribute name="lockAcquisitionTimeout">
- <xsl:value-of select="locking/@lockAcquisitionTimeout"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="locking[@writeSkewCheck]">
- <xsl:attribute name="writeSkewCheck">
- <xsl:value-of select="locking/@writeSkewCheck"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="locking[@concurrencyLevel]">
- <xsl:attribute name="concurrencyLevel">
- <xsl:value-of select="locking/@concurrencyLevel"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
-
-
- <xsl:if test="transaction">
- <xsl:element name="transaction">
- <xsl:if test="transaction[@transactionManagerLookupClass]">
- <xsl:if
- test="not(starts-with(transaction/@transactionManagerLookupClass,'org.jboss.cache'))">
- <xsl:message terminate="no">WARNING!!! Custom 'transactionManagerLookupClass' is being used.
- This cannot
- be automatically transformed.
- </xsl:message>
- </xsl:if>
- <xsl:attribute name="transactionManagerLookupClass">
- <xsl:value-of
- select="concat('org.infinispan.transaction.lookup', substring-after(transaction/@transactionManagerLookupClass,'org.jboss.cache.transaction'))"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="transaction[@syncRollbackPhase]">
- <xsl:attribute name="syncRollbackPhase">
- <xsl:value-of select="transaction/@syncRollbackPhase"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="transaction[@syncCommitPhase]">
- <xsl:attribute name="syncCommitPhase">
- <xsl:value-of select="transaction/@syncCommitPhase"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
-
- <xsl:if test="jmxStatistics[@enabled]">
- <xsl:element name="jmxStatistics">
- <xsl:attribute name="enabled">
- <xsl:value-of select="jmxStatistics/@enabled"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
-
- <xsl:if test="serialization[@useLazyDeserialization]">
- <xsl:element name="lazyDeserialization">
- <xsl:attribute name="enabled">
- <xsl:value-of select="serialization/@useLazyDeserialization"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
-
- <xsl:if test="invocationBatching[@enabled]">
- <xsl:element name="invocationBatching">
- <xsl:attribute name="enabled">
- <xsl:value-of select="invocationBatching/@enabled"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
-
- <xsl:if test="clustering">
- <xsl:element name="clustering">
- <xsl:if test="clustering[@mode]">
- <xsl:attribute name="mode">
- <xsl:value-of select="clustering/@mode"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/stateRetrieval">
- <xsl:element name="stateRetrieval">
- <xsl:if test="clustering/stateRetrieval[@timeout]">
- <xsl:attribute name="timeout">
- <xsl:value-of select="clustering/stateRetrieval/@timeout"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/stateRetrieval[@fetchInMemoryState]">
- <xsl:attribute name="fetchInMemoryState">
- <xsl:value-of select="clustering/stateRetrieval/@fetchInMemoryState"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
- <xsl:if test="clustering/sync">
- <xsl:element name="sync">
- <xsl:if test="clustering/sync[@replTimeout]">
- <xsl:attribute name="replTimeout">
- <xsl:value-of select="clustering/sync/@replTimeout"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
- <xsl:element name="async">
- <xsl:if test="clustering/async[@useReplQueue]">
- <xsl:attribute name="useReplQueue">
- <xsl:value-of select="clustering/async/@useReplQueue"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/async[@replQueueInterval]">
- <xsl:attribute name="replQueueInterval">
- <xsl:value-of select="clustering/async/@replQueueInterval"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/async[@replQueueMaxElements]">
- <xsl:attribute name="replQueueMaxElements">
- <xsl:value-of select="clustering/async/@replQueueMaxElements"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="clustering/async[@serializationExecutorPoolSize > 1]">
- <xsl:attribute name="asyncMarshalling">true</xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:element>
- </xsl:if>
-
- <xsl:if test="loaders">
- <xsl:element name="loaders">
- <xsl:if test="loaders[@passivation]">
- <xsl:attribute name="passivation">
- <xsl:value-of select="loaders/@passivation"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="loaders[@shared]">
- <xsl:attribute name="shared">
- <xsl:value-of select="loaders/@shared"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="loaders/preload">
- <xsl:message terminate="no">WARNING!!! Preload elements cannot be automatically transformed, please
- do it manually!
- </xsl:message>
- </xsl:if>
- <xsl:for-each select="loaders/loader">
- <xsl:element name="loader">
- <xsl:attribute name="class">
- <xsl:value-of select="@class"/>
- </xsl:attribute>
- <xsl:if test="@fetchPersistentState">
- <xsl:attribute name="fetchPersistentState">
- <xsl:value-of select="@fetchPersistentState"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@ignoreModifications">
- <xsl:attribute name="ignoreModifications">
- <xsl:value-of select="@ignoreModifications"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@purgeOnStartup">
- <xsl:attribute name="purgeOnStartup">
- <xsl:value-of select="@purgeOnStartup"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="properties">
- <xsl:message terminate="no">INFO: Please configure cache loader props manually!</xsl:message>
- <properties>
- <property name="...set name here..." value="...set value here..."/>
- <property name="...set name here..." value="...set value here..."/>
- </properties>
- </xsl:if>
- <xsl:if test="singletonStore">
- <xsl:element name="singletonStore">
- <xsl:if test="singletonStore[@enabled]">
- <xsl:attribute name="enabled">
- <xsl:value-of select="singletonStore/@enabled"/>
- </xsl:attribute>
- <xsl:if test="singletonStore/properties">
- <xsl:message terminate="no">WARNING!!! Singleton store was changed and needs to be
- configured manually!!!!
- </xsl:message>
- </xsl:if>
- </xsl:if>
- </xsl:element>
-
- </xsl:if>
- </xsl:element>
- </xsl:for-each>
- </xsl:element>
- </xsl:if>
- </default>
-
- <xsl:for-each select="eviction/*">
- <xsl:element name="namedCache">
- <xsl:attribute name="name">
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>default</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:element name="eviction">
- <xsl:if test="/jbosscache/eviction[@wakeUpInterval]">
- <xsl:attribute name="wakeUpInterval">
- <xsl:value-of select="/jbosscache/eviction/@wakeUpInterval"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="property[@name='maxNodes']">
- <xsl:attribute name="maxEntries">
- <xsl:value-of select="normalize-space(property[@name='maxNodes']/@value)"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@algorithmClass and not(starts-with(@algorithmClass,'org.jboss.cache'))">
- <xsl:message terminate="no">WARNING!!! Custom eviction 'algorithmClass' is being used.
- This cannot be automatically transformed. Plese do this manually.
- </xsl:message>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="@algorithmClass">
- <xsl:attribute name="strategy">
- <xsl:value-of
- select="substring-before(substring-after(@algorithmClass,'org.jboss.cache.eviction.'),'Algorithm')"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="strategy">
- <xsl:value-of
- select="substring-before(substring-after(/jbosscache/eviction/default/@algorithmClass,'org.jboss.cache.eviction.'),'Algorithm')"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:element>
-
- </xsl:element>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
-</xsl:stylesheet>
Deleted: trunk/src/main/resources/xslt/jgroupsFileGen.xslt
===================================================================
--- trunk/src/main/resources/xslt/jgroupsFileGen.xslt 2009-05-18 03:03:39 UTC (rev 316)
+++ trunk/src/main/resources/xslt/jgroupsFileGen.xslt 2009-05-18 03:57:41 UTC (rev 317)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"
- xmlns="urn:jboss:jbosscache-core:config:3.0"/>
-
- <xsl:strip-space elements="*"/>
-
- <xsl:template match="/jbosscache/clustering/jgroupsConfig">
- <xsl:element name="config">
- <xsl:apply-templates mode="copy-no-ns" select="/jbosscache/clustering/jgroupsConfig/*"/>
- </xsl:element>
-
- </xsl:template>
-
- <xsl:template mode="copy-no-ns" match="*">
- <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="copy-no-ns"/>
- </xsl:element>
- </xsl:template>
-
-
- <xsl:template match="/jbosscache/loaders"/>
-</xsl:stylesheet>
More information about the infinispan-commits
mailing list