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 Object
implements ResourceComponent<T>, ConfigurationFacet, CreateChildResourceFacet, DeleteResourceFacet

Author:
Ian Springer, Lukas Krejci

Field Summary
static String AUGEAS_MODULE_NAME_PROP
           
static String AUGEAS_ROOT_PATH_PROP
           
static String DEFAULT_AUGEAS_ROOT_PATH
           
static String EXCLUDE_GLOBS_PROP
           
static String INCLUDE_GLOBS_PROP
           
static String RESOURCE_CONFIGURATION_ROOT_NODE_PROP
           
 
Constructor Summary
AugeasConfigurationComponent()
           
 
Method Summary
 void close()
           
protected  net.augeas.Augeas createAugeas()
           
protected  org.rhq.core.domain.configuration.Property createPropertyList(org.rhq.core.domain.configuration.definition.PropertyDefinitionList propDefList, net.augeas.Augeas augeas, AugeasNode node)
           
protected  org.rhq.core.domain.configuration.PropertyMap createPropertyMap(org.rhq.core.domain.configuration.definition.PropertyDefinitionMap propDefMap, net.augeas.Augeas augeas, AugeasNode node)
           
protected  org.rhq.core.domain.configuration.Property createPropertySimple(org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple, net.augeas.Augeas augeas, AugeasNode node)
           
 CreateResourceReport createResource(CreateResourceReport report)
           
 void deleteResource()
           
protected  void finalize()
           
 net.augeas.Augeas getAugeas()
          Returns initialized augeas instance.
protected  String getAugeasLoadPath()
          Returns the path the augeas library loads the lenses from.
protected  String getAugeasPathRelativeToParent(org.rhq.core.domain.configuration.definition.PropertyDefinition propDef, AugeasNode parentNode, net.augeas.Augeas augeas)
           
protected  String getAugeasRootPath()
           
 org.rhq.core.domain.measurement.AvailabilityType getAvailability()
           
protected  String getChildResourceConfigurationRootLabel(org.rhq.core.domain.resource.ResourceType resourceType, org.rhq.core.domain.configuration.Configuration resourceConfig)
          Subclasses that wish to support child Resource creation must override this method.
protected  String getChildResourceConfigurationRootPath(org.rhq.core.domain.resource.ResourceType resourceType, org.rhq.core.domain.configuration.Configuration resourceConfig)
          Subclasses that wish to support child Resource creation must override this method.
 List<File> getConfigurationFiles()
           
protected  AugeasNode getExistingChildNodeForListMemberPropertyMap(AugeasNode parentNode, org.rhq.core.domain.configuration.definition.PropertyDefinitionList propDefList, org.rhq.core.domain.configuration.PropertyMap propMap)
           
protected  AugeasNode getNewListMemberNode(AugeasNode listNode, org.rhq.core.domain.configuration.definition.PropertyDefinitionMap listMemberPropDefMap, int listIndex)
           
protected  String getNodeInsertionPoint(net.augeas.Augeas augeas, AugeasNode node, org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple, org.rhq.core.domain.configuration.PropertySimple propSimple)
           
protected  String getResourceConfigurationRootPath()
           
 ResourceContext<T> getResourceContext()
           
 String getResourceDescription()
           
protected  void initAugeas()
           
protected  boolean isAugeasAvailable()
           
protected  void loadProperty(org.rhq.core.domain.configuration.definition.PropertyDefinition propDef, org.rhq.core.domain.configuration.AbstractPropertyMap parentPropMap, net.augeas.Augeas augeas, AugeasNode parentNode)
           
 org.rhq.core.domain.configuration.Configuration loadResourceConfiguration()
           
protected  void populatePropertyMap(org.rhq.core.domain.configuration.definition.PropertyDefinitionMap propDefMap, org.rhq.core.domain.configuration.PropertyMap propMap, net.augeas.Augeas augeas, AugeasNode mapNode)
           
protected  void setNode(org.rhq.core.domain.configuration.definition.PropertyDefinition propDef, org.rhq.core.domain.configuration.AbstractPropertyMap parentPropMap, net.augeas.Augeas augeas, AugeasNode parentNode)
           
