@ComponentProfile(summary="Transform from Flat-File to XML", tag="service,transform,xml") public class FlatfileTransformService extends ServiceImp
Flat file transformation service.
In the adapter configuration file this class is aliased as flat-file-transform-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
FlatfileTransformService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
protected TransformFramework |
createFramework()
Create the appropriate transform framework.
|
void |
doService(AdaptrisMessage msg)
Transforms the message.
|
java.lang.Boolean |
getAllowOverride()
Returns the flag specifying whether or not an 'over-ride' transform may be
specified in message metadata.
|
java.lang.Boolean |
getCacheTransforms()
Return the flag indicating whether transforms should be cached or not.
|
java.lang.String |
getMetadataKey()
Returns the metadata key that will be used to store the over-ride transform
URL.
|
java.lang.String |
getOutputMessageEncoding() |
java.lang.String |
getUrl()
Returns the URL of the transformation style sheet.
|
protected void |
initService() |
void |
prepare() |
void |
setAllowOverride(java.lang.Boolean b)
Sets the flag specifying whether or not an 'over-ride' transform may be
specified in message metadata.
|
void |
setCacheTransforms(java.lang.Boolean b)
Sets the flag indicating whether transforms should be cached or not.
|
void |
setMetadataKey(java.lang.String s)
Sets the metadata key that will be used to store the over-ride transform
URL.
|
void |
setOutputMessageEncoding(java.lang.String s)
Force the output message encoding to be a particular encoding.
|
void |
setUrl(java.lang.String s)
Sets the URL of the transformation style sheet.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public FlatfileTransformService()
Creates a new instance. Defaults to caching transforms and disallowing metadata-based over-riding of the transform to apply.
protected final void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected final void closeService()
closeService
in class ServiceImp
public final void doService(AdaptrisMessage msg) throws ServiceException
Transforms the message. If getAllowOverride
is true and
a transform is specified in message metdata, this over-ride transform will
be applied instead of any configured transform. If no transform is
explicitly configured and no over-ride transform is specified in metadata,
a ServiceException
is thrown.
ServiceException
Service.doService(AdaptrisMessage)
public void prepare() throws CoreException
CoreException
public void setUrl(java.lang.String s)
Sets the URL of the transformation style sheet.
s
- the URL of the transformation style sheetpublic java.lang.String getUrl()
Returns the URL of the transformation style sheet.
public java.lang.Boolean getCacheTransforms()
Return the flag indicating whether transforms should be cached or not.
public void setCacheTransforms(java.lang.Boolean b)
Sets the flag indicating whether transforms should be cached or not.
By default, transforms are cached for the purposes of optimisation. However, in the event that you wish to constantly change transforms, this flag can be set false to disable this feature.
b
- the flag indicating whether transforms should be cached or notpublic void setAllowOverride(java.lang.Boolean b)
Sets the flag specifying whether or not an 'over-ride' transform may be specified in message metadata.
By default, it is not possible to override the given transform with one
specified via metadata, if this behaviour is desired, then this flag should
be set true. If not transform is configured using setUrl
, this
flag is set to true in init
.
b
- the flag specifying whether or not an 'over-ride' transform may be
specified in message metadatapublic java.lang.Boolean getAllowOverride()
Returns the flag specifying whether or not an 'over-ride' transform may be specified in message metadata.
public void setMetadataKey(java.lang.String s)
Sets the metadata key that will be used to store the over-ride transform
URL. This URL will only be used if allowOverride
is set to
true.
s
- the metadata key that will be used to store the over-ride
transform URLpublic java.lang.String getMetadataKey()
Returns the metadata key that will be used to store the over-ride transform URL.
public java.lang.String getOutputMessageEncoding()
public void setOutputMessageEncoding(java.lang.String s)
If specified then the underlying AdaptrisMessage.setCharEncoding(String)
is changed to match the encoding specified
here before attempting any write operations.
This is only useful if the underlying message is encoded in one way, and you wish to force the encoding directly in your ff
transformation definition; e.g. the input message is physically encoded using ISO-8859-1; but your xslt has <
s
- protected TransformFramework createFramework() throws java.lang.Exception
Create the appropriate transform framework.
java.lang.Exception
- on error.