public abstract class XmlSchemaValidatorImpl extends MessageValidatorImpl
log
Constructor and Description |
---|
XmlSchemaValidatorImpl() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
java.lang.String |
getSchema()
Returns the schema to validate against.
|
AdaptrisConnection |
getSchemaCache() |
void |
init()
Initialises the component.
|
void |
prepare()
Prepare for initialisation.
|
protected javax.xml.validation.Schema |
resolveFromCache(java.lang.String urlString) |
protected javax.xml.validation.Schema |
resolveSchema(AdaptrisMessage msg) |
void |
setSchema(java.lang.String s)
Sets the schema to validate against.
|
void |
setSchemaCache(AdaptrisConnection cache)
Configure the internal cache for schemas.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
<T extends XmlSchemaValidatorImpl> |
withSchema(java.lang.String c) |
<T extends XmlSchemaValidatorImpl> |
withSchemaCache(AdaptrisConnection c) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validate
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
protected javax.xml.validation.Schema resolveSchema(AdaptrisMessage msg) throws java.lang.Exception
java.lang.Exception
protected javax.xml.validation.Schema resolveFromCache(java.lang.String urlString) throws java.lang.Exception
java.lang.Exception
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 <T extends XmlSchemaValidatorImpl> T withSchemaCache(AdaptrisConnection c)
public <T extends XmlSchemaValidatorImpl> T withSchema(java.lang.String c)