Package edu.uiuc.ncsa.security.core.cf
Class CFNode
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.cf.CFNode
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAttributeInNode(String nodeName, String attributeName)
Looks for the given node and returns the first attribute.List<String>
getAttributes(String name)
Returns all attributes as strings.List<Boolean>
getBooleanAttributes(String name)
returns the boolean values for the attribute.CFNode
getChildren(String name)
The contract is that this will return all the named children nodes of the given node in order So if the argument is [node0,node1,...] Then result is all the children of node0, followed by all the children of node1,...String
getFirstAttribute(String name)
Get the very first attribute with the given name found in the nodes.boolean
getFirstBooleanAttribute(String attrib)
Get the first attribute and return a boolean.boolean
getFirstBooleanAttribute(String attrib, boolean defaultValue)
Finds the first attribute with the given name and then converts to boolean.long
getFirstLongAttribute(String attrib)
long
getFirstLongAttribute(String attrib, long defaultValue)
Get the first attribute that is a long.CFNode
getFirstNode(String name)
Return the first named child configuration node of the given node or null if there is no such named child.List<Long>
getLongAttributes(String name)
Returns all the long values for the attribute.String
getName()
String
getNodeContents()
Get the contents of the current node.String
getNodeContents(String name)
Convenience method for getting the value of a single node, i.e.String
getNodeContents(String name, String defaultValue)
Convenience method for getting the value of a single named child node, i.e.List<Node>
getNodes()
CFNode
getNodes(String name)
Use this to get all the named nodes off the list.boolean
hasNodes()
void
setNodes(List<Node> nodes)
int
size()
-
-
-
Method Detail
-
size
public int size()
-
hasNodes
public boolean hasNodes()
-
getName
public String getName()
-
getFirstAttribute
public String getFirstAttribute(String name)
Get the very first attribute with the given name found in the nodes. A null is returned if there is no such value.- Parameters:
name
-- Returns:
-
getAttributes
public List<String> getAttributes(String name)
Returns all attributes as strings.- Parameters:
name
-- Returns:
-
getLongAttributes
public List<Long> getLongAttributes(String name)
Returns all the long values for the attribute. This does not flag errors, it just skips them.- Parameters:
name
-- Returns:
-
getBooleanAttributes
public List<Boolean> getBooleanAttributes(String name)
returns the boolean values for the attribute. It does not flag bad ones, it just skips them.- Parameters:
name
-- Returns:
-
getFirstNode
public CFNode getFirstNode(String name)
Return the first named child configuration node of the given node or null if there is no such named child. Very useful if your specification only allows for a single child node.- Parameters:
name
-- Returns:
-
getChildren
public CFNode getChildren(String name)
The contract is that this will return all the named children nodes of the given node in order So if the argument is [node0,node1,...] Then result is all the children of node0, followed by all the children of node1,... Note that you can feed the result of this list back in to get the next level of children.- Returns:
-
getNodes
public CFNode getNodes(String name)
Use this to get all the named nodes off the list. Rather than overrides, this returns the kitchen sink. This is the equivalent of glomming together all of the like-named nodes into one big virtual node. This also gets other nodes in the configuration too so if there are multiple ones in any configuration, they are added in as well.Sometimes this is necessary.
- Parameters:
name
-- Returns:
-
getNodeContents
public String getNodeContents(String name, String defaultValue)
Convenience method for getting the value of a single named child node, i.e. the contents, so
<foo>value</foo>
would have name equal to 'foo' and return the string 'value'. Returns the default value if no such value is found.- Parameters:
name
-defaultValue
-- Returns:
-
getNodeContents
public String getNodeContents()
Get the contents of the current node.- Returns:
-
getNodeContents
public String getNodeContents(String name)
Convenience method for getting the value of a single node, i.e. the contents, so
<foo>value</foo>
would have name equal to 'foo' and return the string 'value'. Returns a null if no such value is found. This is also clever enough to pull things out of CDATA nodes.- Parameters:
name
-- Returns:
-
getFirstBooleanAttribute
public boolean getFirstBooleanAttribute(String attrib, boolean defaultValue)
Finds the first attribute with the given name and then converts to boolean. If the conversion fails, the default is returned. This supports values of true, false, on, off.- Parameters:
attrib
-defaultValue
-- Returns:
-
getFirstBooleanAttribute
public boolean getFirstBooleanAttribute(String attrib)
Get the first attribute and return a boolean. Note that this supports values of true, false, on and off. If no such value is found, an exception is raised.- Parameters:
attrib
-- Returns:
-
getFirstLongAttribute
public long getFirstLongAttribute(String attrib)
-
getFirstLongAttribute
public long getFirstLongAttribute(String attrib, long defaultValue)
Get the first attribute that is a long. If no such attribute, return the default value.- Parameters:
attrib
-defaultValue
-- Returns:
-
-