@ComponentProfile(summary="Validate an XML document against a schema", recommended=CacheConnection.class) @Deprecated @ConfigDeprecated(removalVersion="4.0.0", message="Use basic-xml-schema-validator or extended-xml-schema-validator instead", groups=java.lang.Deprecated.class) public class XmlSchemaValidator extends MessageValidatorImpl
XmlValidationService
to validate an XML message against a schema.
This validates an input XML document against a schema. After first use, it caches the schema for re-use against the URL that was resolved as an expression or from static configuration. This means that until first use, no attempt is made to access the schema URL.
In the adapter configuration file this class is aliased as xml-schema-validator which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
XmlSchemaValidator()
Deprecated.
|
XmlSchemaValidator(java.lang.String schema)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Closes the component.
|
java.lang.String |
getSchema()
Deprecated.
Returns the schema to validate against.
|
AdaptrisConnection |
getSchemaCache()
Deprecated.
|
void |
init()
Deprecated.
Initialises the component.
|
void |
prepare()
Deprecated.
Prepare for initialisation.
|
void |
setSchema(java.lang.String s)
Deprecated.
Sets the schema to validate against.
|
void |
setSchemaCache(AdaptrisConnection cache)
Deprecated.
Configure the internal cache for schemas.
|
void |
start()
Deprecated.
Starts the component.
|
void |
stop()
Deprecated.
Stop the component
|
void |
validate(AdaptrisMessage msg)
Deprecated.
|
XmlSchemaValidator |
withSchemaCache(AdaptrisConnection c)
Deprecated.
|
public XmlSchemaValidator()
public XmlSchemaValidator(java.lang.String schema)
public void validate(AdaptrisMessage msg) throws CoreException
CoreException
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
prepare
in class MessageValidatorImpl
CoreException
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public void setSchema(java.lang.String s)
s
- the schema to validate against, normally a URL.public java.lang.String getSchema()
public AdaptrisConnection getSchemaCache()
public void setSchemaCache(AdaptrisConnection cache)
While it is possible to configure a distributed cache (a-la ehcache or JSR107) the Schema
object
isn't serializable, so you may run into issues. It will be best to stick with ExpiringMapCache
if you want to enable
caching. The default behaviour is to cache 16 schemas for a max of 2 hours (last-access) if you don't explicitly configure it
differently.
cache
- the cache, generally a CacheConnection
or SharedConnection
.public XmlSchemaValidator withSchemaCache(AdaptrisConnection c)