xmlBlaster 2.1.0 API

org.xmlBlaster.contrib
Class VersionTransformerCache

java.lang.Object
  extended by org.xmlBlaster.contrib.VersionTransformerCache

public class VersionTransformerCache
extends java.lang.Object

Holds Transformers cached.

Author:
Michele Laghi

Field Summary
private  java.util.Set checkedTransformers
           
private static java.util.logging.Logger log
           
private  java.util.Map transformers
           
 
Constructor Summary
VersionTransformerCache()
           
 
Method Summary
static java.lang.String buildFilename(java.lang.String replicationPrefix, java.lang.String version)
           
 void clearCache()
           
 java.io.InputStream doXSLTransformation(java.lang.String filename, java.io.InputStream in, java.lang.ClassLoader cl)
           
private  byte[] doXSLTransformation(java.lang.String filename, java.lang.String secondChoice, java.lang.String thirdChoice, byte[] in, java.lang.ClassLoader cl)
           
static java.lang.String getStrippedString(java.lang.String text)
          Taken from the Global.
private  javax.xml.transform.Transformer getTransformerAlsoFromCache(java.lang.String filename, java.lang.String secondChoice, java.lang.String thirdChoice, java.lang.ClassLoader cl)
           
private static java.lang.String getXslStringFromFile(java.lang.String filenamePrefix, java.lang.ClassLoader extraCl)
          Note that this method searches for the stripped name in the classpath.
private static javax.xml.transform.Transformer newTransformer(java.lang.String filename, java.lang.ClassLoader cl)
           
private static javax.xml.transform.Transformer newTransformer(java.lang.String systemId, java.lang.String xslString, javax.xml.transform.URIResolver uriResolver, java.util.Map params)
           
static java.lang.String stripReplicationPrefix(java.lang.String replicationPrefix)
          Returns the prefix of the complete name.
static java.lang.String stripReplicationVersion(java.lang.String replicationPrefix)
          Can return null if no version token (_Ver_) was found.
 byte[] transform(java.lang.String replPrefix, java.lang.String srcVersion, java.lang.String destVersion, java.lang.String destination, byte[] srcData, java.lang.ClassLoader cl)
          Performs an xslt transformation according to the parameters passed and the stylesheet associated to the combination of such parameters.
 void verifyTransformerName(java.lang.String xslFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

transformers

private java.util.Map transformers

checkedTransformers

private java.util.Set checkedTransformers
Constructor Detail

VersionTransformerCache

public VersionTransformerCache()
Method Detail

verifyTransformerName

public void verifyTransformerName(java.lang.String xslFile)

getTransformerAlsoFromCache

private javax.xml.transform.Transformer getTransformerAlsoFromCache(java.lang.String filename,
                                                                    java.lang.String secondChoice,
                                                                    java.lang.String thirdChoice,
                                                                    java.lang.ClassLoader cl)
Parameters:
filename -
Returns:

getXslStringFromFile

private static java.lang.String getXslStringFromFile(java.lang.String filenamePrefix,
                                                     java.lang.ClassLoader extraCl)
                                              throws java.lang.Exception
Note that this method searches for the stripped name in the classpath.

Parameters:
filenamePrefix -
Returns:
Throws:
java.lang.Exception

newTransformer

private static javax.xml.transform.Transformer newTransformer(java.lang.String systemId,
                                                              java.lang.String xslString,
                                                              javax.xml.transform.URIResolver uriResolver,
                                                              java.util.Map params)
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

newTransformer

private static javax.xml.transform.Transformer newTransformer(java.lang.String filename,
                                                              java.lang.ClassLoader cl)
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

doXSLTransformation

private byte[] doXSLTransformation(java.lang.String filename,
                                   java.lang.String secondChoice,
                                   java.lang.String thirdChoice,
                                   byte[] in,
                                   java.lang.ClassLoader cl)
                            throws java.lang.Exception
Throws:
java.lang.Exception

doXSLTransformation

public java.io.InputStream doXSLTransformation(java.lang.String filename,
                                               java.io.InputStream in,
                                               java.lang.ClassLoader cl)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

clearCache

public void clearCache()

getStrippedString

public static final java.lang.String getStrippedString(java.lang.String text)
Taken from the Global.

Parameters:
text -
Returns:

transform

public byte[] transform(java.lang.String replPrefix,
                        java.lang.String srcVersion,
                        java.lang.String destVersion,
                        java.lang.String destination,
                        byte[] srcData,
                        java.lang.ClassLoader cl)
                 throws java.lang.Exception
Performs an xslt transformation according to the parameters passed and the stylesheet associated to the combination of such parameters.

Parameters:
replPrefix - The replication prefix used.
srcVersion - The version is actual on the source
destVersion - The version which is wanted on the destination.
destination - The Session name of the destination (can also be a subject name)
srcData - The source string to be transformed.
cl - can be null. Used to find the xsl resources (this is an additional class loader to use)
Returns:
Throws:
java.lang.Exception

stripReplicationPrefix

public static java.lang.String stripReplicationPrefix(java.lang.String replicationPrefix)
Returns the prefix of the complete name. It only returns null if the input string was null.

Parameters:
replicationPrefix -
Returns:

stripReplicationVersion

public static java.lang.String stripReplicationVersion(java.lang.String replicationPrefix)
Can return null if no version token (_Ver_) was found.

Parameters:
replicationPrefix -
Returns:

buildFilename

public static java.lang.String buildFilename(java.lang.String replicationPrefix,
                                             java.lang.String version)

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.