org.ceryle.xnode
Class XNodeCollectionFactoryImpl

java.lang.Object
  extended by org.ceryle.xnode.XNodeFactoryImpl
      extended by org.ceryle.xnode.XNodeCollectionFactoryImpl
All Implemented Interfaces:
XNodeCollectionFactory, XNodeFactory

public class XNodeCollectionFactoryImpl
extends XNodeFactoryImpl
implements XNodeFactory, XNodeCollectionFactory

This extends XNodeFactoryImpl, implementing the XNodeCollectionFactory API, providing a factory for creating both XNodes and XNodeCollections.

The XNode Implementation (the package org.ceryle.xnode.*, both its source code and documentation), are released under the Apache 2.0 License. For more details, check the LICENSE file contained with the distribution, or see The Ceryle Project for more information. It is distributed with no warranty.

Since:
XNode 1.2
Version:
$Id: XNodeCollectionFactoryImpl.java,v 3.3 2007-06-15 12:10:31 altheim Exp $
Author:
Murray Altheim
See Also:
XNodeFactoryImpl, XNodeCollectionFactory

Field Summary
 
Fields inherited from class org.ceryle.xnode.XNodeFactoryImpl
m_xns, MARKUP_1, MARKUP_2, TEXT_NODE, XNODE_TEXT_TAGNAME, xp
 
Constructor Summary
XNodeCollectionFactoryImpl(XNodeStore xnodestore, XMLProcessor xmlprocessor)
          A constructor for a XNodeCollectionFactoryImpl, provided with the parent XNodeStore and an optional XMLProcessor.
 
Method Summary
 XNodeCollection createXNodeCollection(String cid, Node node)
          Return an XNodeCollection provided a String id and its DOM Node node content.
protected  Document getXNodeCollectionEnvelope(String id, String created, String modified)
          Returns an empty XNodeCollection XML DOM Document.
 Node getXNodeContent(XNode xnode, boolean includeEnvelope)
          Returns a DOM node representation of the provided XNode, including the XNode envelope if includeEnvelope is true.
 XNodeCollection recreateXNodeCollection(String cid, String content)
          Returns an XNodeCollection provided a String containing its content as a String, assuming the provided content is a serialization of an XNodeCollection.
 
Methods inherited from class org.ceryle.xnode.XNodeFactoryImpl
createXNode, createXNode, getTextDocument, getXNodeEnvelope, recreateXNode, recreateXNode, serializeXNode, serializeXNode, setMetadataFromHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XNodeCollectionFactoryImpl

public XNodeCollectionFactoryImpl(XNodeStore xnodestore,
                                  XMLProcessor xmlprocessor)
                           throws XNodeException
A constructor for a XNodeCollectionFactoryImpl, provided with the parent XNodeStore and an optional XMLProcessor.

Parameters:
xnodestore - the XNodeStore supporting the database.
xmlprocessor - an optional XMLProcessor instance.
Throws:
XNodeException - if the XMLProcessor or XNodeCollectionFactory cannot be established.
Method Detail

getXNodeCollectionEnvelope

protected Document getXNodeCollectionEnvelope(String id,
                                              String created,
                                              String modified)
                                       throws XNodeException
Returns an empty XNodeCollection XML DOM Document. The xnode:Envelope's xnode:id attribute, xnode:created, and xnode:modified attributes are included, the latter being optional. This substitutes an The xnode:Collection for the xnode:Body, as a store for either collection IDs (for the root collection) or node IDs (for all other collections).

(this is not an XNode API method)

Parameters:
id - the XNode unique identifier
created - the XNode creation timestamp
modified - the XNode modification timestamp (optional)
Returns:
a DOM Document object
Throws:
XNodeException

createXNodeCollection

public XNodeCollection createXNodeCollection(String cid,
                                             Node node)
                                      throws XNodeException
Return an XNodeCollection provided a String id and its DOM Node node content.

(this is an XNode API method)

Specified by:
createXNodeCollection in interface XNodeCollectionFactory
Parameters:
cid - the XNodeCollection ID. e @param node the DOM Node to be enclosed in the XNodeCollection.
Returns:
the created XNode.
Throws:
XNodeException - if an error occurs during creation.

recreateXNodeCollection

public XNodeCollection recreateXNodeCollection(String cid,
                                               String content)
                                        throws XNodeException
Returns an XNodeCollection provided a String containing its content as a String, assuming the provided content is a serialization of an XNodeCollection.

(this is an XNode API method)

Specified by:
recreateXNodeCollection in interface XNodeCollectionFactory
Parameters:
cid - the XNodeCollection ID.
content - the String to be processed as XNode content.
Returns:
the recreated XNode.
Throws:
XNodeException - if an error occurs during recreation.

getXNodeContent

public Node getXNodeContent(XNode xnode,
                            boolean includeEnvelope)
                     throws XNodeException
Returns a DOM node representation of the provided XNode, including the XNode envelope if includeEnvelope is true. This overrides the method in XNodeFactoryImpl.

(this is an XNode API method)

Specified by:
getXNodeContent in interface XNodeCollectionFactory
Specified by:
getXNodeContent in interface XNodeFactory
Overrides:
getXNodeContent in class XNodeFactoryImpl
Parameters:
xnode - the XNode to process.
includeEnvelope - when true, include the entire XNode (XML) envelope.
Returns:
a DOM Document representation of the XNode.
Throws:
XNodeException - if an error occurs during processing.


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.