org.apache.cocoon.portal.persistence.castor
Class CastorSourceConverter

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.portal.persistence.castor.CastorSourceConverter
All Implemented Interfaces:
Configurable, Converter, Initializable, LogEnabled, Serviceable, ThreadSafe

public class CastorSourceConverter
extends AbstractLogEnabled
implements Serviceable, Configurable, Initializable, ThreadSafe, Converter

This is a component that converts a profile (= object tree) to XML and vice-versa using Castor. It could be used to persist objects as a XML representation. In order to work properly the methods provided by this interface require some parameters: objectmap : containing a map of objects for resolving references during load profiletype: specifying the mapping (e.g. in the portal this is one of layout, copletinstancedata, copletdata or copletbasedate) suppressXSIType: Sets whether or not the xsi:type attributes should appear on the marshalled document.

Version:
$Id: CastorSourceConverter.java 328453 2005-10-25 19:08:53Z cziegeler $

Nested Class Summary
static class CastorSourceConverter.ReferenceResolver
           
 
Field Summary
protected  boolean defaultSuppressXSIType
           
protected  boolean defaultValidateUnmarshalling
           
protected  CastorSourceConverter.ReferenceResolver idResolver
          This object resolves the references between the different profile files.
protected  ServiceManager manager
           
protected  Map mappings
           
protected  Map mappingSources
           
 
Fields inherited from interface org.apache.cocoon.portal.persistence.Converter
ROLE
 
Constructor Summary
CastorSourceConverter()
           
 
Method Summary
 void configure(Configuration config)
           
 Object getObject(InputStream stream, String mappingName, Map references, Map parameters)
          Load an object from the given input stream.
 void initialize()
           
 void service(ServiceManager manager)
           
 void storeObject(OutputStream stream, String mappingName, Object object, Map parameters)
          Save an object to a given stream.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mappingSources

protected Map mappingSources

manager

protected ServiceManager manager

mappings

protected Map mappings

defaultSuppressXSIType

protected boolean defaultSuppressXSIType

defaultValidateUnmarshalling

protected boolean defaultValidateUnmarshalling

idResolver

protected CastorSourceConverter.ReferenceResolver idResolver
This object resolves the references between the different profile files.

Constructor Detail

CastorSourceConverter

public CastorSourceConverter()
Method Detail

getObject

public Object getObject(InputStream stream,
                        String mappingName,
                        Map references,
                        Map parameters)
                 throws ConverterException
Description copied from interface: Converter
Load an object from the given input stream.

Specified by:
getObject in interface Converter
Parameters:
stream - The input stream with the data.
mappingName - ProfileLS
references - A map of references referenced from the profile.
parameters - An optional map of parameters for the conversion.
Returns:
The loaded object.
Throws:
ConverterException
See Also:
Converter.getObject(java.io.InputStream, java.lang.String, java.util.Map, java.util.Map)

storeObject

public void storeObject(OutputStream stream,
                        String mappingName,
                        Object object,
                        Map parameters)
                 throws ConverterException
Description copied from interface: Converter
Save an object to a given stream.

Specified by:
storeObject in interface Converter
Parameters:
stream - The output stream.
mappingName - ProfileLS
object - The object to save.
parameters - An optional map of parameters for the conversion.
Throws:
ConverterException
See Also:
Converter.storeObject(java.io.OutputStream, java.lang.String, java.lang.Object, java.util.Map)

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception
See Also:
Initializable.initialize()


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.