public class MetadataFileNameCreator extends java.lang.Object implements FileNameCreator
Implementation of FileNameCreator
which obtains the file name
to use from message metadata.
In the adapter configuration file this class is aliased as metadata-file-name-creator which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
MetadataFileNameCreator()
Creates a new instance.
|
MetadataFileNameCreator(java.lang.String metadataKey) |
MetadataFileNameCreator(java.lang.String metadataKey,
java.lang.String defaultName) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
createName(AdaptrisMessage msg)
Obtains the value for the configured metadata key, if this is not null or
empty it is returned.
|
java.lang.String |
getDefaultName()
Sets the 'default name' which will be used if the metadata value is null
or empty.
|
java.lang.String |
getMetadataKey()
Returns the metadata key to look up.
|
void |
setDefaultName(java.lang.String s)
Returns the 'default name' which will be used if the metadata value is null
or empty.
|
void |
setMetadataKey(java.lang.String s)
Sets the metadata key to look up.
|
public MetadataFileNameCreator()
Creates a new instance. Default name is "MetadataFileNameCreator_default".
public MetadataFileNameCreator(java.lang.String metadataKey)
public MetadataFileNameCreator(java.lang.String metadataKey, java.lang.String defaultName)
public java.lang.String createName(AdaptrisMessage msg) throws CoreException
Obtains the value for the configured metadata key, if this is not null or empty it is returned. If the metadata value is null or empty then the configured 'default name' is returned.
createName
in interface FileNameCreator
msg
- the AdaptrisMessage
to create a file name forCoreException
- wrapping any Exception
that may occur#createName(com.adaptris.core.AdaptrisMessage)
public java.lang.String getMetadataKey()
Returns the metadata key to look up.
public void setMetadataKey(java.lang.String s)
Sets the metadata key to look up. May not be null or empty.
s
- the metadata key to look uppublic java.lang.String getDefaultName()
Sets the 'default name' which will be used if the metadata value is null or empty.
public void setDefaultName(java.lang.String s)
Returns the 'default name' which will be used if the metadata value is null or empty.
s
- the 'default name' which will be used if the metadata value is
null or empty