|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.sdsc.inca.WrapResource
public class WrapResource
A class that wraps a resource or resource group, represented by an Inca XmlBean, with some convenience methods.
Field Summary | |
---|---|
static int |
COMPUTE_SERVER
An enumeration of server types for get/setServerSpec. |
static int |
FILE_SERVER
|
protected java.util.Hashtable |
inheritedMacros
|
protected java.util.Hashtable |
localMacros
|
static int |
PROXY_SERVER
|
protected edu.sdsc.inca.dataModel.util.Resource |
resource
|
Constructor Summary | |
---|---|
WrapResource()
Constructs a new WrapResource. |
|
WrapResource(edu.sdsc.inca.dataModel.util.Resource resource)
Constructs a new WrapResource to wrap an existing Resource. |
Method Summary | |
---|---|
void |
copy(WrapResource original)
Copies all information from another resouce into this one. |
boolean |
equals(java.lang.Object o)
Override of the default equals method. |
java.lang.String[] |
expandHostPattern()
Returns the set of strings matched by the resource's host pattern. |
java.lang.String[] |
getInheritedMacroNames()
Returns the names of all inherited macros defined for the resource. |
java.lang.String[] |
getLocalMacroNames()
Returns the names of all local macros defined for the resource. |
java.lang.String |
getMacroValue(java.lang.String name)
Returns the first value of an existing resource macro with a given name, or null if none. |
java.lang.String[] |
getMacroValues(java.lang.String name)
Returns all values of an existing resource macro with a given name, or null if none. |
java.lang.String |
getName()
Returns the name of the resource. |
edu.sdsc.inca.dataModel.util.Resource |
getResource()
Returns the underlying Resource of this resource. |
java.lang.String |
getServer(int which)
Retrieves the macros related to one of the resource servers and composes their values into a String of the form host[:port][/dn]. |
java.lang.String |
getXpath()
Returns the xpath of the resource. |
boolean |
isLocalMacro(java.lang.String name)
Indicates whether a macro is defined locally to this resource. |
void |
removeAllInheritedMacros()
Deletes any inherited macros defined in the resource. |
void |
removeMacro(java.lang.String name)
Removes any macro with a specified name from the resource. |
void |
setInheritedMacroValue(java.lang.String name,
java.lang.String value)
Adds an inherited macro with a single value to the resource, replacing any other with the same name. |
void |
setInheritedMacroValues(java.lang.String name,
java.lang.String[] values)
Adds an inherited macro with multiple values to the resource, replacing any other with the same name. |
void |
setMacroValue(java.lang.String name,
java.lang.String value)
Adds a macro with a single value to the resource, replacing any other with the same name. |
void |
setMacroValue(java.lang.String name,
java.lang.String value,
java.lang.String defaultValue)
A convenience that removes a macro from the resource, then sets it to a new single value unless that value is equal to a default value. |
void |
setMacroValues(java.lang.String name,
java.lang.String[] values)
Adds a macro with multiple values to the resource, replacing any other with the same name. |
void |
setName(java.lang.String name)
Sets the name of the resource to a specified value. |
void |
setServer(int which,
java.lang.String server)
Splits a server string of the form host[:port][/dn] and stores its component parts into appropriate macros. |
void |
setXpath(java.lang.String xpath)
Sets the xpath of the resource to a specified value. |
java.lang.String |
toString()
An override of the default toString function. |
java.lang.String |
toXml()
Returns XML for the resource. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int COMPUTE_SERVER
public static final int FILE_SERVER
public static final int PROXY_SERVER
protected edu.sdsc.inca.dataModel.util.Resource resource
protected java.util.Hashtable inheritedMacros
protected java.util.Hashtable localMacros
Constructor Detail |
---|
public WrapResource()
public WrapResource(edu.sdsc.inca.dataModel.util.Resource resource)
resource
- the resource to wrapMethod Detail |
---|
public void copy(WrapResource original)
original
- the WrapResource to duplicatepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare to this one
public java.lang.String[] expandHostPattern()
public java.lang.String[] getInheritedMacroNames()
public java.lang.String[] getLocalMacroNames()
public java.lang.String getMacroValue(java.lang.String name)
name
- the specified macro name
public java.lang.String[] getMacroValues(java.lang.String name)
name
- the specified macro name
public java.lang.String getName()
public edu.sdsc.inca.dataModel.util.Resource getResource()
public java.lang.String getServer(int which)
which
- one of the server types indicated by the constants above
public java.lang.String getXpath()
public boolean isLocalMacro(java.lang.String name)
name
- the macro name
public void removeAllInheritedMacros()
public void removeMacro(java.lang.String name)
name
- the specified macro namepublic void setInheritedMacroValue(java.lang.String name, java.lang.String value)
name
- the name of the macrovalue
- the value of the macropublic void setInheritedMacroValues(java.lang.String name, java.lang.String[] values)
name
- the name of the macrovalues
- the values of the macropublic void setMacroValue(java.lang.String name, java.lang.String value)
name
- the name of the macrovalue
- the value of the macropublic void setMacroValue(java.lang.String name, java.lang.String value, java.lang.String defaultValue)
name
- the name of the macrovalue
- the value of the macrodefaultValue
- the default value for the macro if it isn't setpublic void setMacroValues(java.lang.String name, java.lang.String[] values)
name
- the name of the macrovalues
- the values of the macropublic void setName(java.lang.String name)
name
- the resource namepublic void setServer(int which, java.lang.String server)
which
- one of the server types indicated by the constants aboveserver
- the server specification stringpublic void setXpath(java.lang.String xpath)
xpath
- the resource xpathpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toXml()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |