com.bankframe.ei.channel.codec
Class XMLXSLCodec

java.lang.Object
  extended by com.bankframe.ei.channel.codec.XMLDOMCodec
      extended by com.bankframe.ei.channel.codec.DPTPDOMCodec
          extended by com.bankframe.ei.channel.codec.XMLXSLCodec
All Implemented Interfaces:
Codec
Direct Known Subclasses:
B2BXMLCodec, FooXmlXslCodec

public abstract class XMLXSLCodec
extends DPTPDOMCodec

This class decodes and encodes XML data, applying an XSL transformation to map arbitrary XML to Eontec XML. In order to know what XSL stylesheet to use this class must know the content-type of the XML, this is specified by passing the content-type to the constructor Since instances of Codec are always created through the use of reflection this class must be declared abstract. To support a specific type of XML document a sub-class of this class must created with a default constructor that specifies the correct type of that XML document. The request and response content types can be different, use the appropriate constructor if the request and response content-types are different.

Response and Request content types are the same

e.g.: public class AcmeXMLCodec extends XMLXSLCodec { public static final String CONTENT_TYPE="application/x-acme-xml"; public AcmeXMLCodec() { super(CONTENT_TYPE); } public String getName() { return "AcmeXMLCodec"; } }

Response and Request content types are the different

e.g.: public class AcmeXMLCodec extends XMLXSLCodec { public static final String REQUEST_CONTENT_TYPE="application/x-acme-request-xml"; public static final String RESPONSE_CONTENT_TYPE="application/x-acme-response-xml"; public AcmeXMLCodec() { super(REQUEST_CONTENT_TYPE,RESPONSE_CONTENT_TYPE); } public String getName() { return "AcmeXMLCodec"; } }

The XSL style-sheet to use for the transformation is determined by mapping the content-type to a setting in BankframeResource.properties. For the first example above the following keys would need to be present in BankframeResource.properties channel.http.xml.xsl.request.content-type.application/x-acme-request-xml=http://localhost/somepath/foo-request.xsl channel.http.xml.xsl.response.content-type.application/x-acme-request-xml=http://localhost/somepath/foo-response.xsl


Field Summary
static String XSL_REQUEST_MAPPING
           
static String XSL_RESPONSE_MAPPING
           
static String XSL_TRACE_TRANSFORM
           
 
Fields inherited from class com.bankframe.ei.channel.codec.DPTPDOMCodec
NAME_ATTRIBUTE
 
Method Summary
 Vector decode(Document xml)
          Override this method to convert a DOM tree to a Vector of DataPackets
 Document encodeXml(Vector dps)
          Override this method to convert a Vector of DataPackets to a DOM tree
 boolean isTracing()
           
 void setTracing(boolean tracing)
           
 
Methods inherited from class com.bankframe.ei.channel.codec.DPTPDOMCodec
getName, main
 
Methods inherited from class com.bankframe.ei.channel.codec.XMLDOMCodec
decode, encode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSL_REQUEST_MAPPING

public static final String XSL_REQUEST_MAPPING
See Also:
Constant Field Values

XSL_RESPONSE_MAPPING

public static final String XSL_RESPONSE_MAPPING
See Also:
Constant Field Values

XSL_TRACE_TRANSFORM

public static final String XSL_TRACE_TRANSFORM
See Also:
Constant Field Values
Method Detail

decode

public Vector decode(Document xml)
Description copied from class: XMLDOMCodec
Override this method to convert a DOM tree to a Vector of DataPackets

Overrides:
decode in class DPTPDOMCodec
Parameters:
xml - Document
Returns:
Vector of DataPackets
See Also:
XMLDOMCodec.decode(Document)

encodeXml

public Document encodeXml(Vector dps)
Description copied from class: XMLDOMCodec
Override this method to convert a Vector of DataPackets to a DOM tree

Overrides:
encodeXml in class DPTPDOMCodec
Parameters:
dps - Vector
Returns:
DOM tree representation of the Vector of DataPackets
See Also:
XMLDOMCodec.encodeXml(Vector)

setTracing

public void setTracing(boolean tracing)

isTracing

public boolean isTracing()


Copyright © 2005, 2007, Oracle. All rights reserved.