Package gov.nasa.pds.harvest.search.util
Class Utility
- java.lang.Object
-
- gov.nasa.pds.harvest.search.util.Utility
-
public class Utility extends Object
Utility class.
-
-
Constructor Summary
Constructors Constructor Description Utility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetDateTime()Get the current date time.static StringresolveEnvVars(String string)Returns given string with environment variable references expanded.static List<String>resolveEnvVars(List<String> strings)Returns list of strings with environment variable references expanded.static URLtoURL(String s)Convert a string to a URL.static StringtoWellFormedURI(String s)Convert a string to a URI.static StringtoXML(Association association)Convert the Association into an XML.static StringtoXML(ExtrinsicObject extrinsic)Convert the ExtrinsicObject into an XML.
-
-
-
Method Detail
-
toURL
public static URL toURL(String s) throws MalformedURLException
Convert a string to a URL.- Parameters:
s- The string to convert- Returns:
- A URL of the input string
- Throws:
MalformedURLException
-
toWellFormedURI
public static String toWellFormedURI(String s)
Convert a string to a URI.- Parameters:
s- The string to convert.- Returns:
- A well-formed URI.
-
getDateTime
public static String getDateTime()
Get the current date time.- Returns:
- A date time.
-
toXML
public static String toXML(ExtrinsicObject extrinsic) throws JAXBException
Convert the ExtrinsicObject into an XML.- Parameters:
extrinsic- The ExtrinsicObject.- Returns:
- The XML representation of the given ExtrinsicObject.
- Throws:
JAXBException- If there was an error marshalling the given object.
-
toXML
public static String toXML(Association association) throws JAXBException
Convert the Association into an XML.- Parameters:
association- The Association.- Returns:
- The XML representation of the given Association.
- Throws:
JAXBException- If there was an error marshalling the given association.
-
resolveEnvVars
public static String resolveEnvVars(String string)
Returns given string with environment variable references expanded. e.g. $HOME or ${HOME}.- Parameters:
string- The string to expand.- Returns:
- The expanded string or the original string if no environment variables were expanded.
-
resolveEnvVars
public static List<String> resolveEnvVars(List<String> strings)
Returns list of strings with environment variable references expanded. e.g. $HOME or ${HOME}- Parameters:
strings- A list of strings to expand.- Returns:
- A list of expanded strings or the original strings if no environment variables were expanded.
-
-