biz.hammurapi.jms.adapter.converters
Class StylingXmlConverter

java.lang.Object
  extended by biz.hammurapi.config.ComponentBase
      extended by biz.hammurapi.jms.adapter.converters.StylingXmlConverter
All Implemented Interfaces:
biz.hammurapi.config.Component, biz.hammurapi.config.Context, Converter, biz.hammurapi.metrics.MeasurementCollector, biz.hammurapi.metrics.MeasurementConsumer
Direct Known Subclasses:
DomConverter, StylingXmlBeansConverter

public abstract class StylingXmlConverter
extends biz.hammurapi.config.ComponentBase
implements Converter

This converter supports the following optional conversion properties:

Author:
Tatyana Konukova

Field Summary
protected  javax.xml.transform.TransformerFactory transformerFactory
           
 
Fields inherited from class biz.hammurapi.config.ComponentBase
owner
 
Constructor Summary
StylingXmlConverter()
           
 
Method Summary
 javax.jms.Message convert(java.lang.Exception ex, javax.jms.Session session, java.util.Map properties, javax.jms.Message request)
          This method supports error-style optional property - URL of stylesheet to apply after Exception -> Conversion.
 java.lang.Object convert(javax.jms.Message message, java.util.Map properties)
          This method supports from-xml-style optional property - URL of stylesheet to apply before XML -> Object conversion.
protected abstract  javax.xml.transform.Source convert(java.lang.Object request)
          Converts request object to Source for styling/serialization
 javax.jms.Message convert(java.lang.Object obj, javax.jms.Session session, java.util.Map properties, javax.jms.Message request)
          This method supports to-xml-style optional property - URL of stylesheet to apply after Object -> XML conversion.
protected  org.w3c.dom.Document createDocument()
           
protected abstract  javax.xml.transform.Result createResult()
          Creates result to receive transformed input.
protected  javax.xml.transform.Transformer getTransformer(java.lang.String url)
           
protected abstract  java.lang.Object processResult(javax.xml.transform.Result result)
          Converts reply result to object.
 void start()
           
 void stop()
           
 
Methods inherited from class biz.hammurapi.config.ComponentBase
addMeasurement, get, getChild, getMeasurementConsumer, getOwner, getOwner, setMeasurementConsumer, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transformerFactory

protected javax.xml.transform.TransformerFactory transformerFactory
Constructor Detail

StylingXmlConverter

public StylingXmlConverter()
Method Detail

createDocument

protected org.w3c.dom.Document createDocument()

createResult

protected abstract javax.xml.transform.Result createResult()
Creates result to receive transformed input.

Returns:
Result instance.

processResult

protected abstract java.lang.Object processResult(javax.xml.transform.Result result)
                                           throws java.lang.Exception
Converts reply result to object.

Parameters:
result -
Returns:
Throws:
java.lang.Exception

convert

protected abstract javax.xml.transform.Source convert(java.lang.Object request)
                                               throws java.lang.Exception
Converts request object to Source for styling/serialization

Parameters:
request -
Returns:
Throws:
java.lang.Exception

start

public void start()
           throws biz.hammurapi.config.ConfigurationException
Specified by:
start in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

getTransformer

protected javax.xml.transform.Transformer getTransformer(java.lang.String url)
                                                  throws javax.xml.transform.TransformerConfigurationException,
                                                         java.net.MalformedURLException,
                                                         java.io.IOException
Throws:
javax.xml.transform.TransformerConfigurationException
java.net.MalformedURLException
java.io.IOException

convert

public java.lang.Object convert(javax.jms.Message message,
                                java.util.Map properties)
                         throws java.lang.Exception
This method supports from-xml-style optional property - URL of stylesheet to apply before XML -> Object conversion. If URL starts with resource: then it is loaded from classloader resource.

Specified by:
convert in interface Converter
Parameters:
message - Source message
properties - Configuration properties
Returns:
Object created from message data
Throws:
java.lang.Exception

convert

public javax.jms.Message convert(java.lang.Object obj,
                                 javax.jms.Session session,
                                 java.util.Map properties,
                                 javax.jms.Message request)
                          throws java.lang.Exception
This method supports to-xml-style optional property - URL of stylesheet to apply after Object -> XML conversion. If URL starts with resource: then it is loaded from classloader resource. Correlates by message ID.

Specified by:
convert in interface Converter
Parameters:
obj - Source object
session - Session to create message
properties - Configuration properties
request - Request message, can be null.
Returns:
Populated and ready to send message
Throws:
java.lang.Exception

convert

public javax.jms.Message convert(java.lang.Exception ex,
                                 javax.jms.Session session,
                                 java.util.Map properties,
                                 javax.jms.Message request)
                          throws java.lang.Exception
This method supports error-style optional property - URL of stylesheet to apply after Exception -> Conversion. If URL starts with resource: then it is loaded from classloader resource. This implementation uses ThrowableSerializer to convert exception to XML. Correlates by message ID.

Specified by:
convert in interface Converter
session - Session to create message
properties - Configuration properties
request - Request message, can be null.
Returns:
Populated and ready to send message
Throws:
java.lang.Exception

stop

public void stop()
          throws biz.hammurapi.config.ConfigurationException
Specified by:
stop in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException


Copyright © 2006 Hammurapi Group. All Rights Reserved.