org.globus.gridshib.common
Class StringMapDir

java.lang.Object
  extended by org.globus.gridshib.common.LoadableResource
      extended by org.globus.gridshib.common.StringMapDir
All Implemented Interfaces:
Loadable
Direct Known Subclasses:
EntityMapDir

public class StringMapDir
extends LoadableResource

An implementation of the Loadable interface for directories of StringMapFile objects.

See Also:
Loadable, LoadableResource

Field Summary
 
Fields inherited from class org.globus.gridshib.common.LoadableResource
lastLoaded, loaded, resource
 
Constructor Summary
StringMapDir(File dir)
          The primary constructor for creating an instance of StringMapDir.
StringMapDir(String pathname)
          A convenience constructor that simply converts its String argument into a File object, and then calls the corresponding constructor.
StringMapDir(URI uri)
          A convenience constructor that simply converts its URI argument into a File object, and then calls the corresponding constructor.
 
Method Summary
 String get(String key)
          Gets the string value that corresponds to the given key.
static StringMapDir getInstance(File dir)
          Gets the instance of StringMapDir that corresponds to the given directory.
static StringMapDir getInstance(String pathname)
          Creates a File object from the given pathname and invokes #getInstance(File).
static StringMapDir getInstance(URI uri)
          Creates a File object from the given URI instance and invokes #getInstance(File).
 Set getKeySet()
          Gets all the (String) keys associated with this instance.
 void load()
          Loads the directory and calls #resetLastLoaded().
 
Methods inherited from class org.globus.gridshib.common.LoadableResource
getLastLoaded, getResource, isLoaded, isStale, resetLastLoaded, toURL, toURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMapDir

public StringMapDir(URI uri)
             throws LoadException
A convenience constructor that simply converts its URI argument into a File object, and then calls the corresponding constructor.

Throws:
LoadException

StringMapDir

public StringMapDir(String pathname)
             throws LoadException
A convenience constructor that simply converts its String argument into a File object, and then calls the corresponding constructor.

Throws:
LoadException

StringMapDir

public StringMapDir(File dir)
             throws LoadException
The primary constructor for creating an instance of StringMapDir. Captures the given File object and loads the directory.

Throws:
LoadException
Method Detail

getInstance

public static StringMapDir getInstance(URI uri)
                                throws LoadException
Creates a File object from the given URI instance and invokes #getInstance(File).

Parameters:
uri - the URI of the directory that backs this instance of StringMapDir
Returns:
the one and only one StringMapDir instance that corresponds to the given URI
Throws:
LoadException - if a new instance of StringMapDir is required but the directory fails to load

getInstance

public static StringMapDir getInstance(String pathname)
                                throws LoadException
Creates a File object from the given pathname and invokes #getInstance(File).

Parameters:
pathname - the pathname of the directory that backs this instance of StringMapDir
Returns:
the one and only one StringMapDir instance that corresponds to the given pathname
Throws:
LoadException - if a new instance of StringMapDir is required but the directory fails to load

getInstance

public static StringMapDir getInstance(File dir)
                                throws LoadException
Gets the instance of StringMapDir that corresponds to the given directory. Such an instance may have been created previously, in which case that instance is returned directly. Otherwise, a new instance of StringMapDir is created and returned.

Use of this method (as opposed to direct use of the constructor) prevents needless reloading of a directory that may have already been loaded.

Parameters:
dir - the directory that backs this instance of StringMapDir
Returns:
the one and only one StringMapDir instance that corresponds to the given directory
Throws:
LoadException - if a new instance of StringMapDir is required but the directory fails to load
See Also:
StringMapDir(File)

getKeySet

public Set getKeySet()
              throws LoadException
Gets all the (String) keys associated with this instance. If this Loadable object is stale, reload it first.

Returns:
the union of all the keys associated with each StringMapFile instance
Throws:
LoadException - If unable to reload the Loadable object (if stale)

get

public String get(String key)
           throws LoadException
Gets the string value that corresponds to the given key. If this Loadable object is stale, reload it first.

Parameters:
key - a string key
Returns:
the string value corresponding to the given key
Throws:
LoadException - If unable to reload the Loadable object (if stale)

load

public void load()
          throws LoadException
Loads the directory and calls #resetLastLoaded().

Throws:
LoadException - If unable to load this Loadable object
See Also:
Loadable


Copyright © 2007-2008 University of Illinois. All Rights Reserved.