protected  void setNodeFromPropertyList(org.rhq.core.domain.configuration.definition.PropertyDefinitionList propDefList, org.rhq.core.domain.configuration.PropertyList propList, net.augeas.Augeas augeas, AugeasNode listNode)
           
protected  void setNodeFromPropertyMap(org.rhq.core.domain.configuration.definition.PropertyDefinitionMap propDefMap, org.rhq.core.domain.configuration.PropertyMap propMap, net.augeas.Augeas augeas, AugeasNode mapNode)
           
protected  void setNodeFromPropertySimple(net.augeas.Augeas augeas, AugeasNode node, org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple, org.rhq.core.domain.configuration.PropertySimple propSimple)
           
protected  void setupAugeasModules(net.augeas.Augeas augeas)
           
 void start(ResourceContext<T> resourceContext)
           
 void stop()
           
protected  String summarizeAugeasError(net.augeas.Augeas augeas)
           
protected  String toNodeValue(net.augeas.Augeas augeas, AugeasNode node, org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple, org.rhq.core.domain.configuration.PropertySimple propSimple)
           
protected  Object toPropertyValue(org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple, net.augeas.Augeas augeas, AugeasNode node)
           
 void updateResourceConfiguration(ConfigurationUpdateReport report)
           
protected  void updateStructuredConfiguration(org.rhq.core.domain.configuration.Configuration config)
           
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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INCLUDE_GLOBS_PROP

public static final String INCLUDE_GLOBS_PROP
See Also:
Constant Field Values

EXCLUDE_GLOBS_PROP

public static final String EXCLUDE_GLOBS_PROP
See Also:
Constant Field Values

RESOURCE_CONFIGURATION_ROOT_NODE_PROP

public static final String RESOURCE_CONFIGURATION_ROOT_NODE_PROP
See Also:
Constant Field Values

AUGEAS_MODULE_NAME_PROP

public static final String AUGEAS_MODULE_NAME_PROP
See Also:
Constant Field Values

AUGEAS_ROOT_PATH_PROP

public static final String AUGEAS_ROOT_PATH_PROP
See Also:
Constant Field Values

DEFAULT_AUGEAS_ROOT_PATH

public static final String DEFAULT_AUGEAS_ROOT_PATH
Constructor Detail

AugeasConfigurationComponent

public AugeasConfigurationComponent()
Method Detail

getAugeasRootPath

protected String getAugeasRootPath()

getAugeasLoadPath

protected String getAugeasLoadPath()
Returns the path the augeas library loads the lenses from.

Returns:

start

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

stop

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

getAvailability

public org.rhq.core.domain.measurement.AvailabilityType getAvailability()
Specified by:
getAvailability in interface AvailabilityFacet

loadResourceConfiguration

public org.rhq.core.domain.configuration.Configuration loadResourceConfiguration()
                                                                          throws Exception
Specified by:
loadResourceConfiguration in interface ConfigurationFacet
Throws:
Exception

updateStructuredConfiguration

protected void updateStructuredConfiguration(org.rhq.core.domain.configuration.Configuration config)
                                      throws Exception
Throws:
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 Exception
Specified by:
deleteResource in interface DeleteResourceFacet
Throws:
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,
                                                                  org.rhq.core.domain.configuration.definition.PropertyDefinitionList propDefList,
                                                                  org.rhq.core.domain.configuration.PropertyMap propMap)

getResourceConfigurationRootPath

@NotNull
protected String getResourceConfigurationRootPath()

getChildResourceConfigurationRootPath

