com.webhydra.slug.process.xml
Class AbstractXmlProcessStatusTranslator

java.lang.Object
  extended by com.webhydra.slug.process.AbstractSlugService
      extended by com.webhydra.slug.process.AbstractProcessStatusTranslator
          extended by com.webhydra.slug.process.xml.AbstractXmlProcessStatusTranslator
All Implemented Interfaces:
IProcessStatusTranslator, ISlugService
Direct Known Subclasses:
XmlDtdProcessStatusTranslator, XmlXsdProcessStatusTranslator

public abstract class AbstractXmlProcessStatusTranslator
extends AbstractProcessStatusTranslator
implements IProcessStatusTranslator

Abstract XML ProcessStatus Translator

Author:
rossen

Field Summary
static java.lang.String PARAM_USE_DOC_DEF
          Instantiation parameter specifing will document docType definitions
 
Fields inherited from class com.webhydra.slug.process.AbstractProcessStatusTranslator
contentType
 
Fields inherited from class com.webhydra.slug.process.AbstractSlugService
setup
 
Constructor Summary
protected AbstractXmlProcessStatusTranslator()
          Default constructor
 
Method Summary
 java.lang.String getClassDef()
          Generate class definition.
protected abstract  java.lang.String getDocType()
          Retruns one the supported document types XML_TYPE_DTD or XML_TYPE_XSD.
 void init(java.util.Map setup)
          Overrides the default implelemntation.
 void prepare()
          Load document type definition.
protected  boolean shouldUseDocType()
          Getter for the useDocType propertie.
protected  java.lang.String xmlEscape(java.lang.String str)
          Escape & < and > characters.
 
Methods inherited from class com.webhydra.slug.process.AbstractProcessStatusTranslator
getContentType, setContentType
 
Methods inherited from class com.webhydra.slug.process.AbstractSlugService
getParams, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.webhydra.slug.process.IProcessStatusTranslator
getContentType, translate
 
Methods inherited from interface com.webhydra.slug.process.ISlugService
release
 

Field Detail

PARAM_USE_DOC_DEF

public static final java.lang.String PARAM_USE_DOC_DEF
Instantiation parameter specifing will document docType definitions

See Also:
Constant Field Values
Constructor Detail

AbstractXmlProcessStatusTranslator

protected AbstractXmlProcessStatusTranslator()
Default constructor

Method Detail

shouldUseDocType

protected boolean shouldUseDocType()
Getter for the useDocType propertie.

Returns:
useDocType proeprty.

getDocType

protected abstract java.lang.String getDocType()
Retruns one the supported document types XML_TYPE_DTD or XML_TYPE_XSD.


prepare

public void prepare()
             throws SlugInitializationException
Load document type definition.

Specified by:
prepare in interface ISlugService
Overrides:
prepare in class AbstractSlugService
Throws:
SlugInitializationException - if IOException is encounted during Document Type loading.

init

public void init(java.util.Map setup)
          throws SlugInitializationException
Overrides the default implelemntation. Sets useDocType to true if PARAM_USE_DOC_DEF is present as a key in the setup parameters.

Specified by:
init in interface ISlugService
Overrides:
init in class AbstractSlugService
Parameters:
setup - map with setup parameters.
Throws:
SlugInitializationException - not thrown

getClassDef

public java.lang.String getClassDef()
Generate class definition.

Specified by:
getClassDef in interface IProcessStatusTranslator
Returns:
implementation dependent String representation of provided parameter class.

xmlEscape

protected java.lang.String xmlEscape(java.lang.String str)
Escape & < and > characters.

Parameters:
str - string to be escaped.
Returns:
original string with &, < and > substituted for &, < and > respectively.