org.rhq.augeas.tree.impl
Class AbstractAugeasTree

java.lang.Object
  extended by org.rhq.augeas.tree.impl.AbstractAugeasTree
All Implemented Interfaces:
AugeasTree
Direct Known Subclasses:
AugeasTreeLazy, AugeasTreeReal

public abstract class AbstractAugeasTree
extends Object
implements AugeasTree

Abstract base class implementing the basic set of methods of the tree.

Author:
Filip Drabek, Lukas Krejci

Field Summary
 
Fields inherited from interface org.rhq.augeas.tree.AugeasTree
AUGEAS_DATA_PATH, PATH_SEPARATOR
 
Constructor Summary
protected AbstractAugeasTree(net.augeas.Augeas ag, AugeasModuleConfig moduleConfig)
           
 
Method Summary
 AugeasNode createNode(AugeasNode parentNode, String name, String value, int seq)
          Creates a new child node under given parent.
 String get(String expr)
          Returns a value of the first node matching the expression.
protected  net.augeas.Augeas getAugeas()
           
 File getFile(AugeasNode node)
           
protected  List<String> getIncludeGlobs()
           
protected  AugeasNode getLoadedNode(String path)
          Returns the node on given path or null if it wasn't loaded yet.
protected  AugeasModuleConfig getModuleConfig()
           
 AugeasNode getNode(String path)
          Checks whether a node exists on given path.
protected  AugeasNodeBuffer getNodeBuffer()
           
 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 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rhq.augeas.tree.AugeasTree
createNode, removeNode
 

Constructor Detail

AbstractAugeasTree

protected AbstractAugeasTree(net.augeas.Augeas ag,
                             AugeasModuleConfig moduleConfig)
Method Detail

getAugeas

protected net.augeas.Augeas getAugeas()

getModuleConfig

protected AugeasModuleConfig getModuleConfig()

getNodeBuffer

protected AugeasNodeBuffer getNodeBuffer()

createNode

public AugeasNode createNode(AugeasNode parentNode,
                             String name,
                             String value,
                             int seq)
                      throws AugeasTreeException
Description copied from interface: AugeasTree
Creates a new child node under given parent.

Specified by:
createNode in interface AugeasTree
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

public String get(String expr)
Description copied from interface: AugeasTree
Returns a value of the first node matching the expression. Akin to Augeas.get(String).

Specified by:
get in interface AugeasTree
Parameters:
expr - the Augeas expression.
Returns:
the value

getFile

public File getFile(AugeasNode node)
Specified by:
getFile in interface AugeasTree
Returns:
the file in which the configuration represented by the node is defined.

getNode

public AugeasNode getNode(String path)
                   throws AugeasTreeException
Description copied from interface: AugeasTree
Checks whether a node exists on given path. If it exists, the node is returned otherwise a new one is created and returned.

Specified by:
getNode in interface AugeasTree
Parameters:
path - the path to look for
Returns:
the node on given path
Throws:
AugeasTreeException

getRootNode

public AugeasNode getRootNode()
Specified by:
getRootNode in interface AugeasTree
Returns:
returns the root node of the tree.

match

public List<AugeasNode> match(String expression)
                       throws AugeasTreeException
Description copied from interface: AugeasTree
Performs a search using Augeas expression on the tree.

Specified by:
match in interface AugeasTree
Returns:
list of nodes matching the expression
Throws:
AugeasTreeException

matchRelative

public List<AugeasNode> matchRelative(AugeasNode node,
                                      String expression)
                               throws AugeasTreeException
Description copied from interface: AugeasTree
Performs a search using Augeas expression on the tree starting at given node.

Specified by:
matchRelative in interface AugeasTree
Parameters:
node - the node to start searching from
expression - the expression
Returns:
list of child nodes matching the expressions
Throws:
AugeasTreeException

save

public void save()
Description copied from interface: AugeasTree
Persists the tree using Augeas to the individual files.

Specified by:
save in interface AugeasTree

setRootNode

public void setRootNode(AugeasNode node)
Description copied from interface: AugeasTree
Sets the root node.

Specified by:
setRootNode in interface AugeasTree

setValue

public void setValue(AugeasNode node,
                     String value)
Description copied from interface: AugeasTree
Sets the value of the node directly in Augeas, bypassing the in-memory tree representation.

Specified by:
setValue in interface AugeasTree

summarizeAugeasError

public String summarizeAugeasError()
Specified by:
summarizeAugeasError in interface AugeasTree
Returns:
a summary of an update error obtained from the Augeas library.

getLoadedNode

protected AugeasNode getLoadedNode(String path)
Returns the node on given path or null if it wasn't loaded yet.

Parameters:
path -
Returns:

getIncludeGlobs

protected List<String> getIncludeGlobs()


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