consciouscode.seedling.config
Interface ConfigEvaluator

All Known Implementing Classes:
PropertiesConfigEvaluator

public interface ConfigEvaluator

Evaluates the content within ConfigResources.

A ConfigEvaluator generally handles a specific file type. A particular file type may have more than one possible evaluator, in which case selection of the evaluator is based upon some data within the resource.


Field Summary
static Object NO_VALUE
          Sentinel value indicating that an evaluator has no evaluation of a requested property.
 
Method Summary
 Object constructNode(ConstructionContext context)
          Creates a new node, ready for injection and decoration.
 Object evaluateProperty(PropertyEvaluationContext context, String property, Class<?> propertyType)
          Evaluates the configuration of a property.
 ConfigResource getInnerConfig(ConfigResource config, Iterable<String> pathParts)
           
 

Field Detail

NO_VALUE

static final Object NO_VALUE
Sentinel value indicating that an evaluator has no evaluation of a requested property. This is used to distinguish between "the result is null" and "there is no result".

Method Detail

getInnerConfig

ConfigResource getInnerConfig(ConfigResource config,
                              Iterable<String> pathParts)
                              throws ConfigurationException
Throws:
ConfigurationException

constructNode

Object constructNode(ConstructionContext context)
                     throws NodeProvisioningException
Creates a new node, ready for injection and decoration.

If the evaluator cannot construct the new node, implementations may delegate to super-configuration resources via ConstructionContext.superConstructNode(). If it does so, this method should not return null, since that causes the framework to do the delegation again.

To provision an alias, this method should return a NodeReference to the target node.

Returns:
the result of the creation configuration, or null if there's no creation configured in this layer, or NO_VALUE if creation is explicitly disabled.
Throws:
NodeProvisioningException

evaluateProperty

Object evaluateProperty(PropertyEvaluationContext context,
                        String property,
                        Class<?> propertyType)
                        throws PropertyEvaluationException
Evaluates the configuration of a property. The configuration resource is provided by the context. If the evaluator and/or the resource cannot provide a definitive value for the property, implementations must generally delegate to prior configuration resources via PropertyEvaluationContext.superEvaluateProperty(java.lang.String, java.lang.Class).

Returns:
the value of the requested property, or NO_VALUE if there's no configuration for the property in any resource layer.
Throws:
PropertyEvaluationException - if anything goes wrong while evaluating the property.


Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.