de.smartics.ci.config.load
Class LocationManager

Package class diagram package LocationManager
java.lang.Object
  extended by de.smartics.ci.config.load.LocationManager

public final class LocationManager
     
     
extends Object

Manages locations to look for configuration files to load.


Constructor Summary
LocationManager()
          Convenience constructor if no class loader should be used as a parent.
LocationManager(ClassLoader parentClassLoader)
          Default constructor.
 
Method Summary
 void addLocation(File file)
          Adds a file location to the manager to search for configuration files.
 void addLocation(URL url)
          Adds an URL location to the manager to search for configuration files.
 InputSource open(String resource)
          Opens a stream to the given resource, if the resource can be found at any location managed by this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationManager

public LocationManager()
Convenience constructor if no class loader should be used as a parent.


LocationManager

public LocationManager(ClassLoader parentClassLoader)
Default constructor.

Parameters:
parentClassLoader - the parent class loader to delegate requests to. May be null.
Method Detail

addLocation

public void addLocation(File file)
                 throws NullPointerException,
                        IllegalArgumentException
Adds a file location to the manager to search for configuration files.

Parameters:
file - the file location to be added. May reference a folder or a JAR file.
Throws:
NullPointerException - if file is null.
IllegalArgumentException - if file does not provide a valid URL.

addLocation

public void addLocation(URL url)
Adds an URL location to the manager to search for configuration files.

Parameters:
url - the URL location to be added. May reference a folder or a JAR file.

open

public InputSource open(String resource)
                 throws FileNotFoundException
Opens a stream to the given resource, if the resource can be found at any location managed by this instance.

The client is responsible to close the resource.

Parameters:
resource - the resource to open.
Returns:
the stream to the resource as an input source.
Throws:
FileNotFoundException - if the resource cannot be opened.


Copyright © 2012 Kronseder & Reiner GmbH - smartics. All Rights Reserved.