public class XStreamMarshaller extends XStreamMarshaller
AdaptrisMarshaller
that supports variable substitutions when unmarshalling.
If the variable-properties-url
is configured as file:///.//path/to/my/variables.properties
and that contains
broker.url=tcp://localhost:2506
broker.backup.url=tcp://my.host:2507
Then all instances of${broker.url}
and ${broker.backup.url}
will be replaced as the input is read in,
but before the unmarshalling occurs.
In the adapter configuration file this class is aliased as xstream-varsub-marshaller which is the preferred alternative to the fully qualified classname when building your configuration.
AbstractMarshaller.Deserializer, AbstractMarshaller.Serializer
AdaptrisMarshaller.MarshalInputStream, AdaptrisMarshaller.MarshalOutputStream
instance
Constructor and Description |
---|
XStreamMarshaller() |
Modifier and Type | Method and Description |
---|---|
void |
addVariablePropertiesUrls(java.lang.String url) |
VariableSubstitutionType |
getSubstitutionType() |
java.lang.Boolean |
getUseHostname() |
java.lang.String |
getVariablePostfix() |
java.lang.String |
getVariablePrefix() |
java.util.List<java.lang.String> |
getVariablePropertiesUrls() |
void |
setSubstitutionType(VariableSubstitutionType type)
Set the Substitution Type.
|
void |
setUseHostname(java.lang.Boolean b)
Whether or not to attempt to format the URL with the hostname.
|
void |
setVariablePostfix(java.lang.String suffix)
Set the variable prefix.
|
void |
setVariablePrefix(java.lang.String prefix)
Set the variable prefix.
|
void |
setVariablePropertiesUrls(java.util.List<java.lang.String> list)
Specify the file where the substitution properties are held.
|
java.lang.Object |
unmarshal(java.io.File file) |
java.lang.Object |
unmarshal(java.io.InputStream in) |
java.lang.Object |
unmarshal(java.io.Reader in) |
java.lang.Object |
unmarshal(java.lang.String input) |
java.lang.Object |
unmarshal(java.net.URL url) |
java.lang.Object |
unmarshal(URLString url) |
XStreamMarshaller |
withUseHostname(java.lang.Boolean b) |
getInstance
marshal, marshal
connectToUrl, invokeDeserialize, invokeSerialize, marshal, marshal, marshal, marshal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
uncheckedMarshal, uncheckedUnmarshal
public XStreamMarshaller() throws CoreException
CoreException
public java.lang.Object unmarshal(java.io.Reader in) throws CoreException
unmarshal
in interface AdaptrisMarshaller
unmarshal
in class XStreamMarshallerImpl
CoreException
public java.lang.Object unmarshal(java.lang.String input) throws CoreException
unmarshal
in interface AdaptrisMarshaller
unmarshal
in class AbstractMarshaller
CoreException
public java.lang.Object unmarshal(java.io.File file) throws CoreException
unmarshal
in interface AdaptrisMarshaller
unmarshal
in class AbstractMarshaller
CoreException
public java.lang.Object unmarshal(java.net.URL url) throws CoreException
unmarshal
in interface AdaptrisMarshaller
unmarshal
in class AbstractMarshaller
CoreException
public java.lang.Object unmarshal(URLString url) throws CoreException
unmarshal
in interface AdaptrisMarshaller
unmarshal
in class AbstractMarshaller
CoreException
public java.lang.Object unmarshal(java.io.InputStream in) throws CoreException
unmarshal
in interface AdaptrisMarshaller
unmarshal
in class AbstractMarshaller
CoreException
public java.util.List<java.lang.String> getVariablePropertiesUrls()
public void setVariablePropertiesUrls(java.util.List<java.lang.String> list)
list
- the urls (so it could be remote).public void addVariablePropertiesUrls(java.lang.String url)
public java.lang.String getVariablePrefix()
public void setVariablePrefix(java.lang.String prefix)
prefix
- the prefix, defaults to "${"public java.lang.String getVariablePostfix()
public void setVariablePostfix(java.lang.String suffix)
suffix
- the suffix, defaults to "}"public VariableSubstitutionType getSubstitutionType()
public void setSubstitutionType(VariableSubstitutionType type)
type
- the type, if not specified then VariableSubstitutionType.SIMPLE
.public java.lang.Boolean getUseHostname()
public void setUseHostname(java.lang.Boolean b)
b
- Constants.VARSUB_PROPERTIES_USE_HOSTNAME
public XStreamMarshaller withUseHostname(java.lang.Boolean b)