consciouscode.seedling.config
Interface ConfigResource

All Known Implementing Classes:
ImplicitBranchConfigResource, PropertiesConfigResource

public interface ConfigResource

A single configuration resource for a node. This is typically a Resource such as a .properties or .xml file, but it could be a portion of a larger resource, or data stored in some custom fashion.

A ConfigResource is responsible for understanding the basic syntax of a particular file type, but it does not define the final semantics of the content. That responsibility falls to a ConfigEvaluator (specifically, the one returned by getEvaluator(NodeReference). This decoupling allows one file type to support many different semantic interpretations, including different versions of a single syntax. For example, some part of the file could specify what configuration language it supports.

Implementations must be thread-safe.


Method Summary
 ConfigEvaluator getEvaluator(NodeReference location)
          Returns the evaluator being used by this resource.
 String getIdentifier()
          Returns a string identifying this resource, for use in messages.
 Resource getResource()
          Gets the underlying resource from which this configuration is loaded.
 void writeConfiguration(Writer out)
          Prints the content of this resource to a stream.
 

Method Detail

getResource

Resource getResource()
Gets the underlying resource from which this configuration is loaded.

Returns:
may be null.

getIdentifier

String getIdentifier()
Returns a string identifying this resource, for use in messages.

Returns:
an identifying string, or null if one is not available.

getEvaluator

ConfigEvaluator getEvaluator(NodeReference location)
                             throws ConfigurationException
Returns the evaluator being used by this resource. The evaluator depends on the kind of resource, and possibly on the contents of the resource as well.

Parameters:
location - identifies the node being configured.
Returns:
the evaluator for this resource; not null.
Throws:
ConfigurationException - if no evaluator could be located.

writeConfiguration

void writeConfiguration(Writer out)
                        throws IOException
Prints the content of this resource to a stream.

Parameters:
out - the stream to get the configuration content.
Throws:
NullPointerException - if out is null.
IOException - if it's thrown by out.


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