consciouscode.seedling.config
Class ConfigLoaderSequence

java.lang.Object
  extended by consciouscode.seedling.config.ConfigLoaderSequence
All Implemented Interfaces:
ConfigLoader

public class ConfigLoaderSequence
extends Object
implements ConfigLoader

A composite ConfigLoader that attempts loading a node's ConfigResource from each child loader in sequence. Only the first successful resource is returned.


Constructor Summary
ConfigLoaderSequence()
           
ConfigLoaderSequence(ConfigLoader... loaders)
           
 
Method Summary
 void addLoader(ConfigLoader loader)
           
 ConfigLoader[] getLoaders()
           
 ConfigResource loadConfigResource(ResourceTree resources, NodePath fullPath)
          Returns a configuration resource for a specified node, if one exists in the given resource tree.
 String nodeNameForResource(String resourceName)
          Determines whether the given resource will be used to configure a node, and if so, returns the name of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigLoaderSequence

public ConfigLoaderSequence()

ConfigLoaderSequence

public ConfigLoaderSequence(ConfigLoader... loaders)
Method Detail

getLoaders

public ConfigLoader[] getLoaders()

addLoader

public void addLoader(ConfigLoader loader)

loadConfigResource

public ConfigResource loadConfigResource(ResourceTree resources,
                                         NodePath fullPath)
                                  throws ConfigLoadingException
Description copied from interface: ConfigLoader
Returns a configuration resource for a specified node, if one exists in the given resource tree.

Specified by:
loadConfigResource in interface ConfigLoader
fullPath - identifies the desired node. It must be a full path.
Returns:
null if no configuration resource exists for the node within the resource tree.
Throws:
ConfigLoadingException

nodeNameForResource

public String nodeNameForResource(String resourceName)
Determines whether the given resource will be used to configure a node, and if so, returns the name of the node. Typically a resource must have an extension recognized by one of this factory's ConfigLoaders.

Specified by:
nodeNameForResource in interface ConfigLoader
Parameters:
resourceName - name of a file that may configure a node.
Returns:
the node name, or null if the resource won't configure a node.


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