org.globus.gridshib.common
Class LoadableResource

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

public abstract class LoadableResource
extends Object
implements Loadable

An abstract implementation of the Loadable interface. This implementation is backed by a file-based resource.

Note: Subclasses must implement the Loadable#load() method.

See Also:
Loadable

Field Summary
protected  long lastLoaded
          The time (in milliseconds past the epoch) since this LoadableResource instance was last loaded.
protected  boolean loaded
          Is true if and only if this LoadableResource object has been loaded.
protected  File resource
          The actual resource backing this LoadableResource object.
 
Constructor Summary
LoadableResource()
           
 
Method Summary
 long getLastLoaded()
          Gets the lastLoaded property of this Loadable object.
 File getResource()
          Get the file-based resource backing this instance of LoadableResource.
 boolean isLoaded()
          Determines if this Loadable object has been loaded.
 boolean isStale()
          Determine if this Loadable object needs to be reloaded.
 void resetLastLoaded()
          Resets the lastLoaded property of this Loadable object.
protected static URL toURL(File file)
          Convert the File object to a "file:" URL.
protected static URL toURL(URI uri)
          Convert the URI object to a "file:" URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.globus.gridshib.common.Loadable
load
 

Field Detail

resource

protected File resource
The actual resource backing this LoadableResource object.


loaded

protected boolean loaded
Is true if and only if this LoadableResource object has been loaded.


lastLoaded

protected long lastLoaded
The time (in milliseconds past the epoch) since this LoadableResource instance was last loaded.

Constructor Detail

LoadableResource

public LoadableResource()
Method Detail

getResource

public File getResource()
Get the file-based resource backing this instance of LoadableResource.

Since:
0.4.3

isLoaded

public boolean isLoaded()
Description copied from interface: Loadable
Determines if this Loadable object has been loaded.

Specified by:
isLoaded in interface Loadable
Returns:
true if and only if this Loadable object has been loaded.
See Also:
Loadable

getLastLoaded

public long getLastLoaded()
Description copied from interface: Loadable
Gets the lastLoaded property of this Loadable object.

Specified by:
getLastLoaded in interface Loadable
Returns:
the time since this Loadable object was last loaded
See Also:
Loadable

resetLastLoaded

public void resetLastLoaded()
Description copied from interface: Loadable
Resets the lastLoaded property of this Loadable object.

Specified by:
resetLastLoaded in interface Loadable
See Also:
Loadable

isStale

public boolean isStale()
Description copied from interface: Loadable
Determine if this Loadable object needs to be reloaded.

Specified by:
isStale in interface Loadable
Returns:
true if and only if this Loadable object is stale (i.e., needs to be reloaded)
See Also:
Loadable

toURL

protected static URL toURL(File file)
Convert the File object to a "file:" URL. Returns null if the File is null or can not be converted to a URL.


toURL

protected static URL toURL(URI uri)
Convert the URI object to a "file:" URL. Returns null if the URI is null or can not be converted to a URL.



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