org.globus.gridshib.common
Class StringSetFile

java.lang.Object
  extended by org.globus.gridshib.common.LoadableResource
      extended by org.globus.gridshib.common.StringSetFile
All Implemented Interfaces:
Loadable

public class StringSetFile
extends LoadableResource

An implementation of the Loadable interface for sets of strings.

See Also:
Loadable, LoadableResource

Field Summary
 
Fields inherited from class org.globus.gridshib.common.LoadableResource
lastLoaded, loaded, resource
 
Constructor Summary
StringSetFile(File file)
          The primary constructor for obtaining an instance of StringSetFile.
StringSetFile(String pathname)
          A convenience constructor that simply converts its String argument into a File object, and then calls the corresponding constructor.
StringSetFile(URI uri)
          A convenience constructor that simply converts its URI argument into a File object, and then calls the corresponding constructor.
 
Method Summary
 boolean contains(String s)
          Determine if this StringSetFile contains the given string.
static StringSetFile getInstance(File file)
          Gets the instance of StringSetFile that corresponds to the given file.
static StringSetFile getInstance(String pathname)
          Creates a File object from the given pathname and invokes getInstance(File).
static StringSetFile getInstance(URI uri)
          Creates a File object from the given URI instance and invokes getInstance(File).
 void load()
          Loads the file and calls LoadableResource.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

StringSetFile

public StringSetFile(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

StringSetFile

public StringSetFile(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

StringSetFile

public StringSetFile(File file)
              throws LoadException
The primary constructor for obtaining an instance of StringSetFile. Captures the given File object and loads the file into the StringSet.

Throws:
LoadException
Method Detail

getInstance

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

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

getInstance

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

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

getInstance

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

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

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

contains

public boolean contains(String s)
                 throws LoadException
Determine if this StringSetFile contains the given string. If this Loadable object is stale, reload it first.

Parameters:
s - the string to be checked for containment
Returns:
true if and only if the set contains the given string
Throws:
LoadException - If unable to reload the Loadable object (if stale)

load

public void load()
          throws LoadException
Loads the file and calls LoadableResource.resetLastLoaded().

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


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