protected String getChildResourceConfigurationRootPath(org.rhq.core.domain.resource.ResourceType resourceType,
                                                       org.rhq.core.domain.configuration.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 String getChildResourceConfigurationRootLabel(org.rhq.core.domain.resource.ResourceType resourceType,
                                                        org.rhq.core.domain.configuration.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 String getResourceDescription()

getConfigurationFiles

public List<File> getConfigurationFiles()

getAugeas

public net.augeas.Augeas getAugeas()
Returns initialized augeas instance. Augeas instance must be closed by calling method close on the Augeas instance or by calling method close on AugeasConfigurationComponent instance after use of augeas.

Returns:

setupAugeasModules

protected void setupAugeasModules(net.augeas.Augeas augeas)

createAugeas

protected net.augeas.Augeas createAugeas()

isAugeasAvailable

protected boolean isAugeasAvailable()

getAugeasPathRelativeToParent

protected String getAugeasPathRelativeToParent(org.rhq.core.domain.configuration.definition.PropertyDefinition propDef,
                                               AugeasNode parentNode,
                                               net.augeas.Augeas augeas)

loadProperty

protected void loadProperty(org.rhq.core.domain.configuration.definition.PropertyDefinition propDef,
                            org.rhq.core.domain.configuration.AbstractPropertyMap parentPropMap,
                            net.augeas.Augeas augeas,
                            AugeasNode parentNode)

toPropertyValue

protected Object toPropertyValue(org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple,
                                 net.augeas.Augeas augeas,
                                 AugeasNode node)

createPropertySimple

protected org.rhq.core.domain.configuration.Property createPropertySimple(org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple,
                                                                          net.augeas.Augeas augeas,
                                                                          AugeasNode node)

createPropertyMap

protected org.rhq.core.domain.configuration.PropertyMap createPropertyMap(org.rhq.core.domain.configuration.definition.PropertyDefinitionMap propDefMap,
                                                                          net.augeas.Augeas augeas,
                                                                          AugeasNode node)

createPropertyList

protected org.rhq.core.domain.configuration.Property createPropertyList(org.rhq.core.domain.configuration.definition.PropertyDefinitionList propDefList,
                                                                        net.augeas.Augeas augeas,
                                                                        AugeasNode node)

populatePropertyMap

protected void populatePropertyMap(org.rhq.core.domain.configuration.definition.PropertyDefinitionMap propDefMap,
                                   org.rhq.core.domain.configuration.PropertyMap propMap,
                                   net.augeas.Augeas augeas,
                                   AugeasNode mapNode)

setNode

protected void setNode(org.rhq.core.domain.configuration.definition.PropertyDefinition propDef,
                       org.rhq.core.domain.configuration.AbstractPropertyMap parentPropMap,
                       net.augeas.Augeas augeas,
                       AugeasNode parentNode)

toNodeValue

protected String toNodeValue(net.augeas.Augeas augeas,
                             AugeasNode node,
                             org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple,
                             org.rhq.core.domain.configuration.PropertySimple propSimple)

getNodeInsertionPoint

protected String getNodeInsertionPoint(net.augeas.Augeas augeas,
                                       AugeasNode node,
                                       org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple,
                                       org.rhq.core.domain.configuration.PropertySimple propSimple)

setNodeFromPropertySimple

protected void setNodeFromPropertySimple(net.augeas.Augeas augeas,
                                         AugeasNode node,
                                         org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple propDefSimple,
                                         org.rhq.core.domain.configuration.PropertySimple propSimple)

setNodeFromPropertyMap

protected void setNodeFromPropertyMap(org.rhq.core.domain.configuration.definition.PropertyDefinitionMap propDefMap,
                                      org.rhq.core.domain.configuration.PropertyMap propMap,
                                      net.augeas.Augeas augeas,
                                      AugeasNode mapNode)

setNodeFromPropertyList

protected void setNodeFromPropertyList(org.rhq.core.domain.configuration.definition.PropertyDefinitionList propDefList,
                                       org.rhq.core.domain.configuration.PropertyList propList,
                                       net.augeas.Augeas augeas,
                                       AugeasNode listNode)

getNewListMemberNode

protected AugeasNode getNewListMemberNode(AugeasNode listNode,
                                          org.rhq.core.domain.configuration.definition.PropertyDefinitionMap listMemberPropDefMap,
                                          int listIndex)

summarizeAugeasError

protected String summarizeAugeasError(net.augeas.Augeas augeas)

initAugeas

protected void initAugeas()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

close

public void close()


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