@Category(value="Basic") public class XmlValidator extends ValidatorBase implements SchemasProvider, HasSpecialDefaultValues, IXmlValidator, org.springframework.beans.factory.InitializingBean
Modifier and Type | Class and Description |
---|---|
static class |
XmlValidator.ResponseValidatorWrapper |
Modifier and Type | Field and Description |
---|---|
protected ConfigurationException |
configurationException |
protected AbstractXmlValidator |
validator |
parameterNamesMustBeUnique
log
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT
Constructor and Description |
---|
XmlValidator() |
Modifier and Type | Method and Description |
---|---|
protected void |
addInvalidRootNamespaces(List<String> path,
List<String> invalidRootNamespaces) |
protected void |
addRequestRootValidation(RootValidation path) |
protected void |
addResponseRootValidation(RootValidation path) |
void |
afterPropertiesSet() |
protected void |
checkSchemaSpecified() |
void |
configure()
Configure the XmlValidator
|
protected RootValidations |
createRootValidation(String messageRoot) |
protected PipeForward |
determineForward(AbstractXmlValidator.ValidationResult validationResult,
PipeLineSession session,
boolean responseMode) |
PipeRunResult |
doPipe(Message input,
PipeLineSession session,
boolean responseMode,
String messageRoot) |
String |
getCharset() |
ConfigurationException |
getConfigurationException() |
String |
getDocumentation()
Provide additional generic documentation on the validation of the
subsequent processing.
|
protected PipeRunResult |
getErrorResult(AbstractXmlValidator.ValidationResult result,
String reason,
PipeLineSession session,
boolean responseMode) |
Boolean |
getIgnoreUnknownNamespaces() |
Map<List<String>,List<String>> |
getInvalidRootNamespaces() |
String |
getMessageRoot() |
String |
getMessageRoot(boolean responseMode) |
String |
getReasonSessionKey() |
protected RootValidations |
getRequestRootValidations() |
protected RootValidations |
getResponseRootValidations() |
IValidator |
getResponseValidator() |
RootValidations |
getRootValidations(boolean responseMode) |
String |
getSchema() |
List<Schema> |
getSchemas() |
List<Schema> |
getSchemas(boolean checkRootValidations) |
List<Schema> |
getSchemas(PipeLineSession session) |
String |
getSchemasId() |
String |
getSchemasId(PipeLineSession session) |
String |
getSoapNamespace()
Deprecated.
|
Object |
getSpecialDefaultValue(String attributeName,
Object defaultValue,
Map<String,String> attributes) |
String |
getXmlReasonSessionKey() |
Set<IXSD> |
getXsds() |
List<org.apache.xerces.xs.XSModel> |
getXSModels() |
protected boolean |
isConfiguredForMixedValidation() |
boolean |
isFullSchemaChecking() |
boolean |
isThrowException() |
boolean |
isValidateFile() |
void |
setAddNamespaceToSchema(boolean addNamespaceToSchema)
If set
true , the namespace from schemalocation is added to the schema document as targetnamespace |
void |
setCharset(String string) |
void |
setFullSchemaChecking(boolean fullSchemaChecking) |
void |
setIgnoreCaching(boolean ignoreCaching) |
void |
setIgnoreUnknownNamespaces(Boolean ignoreUnknownNamespaces) |
void |
setImplementation(Class<AbstractXmlValidator> clazz) |
void |
setImportedNamespacesToIgnore(String string)
Comma separated list of namespaces which are excluded from an import or include in the schema document
|
void |
setImportedSchemaLocationsToIgnore(String string)
Comma separated list of schemaLocations which are excluded from an import or include in the schema document
|
void |
setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
A uri reference as a hint as to the location of a schema document with no target namespace.
|
void |
setReasonSessionKey(String reasonSessionKey) |
void |
setResponseRoot(String responseRoot)
Name of the response root element
|
void |
setRoot(String root)
Name of the root element
|
void |
setRootElementSessionKey(String rootElementSessionKey)
Key of session variable to store the name of the root element
|
void |
setRootNamespaceSessionKey(String rootNamespaceSessionKey)
Key of session variable to store the namespace of the root element
|
void |
setSchema(String schema)
The filename of the schema on the classpath.
|
void |
setSchemaLocation(String schemaLocation)
Pairs of URI references (one for the namespace name, and one for a hint as to the location of a schema document defining names for that namespace name).
The syntax is the same as for schemaLocation attributes in instance documents: e.g, "http://www.example.com file%20name.xsd". The user can specify more than one XML Schema in the list. Note that spaces are considered separators for this attributed. |
void |
setSoapNamespace(String string)
Deprecated.
|
void |
setThrowException(boolean throwException) |
void |
setUseBaseImportedSchemaLocationsToIgnore(boolean useBaseImportedSchemaLocationsToIgnore)
If set
true , the comparison for importedSchemaLocationsToIgnore is done on base filename without any path |
void |
setValidateFile(boolean b) |
void |
setWarn(boolean warn) |
void |
setXmlReasonSessionKey(String xmlReasonSessionKey) |
void |
setXmlSchemaVersion(String xmlSchemaVersion) |
void |
start()
Perform necessary action to start the pipe.
|
void |
stop()
Perform necessary actions to stop the
Pipe .For instance, closing JMS connections, DBMS connections etc. |
protected PipeForward |
validate(Message messageToValidate,
PipeLineSession session,
boolean responseMode,
String messageRoot) |
determineForward, doPipe, setForwardFailureToSuccess, setSchemaSessionKey, validate, validate
getParameterValue, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipe
addParameter, consumesSessionVariable, createBean, findForward, getAdapter, getEventSourceName, getForwards, getInSizeStatDummyObject, getOutSizeStatDummyObject, getParameterList, hasSizeStatistics, registerEvent, registerForward, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setGetInputFromFixedValue, setGetInputFromSessionKey, setHideRegex, setLocker, setLogIntermediaryResults, setMaxThreads, setName, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, throwEvent
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSchemaLocation
setName, validate
consumesSessionVariable, doPipe, getForwards, getMaxThreads, registerForward
getName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
getName
getChompCharSize, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getGetInputFromFixedValue, getGetInputFromSessionKey, getLocker, getSecLogSessionKeys, getStoreResultInSessionKey, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, setPipeLine, throwEvent
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttribute
protected AbstractXmlValidator validator
protected ConfigurationException configurationException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void configure() throws ConfigurationException
configure
in interface IConfigurable
configure
in interface IPipe
configure
in class ValidatorBase
ConfigurationException
- when:
isThrowException()
is false and there is no forward defined
for "failure"public void start() throws PipeStartException
IPipe
IPipe.configure()
method, for each start and stop command of the
adapter.start
in interface IPipe
start
in class AbstractPipe
PipeStartException
public void stop()
IPipe
Pipe
.stop
in interface IPipe
stop
in class AbstractPipe
protected void checkSchemaSpecified() throws ConfigurationException
ConfigurationException
public ConfigurationException getConfigurationException()
getConfigurationException
in interface IXmlValidator
public List<org.apache.xerces.xs.XSModel> getXSModels()
public PipeRunResult doPipe(Message input, PipeLineSession session, boolean responseMode, String messageRoot) throws PipeRunException
doPipe
in class ValidatorBase
PipeRunException
protected PipeForward validate(Message messageToValidate, PipeLineSession session, boolean responseMode, String messageRoot) throws XmlValidatorException, PipeRunException, ConfigurationException
validate
in class ValidatorBase
XmlValidatorException
PipeRunException
ConfigurationException
protected RootValidations createRootValidation(String messageRoot)
protected PipeForward determineForward(AbstractXmlValidator.ValidationResult validationResult, PipeLineSession session, boolean responseMode) throws PipeRunException
PipeRunException
protected PipeRunResult getErrorResult(AbstractXmlValidator.ValidationResult result, String reason, PipeLineSession session, boolean responseMode) throws PipeRunException
PipeRunException
protected boolean isConfiguredForMixedValidation()
isConfiguredForMixedValidation
in class ValidatorBase
public String getMessageRoot(boolean responseMode)
public String getSchemasId()
getSchemasId
in interface SchemasProvider
public Set<IXSD> getXsds() throws ConfigurationException
getXsds
in interface IXmlValidator
ConfigurationException
public List<Schema> getSchemas() throws ConfigurationException
getSchemas
in interface SchemasProvider
ConfigurationException
public List<Schema> getSchemas(boolean checkRootValidations) throws ConfigurationException
ConfigurationException
public IValidator getResponseValidator()
getResponseValidator
in interface IDualModeValidator
getResponseValidator
in class ValidatorBase
public RootValidations getRootValidations(boolean responseMode)
public String getSchemasId(PipeLineSession session) throws PipeRunException
getSchemasId
in interface SchemasProvider
PipeRunException
public List<Schema> getSchemas(PipeLineSession session) throws PipeRunException
getSchemas
in interface SchemasProvider
PipeRunException
public Object getSpecialDefaultValue(String attributeName, Object defaultValue, Map<String,String> attributes)
getSpecialDefaultValue
in interface HasSpecialDefaultValues
protected void addRequestRootValidation(RootValidation path)
protected RootValidations getRequestRootValidations()
protected void addResponseRootValidation(RootValidation path)
protected RootValidations getResponseRootValidations()
protected void addInvalidRootNamespaces(List<String> path, List<String> invalidRootNamespaces)
path
- to the element from where to start validating namespacesinvalidRootNamespaces
- XML namespace that is not allowed on the current elementpublic String getDocumentation()
IXmlValidator
getDocumentation
in interface IXmlValidator
public void setImplementation(Class<AbstractXmlValidator> clazz) throws IllegalAccessException, InstantiationException
public void setSchema(String schema)
public String getSchema()
getSchema
in interface IXmlValidator
public void setSchemaLocation(String schemaLocation)
public void setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
public void setRoot(String root)
ValidatorBase
setRoot
in class ValidatorBase
public void setResponseRoot(String responseRoot)
ValidatorBase
setResponseRoot
in class ValidatorBase
public String getMessageRoot()
getMessageRoot
in interface IXmlValidator
@ReferTo(value=AbstractXmlValidator.class) public void setFullSchemaChecking(boolean fullSchemaChecking)
public boolean isFullSchemaChecking()
@ReferTo(value=AbstractXmlValidator.class) public void setThrowException(boolean throwException)
public boolean isThrowException()
@ReferTo(value=AbstractXmlValidator.class) public void setReasonSessionKey(String reasonSessionKey)
public String getReasonSessionKey()
@ReferTo(value=AbstractXmlValidator.class) public void setXmlReasonSessionKey(String xmlReasonSessionKey)
public String getXmlReasonSessionKey()
@ReferTo(value=AbstractXmlValidator.class) public void setValidateFile(boolean b)
public boolean isValidateFile()
@ReferTo(value=AbstractXmlValidator.class) public void setCharset(String string)
public String getCharset()
public void setAddNamespaceToSchema(boolean addNamespaceToSchema)
true
, the namespace from schemalocation is added to the schema document as targetnamespacepublic void setImportedSchemaLocationsToIgnore(String string)
public void setUseBaseImportedSchemaLocationsToIgnore(boolean useBaseImportedSchemaLocationsToIgnore)
true
, the comparison for importedSchemaLocationsToIgnore is done on base filename without any pathpublic void setImportedNamespacesToIgnore(String string)
@ReferTo(value=AbstractXmlValidator.class) public void setWarn(boolean warn)
@ReferTo(value=AbstractXmlValidator.class) public void setIgnoreUnknownNamespaces(Boolean ignoreUnknownNamespaces)
public Boolean getIgnoreUnknownNamespaces()
@ReferTo(value=AbstractXmlValidator.class) public void setIgnoreCaching(boolean ignoreCaching)
@ReferTo(value=AbstractXmlValidator.class) public void setXmlSchemaVersion(String xmlSchemaVersion)
@Deprecated public void setSoapNamespace(String string)
SoapValidator
is now the preferred solution in case a SOAP
message needs to be validated, in other cases give this property an empty value.@Deprecated public String getSoapNamespace()
public void setRootElementSessionKey(String rootElementSessionKey)
public void setRootNamespaceSessionKey(String rootNamespaceSessionKey)
Copyright © 2023 Frank!Framework. All rights reserved.