public abstract class AbstractStreamValidator extends Object implements StreamValidator.Validator
Modifier and Type | Field and Description |
---|---|
protected org.apache.log4j.Logger |
mLogger |
protected boolean |
mServiceEnabled |
Constructor and Description |
---|
AbstractStreamValidator() |
Modifier and Type | Method and Description |
---|---|
abstract InputStream |
doValidate(String pResourceName,
Map<String,String> pTemplateMap,
InputStream pInputStream) |
String |
getMimeType()
The mime type which can be expected to be produced by this validator.
|
String |
getPathExpression()
A regular expression which the name of the resource will be matched against.
|
String |
getResourceType()
A descriptive type name for the resource that this validator handles.
|
boolean |
getServiceEnabled()
Return wether or not this service is enabled.
|
void |
setMimeType(String pMimeType) |
void |
setPathExpression(String pPathExpression) |
void |
setResourceType(String pResourceType) |
void |
setServiceEnabled(boolean pServiceEnabled) |
InputStream |
validate(String pResourceName,
Map<String,String> pTemplateMap,
InputStream pInputStream)
Performs validation on the input stream by delegating to doValidate() if the
serviceEnabled property
is true. |
protected boolean mServiceEnabled
protected org.apache.log4j.Logger mLogger
public void setMimeType(String pMimeType)
public String getMimeType()
StreamValidator.Validator
getMimeType
in interface StreamValidator.Validator
public void setPathExpression(String pPathExpression)
public String getPathExpression()
StreamValidator.Validator
getPathExpression
in interface StreamValidator.Validator
public String getResourceType()
StreamValidator.Validator
getResourceType
in interface StreamValidator.Validator
public void setResourceType(String pResourceType)
public void setServiceEnabled(boolean pServiceEnabled)
public boolean getServiceEnabled()
public final InputStream validate(String pResourceName, Map<String,String> pTemplateMap, InputStream pInputStream) throws ValidationException
serviceEnabled
property
is true. Otherwise, the original input stream is returned, unfiltered.validate
in interface StreamValidator.Validator
pResourceName
- The name of the resource being validatedpTemplateMap
- a map holding place holder values supported in the publication resources.pInputStream
- The input stream which contains the data being validated @return the original input stream (if serviceEnabled is false) or the same stream wrapped in a filtered input
stream which validates the data somehow (if serviceEnabled is true).ValidationException
- if a problem occurs while setting up the validation chain.public abstract InputStream doValidate(String pResourceName, Map<String,String> pTemplateMap, InputStream pInputStream) throws ValidationException
ValidationException
© 1998- 2018 Stibo DX