org.mule.extras.groovy.transformers
Class GroovyTransformer

java.lang.Object
  extended byorg.mule.transformers.AbstractTransformer
      extended byorg.mule.extras.groovy.transformers.GroovyTransformer
All Implemented Interfaces:
java.lang.Cloneable, Initialisable, java.io.Serializable, UMOSimpleTransformer, UMOTransformer

public class GroovyTransformer
extends AbstractTransformer

GroovyTransformer a classloader for groovy scripts. The loader uses the logical name of the transformer as defined in the mule configuration to locate a corresponding script in a scripts directory i.e. if the Transformer name is foo then the classloader will attempt to load foo.groovy from the scripts directory. Thus it is possible to have multiple transformer instances of the class GroovyTransformer each with a unique name, indicating the appropriate script The groovy script (class) must have a transform method returning the appropriate type after it has transformed the supplied source

Version:
$Revision: 1.3 $
Author:
Ian de Beer, Ross Mason
See Also:
Serialized Form

Field Summary
protected  Log logger
           
 
Fields inherited from class org.mule.transformers.AbstractTransformer
endpoint, name, returnClass, TRANSFORMER_DEFAULT
 
Fields inherited from interface org.mule.umo.transformer.UMOSimpleTransformer
SERVICE_ID
 
Constructor Summary
GroovyTransformer()
           
 
Method Summary
 java.lang.Object clone()
           
 java.lang.Object doTransform(java.lang.Object src)
           
 java.lang.String getMethodName()
           
 java.lang.String getScript()
           
 void initialise()
          Template method were deriving classes can do any initialisation after the properties have been set on this transformer
protected  void setGroovyTransformer(GroovyObject trans)
           
 void setMethodName(java.lang.String methodName)
           
 void setScript(java.lang.String script)
           
protected  void setScriptLocation(java.net.URL scriptLocation)
           
 
Methods inherited from class org.mule.transformers.AbstractTransformer
checkReturnClass, generateTransformerName, getEndpoint, getFinalReturnClass, getName, getReturnClass, getSourceTypeClassesIterator, getTransformer, isSourceTypeSupported, registerSourceType, setEndpoint, setName, setReturnClass, setSourceType, setTransformer, toString, transform, unregisterSourceType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Constructor Detail

GroovyTransformer

public GroovyTransformer()
Method Detail

doTransform

public java.lang.Object doTransform(java.lang.Object src)
                             throws TransformerException
Specified by:
doTransform in class AbstractTransformer
Throws:
TransformerException

initialise

public void initialise()
                throws InitialisationException
Description copied from class: AbstractTransformer
Template method were deriving classes can do any initialisation after the properties have been set on this transformer

Specified by:
initialise in interface Initialisable
Overrides:
initialise in class AbstractTransformer
Throws:
InitialisationException

setScript

public void setScript(java.lang.String script)

getScript

public java.lang.String getScript()

setScriptLocation

protected void setScriptLocation(java.net.URL scriptLocation)

setGroovyTransformer

protected void setGroovyTransformer(GroovyObject trans)

getMethodName

public java.lang.String getMethodName()

setMethodName

public void setMethodName(java.lang.String methodName)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface UMOSimpleTransformer
Overrides:
clone in class AbstractTransformer
Throws:
java.lang.CloneNotSupportedException


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.