|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.ucsb.nceas.morpho.datapackage.PackageUtil
This class contains static utility methods that are used throughtout the other *.morpho.datapackage.* classes.
Constructor Summary | |
PackageUtil()
|
Method Summary | |
static java.lang.String |
addTriplesToTriplesFile(TripleCollection triples,
DataPackage dataPackage,
ClientFramework framework)
method to add a collection of triples to a triples file. |
static java.lang.String |
deleteTriplesInTriplesFile(java.lang.String searchstring,
DataPackage dataPackage,
ClientFramework framework)
method to delete triples with a specified string from the triples file |
static java.util.Hashtable |
getConfigFileTypeAttributes(ClientFramework framework,
java.lang.String hashby)
gets the file types from the config file and hashes them by a specified attribute |
static org.w3c.dom.Document |
getDoc(java.io.File file,
java.lang.String catalogPath)
parses file with the dom parser and returns a dom Document |
static EditorInterface |
getEditor(ClientFramework framework)
gets the editor context and returns it |
static org.w3c.dom.NodeList |
getPathContent(java.io.File f,
java.lang.String path,
ClientFramework framework)
gets the content of a tag in a given xml file with the given path |
static org.w3c.dom.NodeList |
getPathContent(java.io.File f,
java.util.Vector paths,
ClientFramework framework)
Takes in a vector of paths and searches for each of the paths until a node is found that matches the paths. |
static java.lang.String |
getStringFromFile(java.io.File xmlFile)
returns the string representation of a file |
protected static java.lang.String |
normalize(java.lang.String s)
Normalizes the given string. |
static java.io.File |
openFile(java.lang.String name,
ClientFramework framework)
opens a file on metacat or local. |
static java.io.File |
openFile(java.lang.String name,
java.lang.String location,
ClientFramework framework)
figures out a files location if it is not known and opens it. |
static java.lang.String |
print(org.w3c.dom.Node node)
This method can 'print' any DOM subtree. |
static java.lang.String |
printDoctype(org.w3c.dom.Document doc)
prints out the doctype part of and xml document. |
protected static org.w3c.dom.Attr[] |
sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PackageUtil()
Method Detail |
public static org.w3c.dom.NodeList getPathContent(java.io.File f, java.util.Vector paths, ClientFramework framework)
public static org.w3c.dom.NodeList getPathContent(java.io.File f, java.lang.String path, ClientFramework framework)
f
- the file to parsepath
- the path to get the content fromframework
- a framework object that has a valid config filepublic static org.w3c.dom.Document getDoc(java.io.File file, java.lang.String catalogPath) throws org.xml.sax.SAXException, java.lang.Exception
file
- the file to create the document fromcatalogPath
- the path to the catalog where the files doctype info
can be found.public static java.lang.String print(org.w3c.dom.Node node)
node
- node usually set to the 'doc' node for complete XML file
re-writeprotected static org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
protected static java.lang.String normalize(java.lang.String s)
public static java.lang.String printDoctype(org.w3c.dom.Document doc)
doc
- the dom of the document to print the doctype forpublic static java.io.File openFile(java.lang.String name, ClientFramework framework) throws java.io.FileNotFoundException, CacheAccessException
name
- the name of the fileframework
- the framework object that is currently running.public static java.io.File openFile(java.lang.String name, java.lang.String location, ClientFramework framework) throws java.io.FileNotFoundException, CacheAccessException
name
- the file to openlocation
- the location of the file. set to null if the location is
unknownframework
- the framework object that is currently running.public static EditorInterface getEditor(ClientFramework framework)
public static java.lang.String getStringFromFile(java.io.File xmlFile)
public static java.lang.String addTriplesToTriplesFile(TripleCollection triples, DataPackage dataPackage, ClientFramework framework)
triples
- the collection of triples to adddataPackage
- the package that you want to add the triples toframework
- the framework object that is currently running.public static java.lang.String deleteTriplesInTriplesFile(java.lang.String searchstring, DataPackage dataPackage, ClientFramework framework)
searchstring
- the string to search for in the triples. when this
string is found the entire triple to which it belongs is deleted.dataPackage
- the package that you want to delete the triples fromframework
- the framework object that is currently running.public static java.util.Hashtable getConfigFileTypeAttributes(ClientFramework framework, java.lang.String hashby)
framework
- the client framework that is currently activehashby
- a key from the attributes to hash the table by. note
that this must be one of the required fields or else the hashtable
will try to hash values to null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |