|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.xnode.XNodeFactoryImpl
public class XNodeFactoryImpl
Provides an implementation of the XNodeFactory API as a factory for creating XNode objects.
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.
| Field Summary | |
|---|---|
protected XNodeStore |
m_xns
|
protected String |
MARKUP_1
|
protected String |
MARKUP_2
|
static String |
TEXT_NODE
A String used as a base document element for text-based XNodes. |
static String |
XNODE_TEXT_TAGNAME
The String "xnode:Text". |
protected XMLProcessor |
xp
|
| Constructor Summary | |
|---|---|
XNodeFactoryImpl(XNodeStore xnodestore,
XMLProcessor xmlprocessor)
A constructor for a XNodeFactoryImpl, provided with an optional XMLProcessor. |
|
| Method Summary | |
|---|---|
XNode |
createXNode(String id)
Returns a new, empty XNode, provided a String ID id. |
XNode |
createXNode(String id,
Node node)
Return an XNode provided a String id and a DOM Node node. |
Document |
getTextDocument()
Generates a blank Document containing a <xnode:Text> Element wrapping an empty CDATA section. |
Node |
getXNodeContent(XNode xnode,
boolean includeEnvelope)
Returns a DOM node representation of the provided XNode, including the XNode envelope if includeEnvelope is true. |
protected Document |
getXNodeEnvelope(String id,
String created,
String modified)
Returns an empty XNode XML DOM Document. |
XNode |
recreateXNode(Node node)
Returns an XNode provided a DOM Node node, assuming the provided node's content is a serialization of an XNode (some minor validation will necessarily occur). |
XNode |
recreateXNode(String content)
Returns an XNode provided a String containing its content, assuming the provided content is a serialization of an XNode. |
String |
serializeXNode(XNode xnode,
boolean includeEnvelope)
Provided with an XNode xnode, returns an XML serialization as a String. |
boolean |
serializeXNode(XNode xnode,
Writer writer,
boolean includeEnvelope)
Writes an XML serialization of the XNode xnode to the supplied Writer writer. |
protected void |
setMetadataFromHeader(XNode xnode,
Element header)
Provided with an XNode (generally during re-creation), sets its metadata by parsing the content of the xnode:Header DOM Element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected XNodeStore m_xns
protected XMLProcessor xp
public static final String TEXT_NODE
<xnode:Text xmlns:xnode="http://purl.org/xnode/1.2"/>
public static final String XNODE_TEXT_TAGNAME
protected final String MARKUP_1
protected final String MARKUP_2
| Constructor Detail |
|---|
public XNodeFactoryImpl(XNodeStore xnodestore,
XMLProcessor xmlprocessor)
throws XNodeException
xnodestore - the XNodeStore supporting the database.xmlprocessor - an optional XMLProcessor instance.
XNodeException - if the XML processor or XNode factory cannot be established.| Method Detail |
|---|
protected Document getXNodeEnvelope(String id,
String created,
String modified)
throws XNodeException
(this is not an XNode API method)
id - the XNode unique identifiercreated - the XNode creation timestampmodified - the XNode modification timestamp (optional)
XNodeException
public XNode createXNode(String id)
throws XNodeException
(this is an XNode API method)
createXNode in interface XNodeFactoryid - the XNode unique identifier
XNodeException - if an error occurs during creation
public XNode createXNode(String id,
Node node)
throws XNodeException
createXNode(String), i.e., provide an empty
XNode.
Note that this contains an additional non-API feature, whereby if the incoming Node is an <xnode:Text> Element (which is one way content is provided in normally) but contains a bogus xnode:created attribute, it will be treated as a carrier for the XNode's 'created' property and subsequently removed from the DOM Element. This is the only way a new XNode's 'created' property can be set when the XNode envelope itself is not provided.
(this is an XNode API method)
createXNode in interface XNodeFactoryid - the XNode ID.node - the DOM Node to be enclosed in the XNode.
XNodeException - if an error occurs during creation.
public XNode recreateXNode(String content)
throws XNodeException
(this is not an XNode API method)
content - the String to be processed as XNode content.
XNodeException - if an error occurs during recreation.
public XNode recreateXNode(Node node)
throws XNodeException
(this is an XNode API method)
recreateXNode in interface XNodeFactorynode - the DOM Node to be processed as XNode content.
XNodeException - if an error occurs during recreation.
protected void setMetadataFromHeader(XNode xnode,
Element header)
throws XNodeException
This permits either <Property> or <xnode:Property> for the property element tag name (in the interest of being easy with what we accept, backwards-compatibility-wise).
(this is not an XNode API method)
xnode - the XNode to populate with metadataheader - the DOM Element (an xnode:Header) containing metadata.
XNodeException - if an error occurs during the process.public Document getTextDocument()
public Node getXNodeContent(XNode xnode,
boolean includeEnvelope)
throws XNodeException
(this is an XNode API method)
getXNodeContent in interface XNodeFactoryxnode - the XNode to be processed.includeEnvelope - if true, include the xnode:Envelope.
XNodeException - if an error occurs during processing.
public boolean serializeXNode(XNode xnode,
Writer writer,
boolean includeEnvelope)
throws XNodeException
(this is an XNode API method)
serializeXNode in interface XNodeFactoryxnode - the XNode to be serializedwriter - the Writer receiving the outputincludeEnvelope - if true, include the xnode:Envelope
XNodeException - if an error occurs during serialization
public String serializeXNode(XNode xnode,
boolean includeEnvelope)
throws XNodeException
(this is an XNode API method)
serializeXNode in interface XNodeFactoryxnode - the XNode to be serialized.includeEnvelope - if true, include the xnode:Envelope.
XNodeException - if an error occurs during serialization.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||