Class Configuration
- java.lang.Object
-
- org.apache.manifoldcf.core.interfaces.Configuration
-
- All Implemented Interfaces:
IHierarchyParent
- Direct Known Subclasses:
ConfigParams,Connectors,ManifoldCFConfiguration,Specification
public class Configuration extends java.lang.Object implements IHierarchyParent
This class represents XML configuration information, in its most basic incarnation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classConfiguration.JSONReaderprotected static classConfiguration.JSONWriter
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected java.util.List<ConfigurationNode>childrenprotected static java.lang.StringJSON_ATTRIBUTEprotected static java.lang.StringJSON_CHILDRENprotected static java.lang.StringJSON_TYPEprotected static java.lang.StringJSON_VALUEprotected booleanreadOnlyprotected java.lang.StringrootNodeLabel
-
Constructor Summary
Constructors Constructor Description Configuration()Constructor.Configuration(java.lang.String rootNodeLabel)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(int index, ConfigurationNode child)Add child at specified position.protected voidaddOuterNode(ConfigurationNode node)Note the addition of a new outer node.voidclearChildren()Clear children.protected voidclearOuterNodes()Note the removal of all outer nodes.protected ConfigurationcreateDuplicate(boolean readOnly)Create a duplicate.protected ConfigurationcreateNew()Create a new object of the appropriate class.protected ConfigurationNodecreateNewNode(java.lang.String type)Create a new child node of the appropriate type and class.booleanequals(java.lang.Object o)Do a comparisonConfigurationNodefindChild(int index)Get child n.voidfromJSON(java.lang.String json)Read from JSON.voidfromXML(java.io.InputStream xmlstream)Read from an XML binary stream.voidfromXML(java.lang.String xml)Read from XML.intgetChildCount()Get child count.inthashCode()Calculate a hash codeprotected voidinitializeFromDoc(XMLDoc doc)voidmakeReadOnly()Make the configuration read-onlyprotected voidprocessObject(java.lang.String key, Configuration.JSONReader x)Process a JSON objectprotected voidprocessObject(ConfigurationNode cn, java.lang.String key, Configuration.JSONReader x)Process a JSON objectprotected ConfigurationNodereadNode(java.lang.String key, Configuration.JSONReader object)Read a node from a json objectprotected ConfigurationNodereadNode(XMLDoc doc, java.lang.Object object)Read a configuration node from XML.voidremoveChild(int index)Remove child n.protected voidremoveOuterNode(ConfigurationNode node)Note the removal of an outer node.java.lang.StringtoJSON()Get as JSON.java.lang.StringtoString()Construct a human-readable stringjava.lang.StringtoXML()Get as XMLprotected static voidwriteNode(XMLDoc doc, java.lang.Object parent, ConfigurationNode node)Write a specification node.protected static voidwriteNode(Configuration.JSONWriter writer, ConfigurationNode node, boolean writeKey, boolean writeSpecialKey)Write a JSON specification node.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
JSON_ATTRIBUTE
protected static final java.lang.String JSON_ATTRIBUTE
- See Also:
- Constant Field Values
-
JSON_VALUE
protected static final java.lang.String JSON_VALUE
- See Also:
- Constant Field Values
-
JSON_CHILDREN
protected static final java.lang.String JSON_CHILDREN
- See Also:
- Constant Field Values
-
JSON_TYPE
protected static final java.lang.String JSON_TYPE
- See Also:
- Constant Field Values
-
rootNodeLabel
protected java.lang.String rootNodeLabel
-
children
protected java.util.List<ConfigurationNode> children
-
readOnly
protected boolean readOnly
-
-
Method Detail
-
createNew
protected Configuration createNew()
Create a new object of the appropriate class.- Returns:
- the newly-created configuration object.
-
createNewNode
protected ConfigurationNode createNewNode(java.lang.String type)
Create a new child node of the appropriate type and class.- Returns:
- the newly-created node.
-
clearOuterNodes
protected void clearOuterNodes()
Note the removal of all outer nodes.
-
addOuterNode
protected void addOuterNode(ConfigurationNode node)
Note the addition of a new outer node.- Parameters:
node- is the node that was just read.
-
removeOuterNode
protected void removeOuterNode(ConfigurationNode node)
Note the removal of an outer node.- Parameters:
node- is the node that was just removed.
-
createDuplicate
protected Configuration createDuplicate(boolean readOnly)
Create a duplicate.
-
makeReadOnly
public void makeReadOnly()
Make the configuration read-only
-
toXML
public java.lang.String toXML() throws ManifoldCFExceptionGet as XML- Returns:
- the xml corresponding to these Configuration.
- Throws:
ManifoldCFException
-
toJSON
public java.lang.String toJSON() throws ManifoldCFExceptionGet as JSON.- Returns:
- the json corresponding to this Configuration.
- Throws:
ManifoldCFException
-
writeNode
protected static void writeNode(XMLDoc doc, java.lang.Object parent, ConfigurationNode node) throws ManifoldCFException
Write a specification node.- Parameters:
doc- is the document.parent- is the parent.node- is the node.- Throws:
ManifoldCFException
-
writeNode
protected static void writeNode(Configuration.JSONWriter writer, ConfigurationNode node, boolean writeKey, boolean writeSpecialKey) throws ManifoldCFException
Write a JSON specification node.- Parameters:
writer- is the JSON writer.node- is the node.writeKey- is true if the key needs to be written, false otherwise.- Throws:
ManifoldCFException
-
fromXML
public void fromXML(java.lang.String xml) throws ManifoldCFExceptionRead from XML.- Parameters:
xml- is the input XML.- Throws:
ManifoldCFException
-
fromJSON
public void fromJSON(java.lang.String json) throws ManifoldCFExceptionRead from JSON.- Parameters:
json- is the input JSON.- Throws:
ManifoldCFException
-
processObject
protected void processObject(java.lang.String key, Configuration.JSONReader x) throws ManifoldCFExceptionProcess a JSON object- Throws:
ManifoldCFException
-
readNode
protected ConfigurationNode readNode(java.lang.String key, Configuration.JSONReader object) throws ManifoldCFException
Read a node from a json object- Throws:
ManifoldCFException
-
processObject
protected void processObject(ConfigurationNode cn, java.lang.String key, Configuration.JSONReader x) throws ManifoldCFException
Process a JSON object- Throws:
ManifoldCFException
-
fromXML
public void fromXML(java.io.InputStream xmlstream) throws ManifoldCFExceptionRead from an XML binary stream.- Parameters:
xmlstream- is the input XML stream. Does NOT close the stream.- Throws:
ManifoldCFException
-
initializeFromDoc
protected void initializeFromDoc(XMLDoc doc) throws ManifoldCFException
- Throws:
ManifoldCFException
-
readNode
protected ConfigurationNode readNode(XMLDoc doc, java.lang.Object object) throws ManifoldCFException
Read a configuration node from XML.- Parameters:
doc- is the document.object- is the object.- Returns:
- the specification node.
- Throws:
ManifoldCFException
-
getChildCount
public int getChildCount()
Get child count.- Specified by:
getChildCountin interfaceIHierarchyParent- Returns:
- the count.
-
findChild
public ConfigurationNode findChild(int index)
Get child n.- Specified by:
findChildin interfaceIHierarchyParent- Parameters:
index- is the child number.- Returns:
- the child node.
-
removeChild
public void removeChild(int index)
Remove child n.- Specified by:
removeChildin interfaceIHierarchyParent- Parameters:
index- is the child to remove.
-
addChild
public void addChild(int index, ConfigurationNode child)Add child at specified position.- Specified by:
addChildin interfaceIHierarchyParent- Parameters:
index- is the position to add the child.child- is the child to add.
-
clearChildren
public void clearChildren()
Clear children.- Specified by:
clearChildrenin interfaceIHierarchyParent
-
hashCode
public int hashCode()
Calculate a hash code- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Do a comparison- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Construct a human-readable string- Overrides:
toStringin classjava.lang.Object
-
-