Package org.globus.rsl
Class RslAttributes
java.lang.Object
org.globus.rsl.RslAttributes
- Direct Known Subclasses:
GramAttributes
This class provides convieniene methods for
accessing and manipulatig simple rsl expressions.
The class provides methods for retreiving and setting
values of specified attributes.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty RslAttributes object.RslAttributes
(String rsl) Creates a new RslAttributes object from specified RSL string.RslAttributes
(RslNode rslTree) Creates a new RslAttributes object with specified rsl parse tree. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a simple value to the list of values of a given attribute.void
Adds a list of values as a single value to the specified attribute.void
addVariable
(String attribute, String varName, String value) Adds a new variable definition to the specified variable definitions attribute.Deprecated.use getMulti() instead.getFirstValue
(String attribute) Deprecated.use getSingle() instead.Returns a key/value pair map for a specified attribute.Returns a list of strings for a specified attribute.protected NameOpValue
getRelation
(String attribute) Returns the rsl parse tree.Returns a string value of the specified attribute.getVariables
(String attribute) Returns a variable name/value pair map of variable definitions.void
Removes a specific attribute from attribute/value relations.boolean
Removes a specific value from a list of values of the specified attribute.boolean
Removes a specific key from a list of values of the specified attribute.boolean
removeVariable
(String attribute, String varName) Removes a specific variable definition given a variable name.void
Sets the attribute value to the given value.void
Sets the attribute value to the given list of values.toRSL()
Returns the rsl.
-
Field Details
-
rslTree
-
-
Constructor Details
-
RslAttributes
public RslAttributes()Creates an empty RslAttributes object. -
RslAttributes
Creates a new RslAttributes object with specified rsl parse tree.- Parameters:
rslTree
- the rsl parse tree.
-
RslAttributes
Creates a new RslAttributes object from specified RSL string.- Parameters:
rsl
- the rsl string.- Throws:
ParseException
- if the rsl cannot be parsed.
-
-
Method Details
-
getRslNode
Returns the rsl parse tree.- Returns:
- the rsl parse tree.
-
getSingle
Returns a string value of the specified attribute. If the attribute contains multiple values the first one is returned.- Parameters:
attribute
- the rsl attribute to return the value of.- Returns:
- value of the relation. Null is returned if there is no such attribute of the attribute/value relation is not an equality relation.
-
getMulti
Returns a list of strings for a specified attribute. For example for 'arguments' attribute.- Parameters:
attribute
- the rsl attribute to return the values of.- Returns:
- the list of values of the relation. Each value is a string. Null is returned if there is no such attribute or the attribute/values relation is not an equality relation.
-
getMap
Returns a key/value pair map for a specified attribute. For example for 'environment' attribute. Note: Use getVariables() for rsl_substitution attribute.- Parameters:
attribute
- the rsl attribute to return the key/value pair map of.- Returns:
- a key/value pair map. Null is returned if there is no such attribute defined or if the attribute/value relation is not an equality relation.
-
getVariables
Returns a variable name/value pair map of variable definitions. Currently specified by the 'rsl_substitution' attribute.- Parameters:
attribute
- the attribute that defines variables. Currently, only 'rsl_substitution' is supported.- Returns:
- a variable name/value pair map. Null, if there is no definitions for a specified attribute.
-
addVariable
Adds a new variable definition to the specified variable definitions attribute.- Parameters:
attribute
- the variable definitions attribute - rsl_subsititution.varName
- the variable name to add.value
- the value of the variable to add.
-
removeVariable
Removes a specific variable definition given a variable name.- Parameters:
attribute
- the attribute that defines variable definitions.varName
- the name of the variable to remove.- Returns:
- true if the variable was successfully removed. Otherwise, returns false,
-
remove
Removes a specific attribute from attribute/value relations.- Parameters:
attribute
- the attribute name to remove.
-
remove
Removes a specific value from a list of values of the specified attribute.- Parameters:
attribute
- the attribute from which to remote the value from.value
- the specific value to remove.- Returns:
- true if the value was successfully removed. Otherwise, returns false,
-
removeMap
Removes a specific key from a list of values of the specified attribute. The attribute values must be in the right form. See the 'environment' rsl attribute.- Parameters:
attribute
- the attribute to remove the key from.key
- the key to remove.- Returns:
- true if the key was successfully removed. Otherwise, returns false.
-
getRelation
-
set
Sets the attribute value to the given value. All previous values are removed first.- Parameters:
attribute
- the attribute to set the value of.value
- the value to add.
-
add
Adds a simple value to the list of values of a given attribute.- Parameters:
attribute
- the attribute to add the value to.value
- the value to add.
-
setMulti
Sets the attribute value to the given list of values. The list of values is added as a single value.- Parameters:
attribute
- the attribute to set the value of.values
- the list of values to add.
-
addMulti
Adds a list of values as a single value to the specified attribute.- Parameters:
attribute
- the attribute to add the list of values to.values
- the values to add.
-
getFirstValue
Deprecated.use getSingle() instead.Returns the first value of a specified attribute.- Returns:
- the first value of the attribute.
-
get
Deprecated.use getMulti() instead.Returns the values for a specified attribute.- Returns:
- the list of values.
-
toRSL
Returns the rsl.- Returns:
- the rsl.
-