org.rhq.plugins.augeas
Class AugeasConfigurationComponent<T extends ResourceComponent>

java.lang.Object
  extended by org.rhq.plugins.augeas.AugeasConfigurationComponent<T>
All Implemented Interfaces:
AvailabilityFacet, ConfigurationFacet, CreateChildResourceFacet, DeleteResourceFacet, ResourceComponent<T>

public class AugeasConfigurationComponent<T extends ResourceComponent>
extends java.lang.Object
implements ResourceComponent<T>, ConfigurationFacet, CreateChildResourceFacet, DeleteResourceFacet

Author:
Ian Springer, Lukas Krejci

Field Summary
static java.lang.String AUGEAS_MODULE_NAME_PROP
           
static java.lang.String AUGEAS_ROOT_PATH_PROP
           
static java.lang.String DEFAULT_AUGEAS_ROOT_PATH
           
static java.lang.String EXCLUDE_GLOBS_PROP
           
static java.lang.String INCLUDE_GLOBS_PROP
           
static java.lang.String RESOURCE_CONFIGURATION_ROOT_NODE_PROP
           
 
Constructor Summary
AugeasConfigurationComponent()
           
 
Method Summary
protected  Property createPropertyList(PropertyDefinitionList propDefList, net.augeas.Augeas augeas, AugeasNode node)
           
protected  PropertyMap createPropertyMap(PropertyDefinitionMap propDefMap, net.augeas.Augeas augeas, AugeasNode node)
           
protected  Property createPropertySimple(PropertyDefinitionSimple propDefSimple, net.augeas.Augeas augeas, AugeasNode node)
           
 CreateResourceReport createResource(CreateResourceReport report)
           
 void deleteResource()
           
 net.augeas.Augeas getAugeas()
           
protected  java.lang.String getAugeasPathRelativeToParent(PropertyDefinition propDef, AugeasNode parentNode, net.augeas.Augeas augeas)
           
 AvailabilityType getAvailability()
           
protected  java.lang.String getChildResourceConfigurationRootLabel(ResourceType resourceType, Configuration resourceConfig)
          Subclasses that wish to support child Resource creation must override this method.
protected  java.lang.String getChildResourceConfigurationRootPath(ResourceType resourceType, Configuration resourceConfig)
          Subclasses that wish to support child Resource creation must override this method.
 java.util.List<java.io.File> getConfigurationFiles()
           
protected  AugeasNode getExistingChildNodeForListMemberPropertyMap(AugeasNode parentNode, PropertyDefinitionList propDefList, PropertyMap propMap)
           
protected  AugeasNode getNewListMemberNode(AugeasNode listNode, PropertyDefinitionMap listMemberPropDefMap, int listIndex)
           
protected  java.lang.String getNodeInsertionPoint(net.augeas.Augeas augeas, AugeasNode node, PropertyDefinitionSimple propDefSimple, PropertySimple propSimple)
           
protected  java.lang.String getResourceConfigurationRootPath()
           
 ResourceContext<T> getResourceContext()
           
 java.lang.String getResourceDescription()
           
protected  void initAugeas()
           
protected  boolean isAugeasAvailable()
           
protected  void loadProperty(PropertyDefinition propDef, AbstractPropertyMap parentPropMap, net.augeas.Augeas augeas, AugeasNode parentNode)
           
 Configuration loadResourceConfiguration()
           
protected  void populatePropertyMap(PropertyDefinitionMap propDefMap, PropertyMap propMap, net.augeas.Augeas augeas, AugeasNode mapNode)
           
protected  void setNode(PropertyDefinition propDef, AbstractPropertyMap parentPropMap, net.augeas.Augeas augeas, AugeasNode parentNode)
           
protected  void setNodeFromPropertyList(PropertyDefinitionList propDefList, PropertyList propList, net.augeas.Augeas augeas, AugeasNode listNode)
           
protected  void setNodeFromPropertyMap(PropertyDefinitionMap propDefMap, PropertyMap propMap, net.augeas.Augeas augeas, AugeasNode mapNode)
           
protected  void setNodeFromPropertySimple(net.augeas.Augeas augeas, AugeasNode node, PropertyDefinitionSimple propDefSimple, PropertySimple propSimple)
           
 void start(ResourceContext<T> resourceContext)
           
 void stop()
           
protected  java.lang.String summarizeAugeasError(net.augeas.Augeas augeas)
           
protected  java.lang.String toNodeValue(net.augeas.Augeas augeas, AugeasNode node, PropertyDefinitionSimple propDefSimple, PropertySimple propSimple)
           
protected  java.lang.Object toPropertyValue(PropertyDefinitionSimple propDefSimple, net.augeas.Augeas augeas, AugeasNode node)
           
 void updateResourceConfiguration(ConfigurationUpdateReport report)
           
protected  boolean validateResourceConfiguration(ConfigurationUpdateReport report)
          Subclasses should override this method in order to perform any validation that is not encapsulated in the Configuration metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INCLUDE_GLOBS_PROP

public static final java.lang.String INCLUDE_GLOBS_PROP
See Also:
Constant Field Values

EXCLUDE_GLOBS_PROP

public static final java.lang.String EXCLUDE_GLOBS_PROP
See Also:
Constant Field Values

RESOURCE_CONFIGURATION_ROOT_NODE_PROP

public static final java.lang.String RESOURCE_CONFIGURATION_ROOT_NODE_PROP
See Also:
Constant Field Values

AUGEAS_MODULE_NAME_PROP

public static final java.lang.String AUGEAS_MODULE_NAME_PROP
See Also:
Constant Field Values

AUGEAS_ROOT_PATH_PROP

public static final java.lang.String AUGEAS_ROOT_PATH_PROP
See Also:
Constant Field Values

DEFAULT_AUGEAS_ROOT_PATH

public static final java.lang.String DEFAULT_AUGEAS_ROOT_PATH
Constructor Detail

AugeasConfigurationComponent

public AugeasConfigurationComponent()
Method Detail

start

public void start(ResourceContext<T> resourceContext)
           throws InvalidPluginConfigurationException,
                  java.lang.Exception
Specified by:
start in interface ResourceComponent<T extends ResourceComponent>
Throws:
InvalidPluginConfigurationException
java.lang.Exception

stop

public void stop()
Specified by:
stop in interface ResourceComponent<T extends ResourceComponent>

getAvailability

public AvailabilityType getAvailability()
Specified by:
getAvailability in interface AvailabilityFacet

loadResourceConfiguration

public Configuration loadResourceConfiguration()
                                        throws java.lang.Exception
Specified by:
loadResourceConfiguration in interface ConfigurationFacet
Throws:
java.lang.Exception

updateResourceConfiguration

public void updateResourceConfiguration(ConfigurationUpdateReport report)
Specified by:
updateResourceConfiguration in interface ConfigurationFacet

createResource

public CreateResourceReport createResource(CreateResourceReport report)
Specified by:
createResource in interface CreateChildResourceFacet

deleteResource

public void deleteResource()
                    throws java.lang.Exception
Specified by:
deleteResource in interface DeleteResourceFacet
Throws:
java.lang.Exception

validateResourceConfiguration

protected boolean validateResourceConfiguration(ConfigurationUpdateReport report)
Subclasses should override this method in order to perform any validation that is not encapsulated in the Configuration metadata.

Parameters:
report - the report to which any validation errors should be added
Returns:
true if the Configuration is valid, or false if it is not

getExistingChildNodeForListMemberPropertyMap

protected AugeasNode getExistingChildNodeForListMemberPropertyMap(AugeasNode parentNode,
                                                                  PropertyDefinitionList propDefList,
                                                                  PropertyMap propMap)

getResourceConfigurationRootPath

@NotNull
protected java.lang.String getResourceConfigurationRootPath()

getChildResourceConfigurationRootPath

protected java.lang.String getChildResourceConfigurationRootPath(ResourceType resourceType,
                                                                 Configuration resourceConfig)
Subclasses that wish to support child Resource creation must override this method.

Parameters:
resourceType - the type of child Resource being created
resourceConfig - the Resource configuration for the child Resource being created
Returns:
the path of the Augeas node that should be created for the child Resource being created

getChildResourceConfigurationRootLabel

protected java.lang.String getChildResourceConfigurationRootLabel(ResourceType resourceType,
                                                                  Configuration resourceConfig)
Subclasses that wish to support child Resource creation must override this method.

Parameters:
resourceType - the type of child Resource being created
resourceConfig - the Resource configuration for the child Resource being created
Returns:
the value of the Augeas node that should be created for the child Resource being created

getResourceContext

public ResourceContext<T> getResourceContext()

getResourceDescription

public java.lang.String getResourceDescription()

getConfigurationFiles

public java.util.List<java.io.File> getConfigurationFiles()

getAugeas

public net.augeas.Augeas getAugeas()

isAugeasAvailable

protected boolean isAugeasAvailable()

getAugeasPathRelativeToParent

protected java.lang.String getAugeasPathRelativeToParent(PropertyDefinition propDef,
                                                         AugeasNode parentNode,
                                                         net.augeas.Augeas augeas)

loadProperty

protected void loadProperty(PropertyDefinition propDef,
                            AbstractPropertyMap parentPropMap,
                            net.augeas.Augeas augeas,
                            AugeasNode parentNode)

toPropertyValue

protected java.lang.Object toPropertyValue(PropertyDefinitionSimple propDefSimple,
                                           net.augeas.Augeas augeas,
                                           AugeasNode node)

createPropertySimple

protected Property createPropertySimple(PropertyDefinitionSimple propDefSimple,
                                        net.augeas.Augeas augeas,
                                        AugeasNode node)

createPropertyMap

protected PropertyMap createPropertyMap(PropertyDefinitionMap propDefMap,
                                        net.augeas.Augeas augeas,
                                        AugeasNode node)

createPropertyList

protected Property createPropertyList(PropertyDefinitionList propDefList,
                                      net.augeas.Augeas augeas,
                                      AugeasNode node)

populatePropertyMap

protected void populatePropertyMap(PropertyDefinitionMap propDefMap,
                                   PropertyMap propMap,
                                   net.augeas.Augeas augeas,
                                   AugeasNode mapNode)

setNode

protected void setNode(PropertyDefinition propDef,
                       AbstractPropertyMap parentPropMap,
                       net.augeas.Augeas augeas,
                       AugeasNode parentNode)

toNodeValue

protected java.lang.String toNodeValue(net.augeas.Augeas augeas,
                                       AugeasNode node,
                                       PropertyDefinitionSimple propDefSimple,
                                       PropertySimple propSimple)

getNodeInsertionPoint

protected java.lang.String getNodeInsertionPoint(net.augeas.Augeas augeas,
                                                 AugeasNode node,
                                                 PropertyDefinitionSimple propDefSimple,
                                                 PropertySimple propSimple)

setNodeFromPropertySimple

protected void setNodeFromPropertySimple(net.augeas.Augeas augeas,
                                         AugeasNode node,
                                         PropertyDefinitionSimple propDefSimple,
                                         PropertySimple propSimple)

setNodeFromPropertyMap

protected void setNodeFromPropertyMap(PropertyDefinitionMap propDefMap,
                                      PropertyMap propMap,
                                      net.augeas.Augeas augeas,
                                      AugeasNode mapNode)

setNodeFromPropertyList

protected void setNodeFromPropertyList(PropertyDefinitionList propDefList,
                                       PropertyList propList,
                                       net.augeas.Augeas augeas,
                                       AugeasNode listNode)

getNewListMemberNode

protected AugeasNode getNewListMemberNode(AugeasNode listNode,
                                          PropertyDefinitionMap listMemberPropDefMap,
                                          int listIndex)

summarizeAugeasError

protected java.lang.String summarizeAugeasError(net.augeas.Augeas augeas)

initAugeas

protected void initAugeas()


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