org.compass.core.converter.xsem
Class SingletonXmlContentConverterWrapper

java.lang.Object
  extended by org.compass.core.converter.xsem.SingletonXmlContentConverterWrapper
All Implemented Interfaces:
CompassConfigurable, XmlContentConverter, XmlContentConverterWrapper

public class SingletonXmlContentConverterWrapper
extends Object
implements XmlContentConverterWrapper, CompassConfigurable

An XmlContentConverter implementation that wraps the actual XmlContentConverter configured (based on the settings) and creates and configures a singleton (shared) XmlContentConverter for both toXml(org.compass.core.xml.XmlObject) and fromXml(String, java.io.Reader).

Author:
kimchy

Constructor Summary
SingletonXmlContentConverterWrapper()
           
 
Method Summary
 void configure(CompassSettings settings)
          Creates and configures a singleton XmlContentConverter.
 XmlContentConverter createContentConverter()
           
 AliasedXmlObject fromXml(String alias, Reader xml)
          Converts a raw xml and an alias into an AliasedXmlObject by using the shared XmlContentConverter implementation.
 String toXml(XmlObject xmlObject)
          Converts the XmlObject into raw xml by using the shared XmlContentConverter implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingletonXmlContentConverterWrapper

public SingletonXmlContentConverterWrapper()
Method Detail

configure

public void configure(CompassSettings settings)
               throws CompassException
Creates and configures a singleton XmlContentConverter.

Specified by:
configure in interface CompassConfigurable
Parameters:
settings - The settings for the configured object
Throws:
CompassException

toXml

public String toXml(XmlObject xmlObject)
             throws ConversionException
Converts the XmlObject into raw xml by using the shared XmlContentConverter implementation.

Specified by:
toXml in interface XmlContentConverter
Parameters:
xmlObject - The xml object to convert to an xml string
Returns:
An xml string representation of the xml object
Throws:
ConversionException - Failed to convert the xml object to an xml string
See Also:
XmlContentConverter.toXml(org.compass.core.xml.XmlObject)

fromXml

public AliasedXmlObject fromXml(String alias,
                                Reader xml)
                         throws ConversionException
Converts a raw xml and an alias into an AliasedXmlObject by using the shared XmlContentConverter implementation.

Specified by:
fromXml in interface XmlContentConverter
Parameters:
alias - The alias the aliases xml object is associated with
xml - The xml string that will be converted into an aliases xml object
Returns:
The aliases xml object that is the restult of the xml parsed
Throws:
ConversionException
See Also:
XmlContentConverter.fromXml(String, java.io.Reader)

createContentConverter

public XmlContentConverter createContentConverter()
Specified by:
createContentConverter in interface XmlContentConverterWrapper


Copyright (c) 2004-2009 The Compass Project.