|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.sdsc.inca.util.XmlWrapper edu.sdsc.inca.util.ResourcesWrapper
A convenience class for dealing with resource configuration files which provides methods for accessing the content.
Nested Class Summary | |
class |
ResourcesWrapper.ResourceInfo
|
Field Summary |
Fields inherited from class edu.sdsc.inca.util.XmlWrapper |
PASSWORD_MACRO_VALUE_PATTERN |
Constructor Summary | |
ResourcesWrapper()
Default constructor which creates a blank resource configuration document. |
|
ResourcesWrapper(java.io.Reader rcXml)
Create a new ResourcesWrapper object from a reader object. |
|
ResourcesWrapper(edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument rcDoc)
Create a new ResourcesWrapper object from an XML Beans class instance. |
|
ResourcesWrapper(java.lang.String filename)
Create a new ResourcesWrapper object from a unencrypted resource configuration XML document file. |
|
ResourcesWrapper(java.lang.String filename,
java.lang.String passphrase)
Create a new ResourcesWrapper object from an encrypted resource configuration XML document file. |
Method Summary | |
boolean |
equals(java.lang.Object o)
Return true iff another object is a ResourcesWrapper with identical resource information. |
java.util.Vector |
expand(java.lang.String stringValue,
java.lang.String resource,
java.lang.String prevMacro)
Expand any macros in the specified string and return the results as a vector of strings. |
java.lang.String |
getFilePath()
Return the path to resources file if applicable. |
java.lang.String |
getPassphrase()
Return the passphrase associated with these resources. |
edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument |
getResourceConfigDocument()
Return the stored resource configuration document. |
java.lang.String[] |
getResources(java.lang.String resource,
boolean hostEquivalence)
Recursively find the resource members (i.e., not resource sets) for the provided resource set. |
java.lang.String[] |
getResourcesByXpath(java.lang.String xpath,
boolean hostEquivalence)
Recursively find the resource members (i.e., not resource sets) for the resource sets specified in the provided xpath expression. |
java.lang.String |
getValue(java.lang.String resource,
java.lang.String macro)
Convenience method for getValues (see getValues for more documentation) when only one value is defined for the specified macro. |
java.lang.String[] |
getValues(java.lang.String resource,
java.lang.String macro)
Scan resourceConfig and return a list of values for the macro that applies to this resource. |
boolean |
hasHostEquivalence(java.lang.String resourceName)
Returns true if the given resource resource contains a set of hosts that are considered equivalent (i.e., only need to monitor on one of them) |
void |
save()
Save the resource configuration file to disk. |
void |
setFilePath(java.lang.String filePath)
Set the path to the resources file. |
void |
setPassphrase(java.lang.String passphrase)
Set the passphrase associated with these resources. |
void |
setResourceConfigDocument(edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument rcDoc)
Set the resource configuration document to the provided document. |
Methods inherited from class edu.sdsc.inca.util.XmlWrapper |
configEqual, cryptSensitive, escape, main, read, save, unescape, validate |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResourcesWrapper()
public ResourcesWrapper(edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument rcDoc) throws org.apache.xmlbeans.XmlException
rcDoc
- An instance of ResourceConfigDocument, a class generated
from the schema file by XML Beans
org.apache.xmlbeans.XmlException
public ResourcesWrapper(java.lang.String filename) throws CrypterException, java.io.IOException, org.apache.xmlbeans.XmlException
filename
- Path to a resource configuration XML file
CrypterException
java.io.IOException
org.apache.xmlbeans.XmlException
public ResourcesWrapper(java.lang.String filename, java.lang.String passphrase) throws CrypterException, java.io.IOException, org.apache.xmlbeans.XmlException
filename
- Path to an encrypted resource configuration XML filepassphrase
- Secret string used to encrypt/decrypt file to disk
CrypterException
java.io.IOException
org.apache.xmlbeans.XmlException
public ResourcesWrapper(java.io.Reader rcXml) throws java.io.IOException, org.apache.xmlbeans.XmlException
rcXml
- Reader connected to a character stream to a resource config.
java.io.IOException
org.apache.xmlbeans.XmlException
Method Detail |
public boolean equals(java.lang.Object o)
o
- the object to compare
public java.util.Vector expand(java.lang.String stringValue, java.lang.String resource, java.lang.String prevMacro) throws ConfigurationException
stringValue
- A string that may contain macros that need to be
expandedresource
- The name of the resource this reportSeries is being
expanded for.prevMacro
- The name of the previously expanded macro in order to
detect infinite recursion.
ConfigurationException
public java.lang.String getFilePath()
public java.lang.String getPassphrase()
public edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument getResourceConfigDocument()
public java.lang.String[] getResources(java.lang.String resource, boolean hostEquivalence) throws ConfigurationException
resource
- The name of a resource sethostEquivalence
- A value of true indicates that resources that have
the .equivalent macro defined as true should be treated as one
resource. A value of false indicates that that resources that have the
.equivalent macro defined as true should be resolved further. The
former is good for launching reporter managers (because we only need one
reporter manager launched on a resource while the latter is good for
sending to the depot (because we don't know what resource the reporter
manager will be started on).
ConfigurationException
public java.lang.String[] getResourcesByXpath(java.lang.String xpath, boolean hostEquivalence) throws ConfigurationException
xpath
- A xpath expression that can be used to reference resources
specified in the resource configuration file.hostEquivalence
- A value of true indicates that resources that have
the .equivalent macro defined as true should be treated as one
resource. A value of false indicates that that resources that have the
.equivalent macro defined as true should be resolved further. The
former is good for launching reporter managers (because we only need one
reporter manager launched on a resource while the latter is good for
sending to the depot (because we don't know what resource the reporter
manager will be started on).
ConfigurationException
public java.lang.String getValue(java.lang.String resource, java.lang.String macro) throws ConfigurationException
resource
- The name of the resource contained in resourceConfigmacro
- The name of a macro contained in resourceConfig
ConfigurationException
public java.lang.String[] getValues(java.lang.String resource, java.lang.String macro) throws ConfigurationException
<resource> <name>sdsc</name> <resources> <resource> <name>tg-login.sdsc.teragrid.org</name> <macros> <macro> <name>gridFTPPort</name> <value>2812</value> ... <resource> <name>sdsc</name> <xpath>//resource[matches(name, '^*.sdsc.*$')]</xpath> <macros> <macro> <name>.gridFtpPort</name> <value>2811</value> </macro> ...
resource
- The name of the resource contained in resourceConfigmacro
- The name of a macro contained in resourceConfig
ConfigurationException
public boolean hasHostEquivalence(java.lang.String resourceName)
resourceName
- The name of a resource.
public void save() throws CrypterException, java.io.IOException
CrypterException
java.io.IOException
public void setFilePath(java.lang.String filePath)
filePath
- A string containing the path to where the resources file
can be read/stored.public void setPassphrase(java.lang.String passphrase)
passphrase
- A string containing the passphrasepublic void setResourceConfigDocument(edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument rcDoc) throws org.apache.xmlbeans.XmlException
rcDoc
- An instance of ResourceConfigDocument, a class generated
from the schema file by XML Beans
org.apache.xmlbeans.XmlException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |