org.globus.cog.gridshell.model
Class ScopeableProperties

java.lang.Object
  extended byorg.globus.cog.gridshell.model.ScopeableProperties
Direct Known Subclasses:
CommandProperties, GridShellProperties

public class ScopeableProperties
extends Object

Allows property values to be processed with a given scope. Keys are NOT processed using the scope.

The default Scope includes ScopeImp.getSystemScope() plus:

Current properties file is the file object associated with ScopableProerperies and will not work if the user does not use the loadFromFile or the Constructor to load the properties

Example configuration file:

# a file location
file.location=${this.path.string}/another-path/file.extention
# a new classpath
new.classpath=${java.class.path}${path.separator}${this.path.string}
# the cog properties file
cog.home=${globus.home}/cog.properties


Nested Class Summary
static class ScopeableProperties.KeyComparator
           Trys to convert keys to a number if can't then it compares as String
 
Constructor Summary
ScopeableProperties()
           
ScopeableProperties(File file)
           
ScopeableProperties(File file, String superKey)
           
 
Method Summary
static List createList(Set keys, String prefix)
           
 File getFile()
          Resturns the file object associated with this Properties
 String getProperty(String propertyName)
          Override the return of getProperty to the variable's values
 String getProperty(String propertyName, String defaultValue)
          Allows a default value to be assciated with the command
 Scope getScope()
          Returns the scope
 Scope getSubScope(String prefix)
           
 void initScope()
          These are the default variables supported ${this.path} -> the path to the directory of this file to add more variables override this method
 Set keySet()
           
 Set keySet(String prefix)
          Gets the key set such that includes each key that starts with prefix
 void load(InputStream stream)
          Just gives a warning and calls the superclass
 void loadFromFile(File file)
          Loads from a file, if the user does not use this method the value ${this.path} may not be correct
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScopeableProperties

public ScopeableProperties()
                    throws IOException,
                           ScopeException

ScopeableProperties

public ScopeableProperties(File file)
                    throws IOException,
                           ScopeException

ScopeableProperties

public ScopeableProperties(File file,
                           String superKey)
                    throws IOException,
                           ScopeException
Method Detail

load

public void load(InputStream stream)
          throws IOException
Just gives a warning and calls the superclass

Throws:
IOException

loadFromFile

public void loadFromFile(File file)
                  throws IOException,
                         ScopeException
Loads from a file, if the user does not use this method the value ${this.path} may not be correct

Throws:
IOException@throws - ScopeExceptio
ScopeExceptionn
IOException
ScopeException

getProperty

public String getProperty(String propertyName,
                          String defaultValue)
Allows a default value to be assciated with the command

Parameters:
propertyName -
defaultValue -
Returns:

getProperty

public String getProperty(String propertyName)
Override the return of getProperty to the variable's values


keySet

public Set keySet()

keySet

public Set keySet(String prefix)
Gets the key set such that includes each key that starts with prefix

Parameters:
prefix -
Returns:

getSubScope

public Scope getSubScope(String prefix)

getFile

public File getFile()
Resturns the file object associated with this Properties

Returns:

getScope

public Scope getScope()
Returns the scope

Returns:

initScope

public void initScope()
               throws ScopeException
These are the default variables supported ${this.path} -> the path to the directory of this file to add more variables override this method

Throws:
ScopeException

createList

public static List createList(Set keys,
                              String prefix)