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 TypeMethodDescriptionvoidAdds a simple value to the list of values of a given attribute.voidAdds a list of values as a single value to the specified attribute.voidaddVariable(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 NameOpValuegetRelation(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.voidRemoves a specific attribute from attribute/value relations.booleanRemoves a specific value from a list of values of the specified attribute.booleanRemoves a specific key from a list of values of the specified attribute.booleanremoveVariable(String attribute, String varName) Removes a specific variable definition given a variable name.voidSets the attribute value to the given value.voidSets 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
-
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
-
add
-
setMulti
-
addMulti
-
getFirstValue
-
get
-
toRSL
-