org.rhq.augeas.tree
Interface AugeasTree

All Known Implementing Classes:
AbstractAugeasTree, AugeasTreeLazy, AugeasTreeReal

public interface AugeasTree

Represents the augeas tree.

Author:
Filip Drabek

Field Summary
static String AUGEAS_DATA_PATH
          All the paths to nodes representing configuration data in Augeas are prefixed by this.
static char PATH_SEPARATOR
          Path separator in the Augeas expressions.
 
Method Summary
 AugeasNode createNode(AugeasNode parentNode, String name, String value, int seq)
          Creates a new child node under given parent.
 AugeasNode createNode(String fullPath)
          Creates a new node on given path.
 String get(String expr)
          Returns a value of the first node matching the expression.
 File getFile(AugeasNode node)
           
 AugeasNode getNode(String path)
          Checks whether a node exists on given path.
 AugeasNode getRootNode()
           
 List<AugeasNode> match(String expression)
          Performs a search using Augeas expression on the tree.
 List<AugeasNode> matchRelative(AugeasNode node, String expression)
          Performs a search using Augeas expression on the tree starting at given node.
 void removeNode(AugeasNode node, boolean updateSeq)
          Removes the node from the tree optionally updating the sequence numbers of its siblings.
 void save()
          Persists the tree using Augeas to the individual files.
 void setRootNode(AugeasNode node)
          Sets the root node.
 void setValue(AugeasNode node, String value)
          Sets the value of the node directly in Augeas, bypassing the in-memory tree representation.
 String summarizeAugeasError()
           
 

Field Detail

PATH_SEPARATOR

static final char PATH_SEPARATOR
Path separator in the Augeas expressions.

See Also:
Constant Field Values

AUGEAS_DATA_PATH

static final String AUGEAS_DATA_PATH
All the paths to nodes representing configuration data in Augeas are prefixed by this.

See Also:
Constant Field Values
Method Detail

save

void save()
Persists the tree using Augeas to the individual files.


getNode

AugeasNode getNode(String path)
                   throws AugeasTreeException
Checks whether a node exists on given path. If it exists, the node is returned otherwise a new one is created and returned.

Parameters:
path - the path to look for
Returns:
the node on given path
Throws:
AugeasTreeException

match

List<AugeasNode> match(String expression)
                       throws AugeasTreeException
Performs a search using Augeas expression on the tree.

Parameters:
expression -
Returns:
list of nodes matching the expression
Throws:
AugeasTreeException

matchRelative

List<AugeasNode> matchRelative(AugeasNode node,
                               String expression)
                               throws AugeasTreeException
Performs a search using Augeas expression on the tree starting at given node.

Parameters:
node - the node to start searching from
expression - the expression
Returns:
list of child nodes matching the expressions
Throws:
AugeasTreeException

createNode

AugeasNode createNode(String fullPath)
                      throws AugeasTreeException
Creates a new node on given path. If there already exists a node on given path, it is returned instead.

Parameters:
fullPath -
Returns:
Throws:
AugeasTreeException

createNode

AugeasNode createNode(AugeasNode parentNode,
                      String name,
                      String value,
                      int seq)
                      throws AugeasTreeException
Creates a new child node under given parent.

Parameters:
parentNode - the parent node
name - name of the child node
value - value of the child node
seq - the sequence number of the child node
Returns:
the child nodes
Throws:
AugeasTreeException

get

String get(String expr)
Returns a value of the first node matching the expression. Akin to Augeas.get(String).

Parameters:
expr - the Augeas expression.
Returns:
the value

getRootNode

AugeasNode getRootNode()
Returns:
returns the root node of the tree.

removeNode

void removeNode(AugeasNode node,
                boolean updateSeq)
                throws AugeasTreeException
Removes the node from the tree optionally updating the sequence numbers of its siblings.

Parameters:
node - the node to remove
updateSeq - whether to update sequence numbers or not.
Throws:
AugeasTreeException

setValue

void setValue(AugeasNode node,
              String value)
Sets the value of the node directly in Augeas, bypassing the in-memory tree representation.

Parameters:
node -
value -

getFile

File getFile(AugeasNode node)
Parameters:
node -
Returns:
the file in which the configuration represented by the node is defined.

summarizeAugeasError

String summarizeAugeasError()
Returns:
a summary of an update error obtained from the Augeas library.

setRootNode

void setRootNode(AugeasNode node)
Sets the root node.

Parameters:
node -


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.