Package edu.sc.seis.sod
Class SodUtil
java.lang.Object
edu.sc.seis.sod.SodUtil
public class SodUtil
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description static edu.sc.seis.sod.model.common.UnitImpl[]
FREQ_UNITS
static edu.sc.seis.sod.model.common.UnitImpl[]
LENGTH_UNITS
static edu.sc.seis.sod.model.common.UnitImpl[]
TIME_UNITS
-
Constructor Summary
Constructors Constructor Description SodUtil()
-
Method Summary
Modifier and Type Method Description static void
copyFile(java.lang.String src, java.lang.String dest)
static void
copyStream(java.io.InputStream src, java.lang.String dest)
static java.lang.String
elementPath(org.w3c.dom.Element e)
static java.lang.String
getAbsolutePath(java.lang.String baseLoc, java.lang.String relativeLoc)
static java.util.List<org.w3c.dom.Element>
getAllElements(org.w3c.dom.Element config, java.lang.String elementName)
returns all the element with the given namestatic MicroSecondDateSupplier
getEarlierSupplier(java.time.Duration duration)
static org.w3c.dom.Element
getElement(org.w3c.dom.Element config, java.lang.String elementName)
returns the first element with the given name, null if none exists.static org.w3c.dom.Element
getFirstEmbeddedElement(org.w3c.dom.Element config)
static MicroSecondDateSupplier
getLaterSupplier(java.time.Duration duration)
static java.lang.String
getNestedText(org.w3c.dom.Element config)
returns the nested text in the tag *static java.lang.String
getRelativePath(java.lang.String fromPath, java.lang.String toPath, java.lang.String separator)
static java.lang.String
getSimpleName(java.lang.Class c)
static java.lang.String
getText(org.w3c.dom.Element config)
returns the first text child within the node.static java.net.URL
getUrl(java.lang.ClassLoader cl, java.lang.String loc)
static int[]
intArrayFromList(java.util.List list)
static boolean
isTrue(org.w3c.dom.Element el, java.lang.String tagName, boolean defaultResult)
static boolean
isTrueText(java.lang.String nestedText)
void
listKnownScriptEngines()
static java.lang.Object
load(org.w3c.dom.Element config, java.lang.String armName)
static java.lang.Object
load(org.w3c.dom.Element config, java.lang.String[] armNames)
static java.lang.Object
load(org.w3c.dom.Element config, java.util.List<java.lang.String> armNames)
static edu.sc.seis.sod.model.common.BoxAreaImpl
loadBoxArea(org.w3c.dom.Element config)
static java.awt.Dimension
loadDimensions(org.w3c.dom.Element element)
static java.lang.Object
loadExternal(java.lang.String tagName, java.lang.String[] armNames, org.w3c.dom.Element config)
loads the class named in the element "classname" in config with config as a costructor argument.static float
loadFloat(org.w3c.dom.Element config, java.lang.String elementName, float defaultValue)
static int
loadInt(org.w3c.dom.Element config, java.lang.String elementName, int defaultValue)
static void
loadProperties(org.w3c.dom.Element config, java.util.Properties props)
static edu.sc.seis.sod.model.common.QuantityImpl
loadQuantity(org.w3c.dom.Element config)
static java.lang.String
loadText(org.w3c.dom.Element config, java.lang.String elementName, java.lang.String defaultValue)
static MicroSecondDateSupplier
loadTime(org.w3c.dom.Element el)
static MicroSecondDateSupplier
loadTime(org.w3c.dom.Element el, boolean endOfDay)
static java.time.Duration
loadTimeInterval(org.w3c.dom.Element config)
static MicroSecondTimeRangeSupplier
loadTimeRange(org.w3c.dom.Element config)
static edu.sc.seis.sod.model.common.UnitImpl
loadUnit(org.w3c.dom.Element config)
static edu.sc.seis.sod.model.common.UnitRangeImpl
loadUnitRange(org.w3c.dom.Element config)
static java.io.File
makeOutputDirectory(org.w3c.dom.Element config)
static java.lang.String
nodeValueOfXPath(org.w3c.dom.Element el, java.lang.String xpath)
static MicroSecondDateSupplier
nowSupplier()
-
Field Details
-
LENGTH_UNITS
public static final edu.sc.seis.sod.model.common.UnitImpl[] LENGTH_UNITS -
TIME_UNITS
public static final edu.sc.seis.sod.model.common.UnitImpl[] TIME_UNITS -
FREQ_UNITS
public static final edu.sc.seis.sod.model.common.UnitImpl[] FREQ_UNITS
-
-
Constructor Details
-
SodUtil
public SodUtil()
-
-
Method Details
-
isTrue
public static boolean isTrue(org.w3c.dom.Element el, java.lang.String tagName, boolean defaultResult) -
isTrueText
public static boolean isTrueText(java.lang.String nestedText) -
makeOutputDirectory
public static java.io.File makeOutputDirectory(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
load
public static java.lang.Object load(org.w3c.dom.Element config, java.lang.String armName) throws ConfigurationException- Throws:
ConfigurationException
-
load
public static java.lang.Object load(org.w3c.dom.Element config, java.util.List<java.lang.String> armNames) throws ConfigurationException- Throws:
ConfigurationException
-
load
public static java.lang.Object load(org.w3c.dom.Element config, java.lang.String[] armNames) throws ConfigurationException- Throws:
ConfigurationException
-
elementPath
public static java.lang.String elementPath(org.w3c.dom.Element e) -
listKnownScriptEngines
public void listKnownScriptEngines() -
loadExternal
public static java.lang.Object loadExternal(java.lang.String tagName, java.lang.String[] armNames, org.w3c.dom.Element config) throws java.lang.Exceptionloads the class named in the element "classname" in config with config as a costructor argument. If the loaded class doesnt implement mustImplement, a configuration exception is thrown- Throws:
java.lang.Exception
-
loadUnit
public static edu.sc.seis.sod.model.common.UnitImpl loadUnit(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
loadTime
public static MicroSecondDateSupplier loadTime(org.w3c.dom.Element el) throws ConfigurationException- Throws:
ConfigurationException
-
loadTime
public static MicroSecondDateSupplier loadTime(org.w3c.dom.Element el, boolean endOfDay) throws ConfigurationException- Throws:
ConfigurationException
-
nowSupplier
-
getEarlierSupplier
-
getLaterSupplier
-
loadTimeInterval
public static java.time.Duration loadTimeInterval(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
loadQuantity
public static edu.sc.seis.sod.model.common.QuantityImpl loadQuantity(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
loadInt
public static int loadInt(org.w3c.dom.Element config, java.lang.String elementName, int defaultValue) -
loadFloat
public static float loadFloat(org.w3c.dom.Element config, java.lang.String elementName, float defaultValue) -
loadText
public static java.lang.String loadText(org.w3c.dom.Element config, java.lang.String elementName, java.lang.String defaultValue) -
copyFile
public static void copyFile(java.lang.String src, java.lang.String dest) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
copyStream
public static void copyStream(java.io.InputStream src, java.lang.String dest) -
loadUnitRange
public static edu.sc.seis.sod.model.common.UnitRangeImpl loadUnitRange(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
loadTimeRange
public static MicroSecondTimeRangeSupplier loadTimeRange(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
loadDimensions
public static java.awt.Dimension loadDimensions(org.w3c.dom.Element element) throws java.lang.Exception- Throws:
java.lang.Exception
-
nodeValueOfXPath
public static java.lang.String nodeValueOfXPath(org.w3c.dom.Element el, java.lang.String xpath) throws org.w3c.dom.DOMException, javax.xml.transform.TransformerException, javax.xml.xpath.XPathException- Throws:
org.w3c.dom.DOMException
javax.xml.transform.TransformerException
javax.xml.xpath.XPathException
-
loadBoxArea
public static edu.sc.seis.sod.model.common.BoxAreaImpl loadBoxArea(org.w3c.dom.Element config) throws ConfigurationException- Throws:
ConfigurationException
-
getElement
public static org.w3c.dom.Element getElement(org.w3c.dom.Element config, java.lang.String elementName)returns the first element with the given name, null if none exists. -
getAllElements
public static java.util.List<org.w3c.dom.Element> getAllElements(org.w3c.dom.Element config, java.lang.String elementName)returns all the element with the given name -
getFirstEmbeddedElement
public static org.w3c.dom.Element getFirstEmbeddedElement(org.w3c.dom.Element config) -
getText
public static java.lang.String getText(org.w3c.dom.Element config)returns the first text child within the node. -
getNestedText
public static java.lang.String getNestedText(org.w3c.dom.Element config)returns the nested text in the tag * -
getRelativePath
public static java.lang.String getRelativePath(java.lang.String fromPath, java.lang.String toPath, java.lang.String separator) -
getAbsolutePath
public static java.lang.String getAbsolutePath(java.lang.String baseLoc, java.lang.String relativeLoc) throws java.io.IOException- Throws:
java.io.IOException
-
getUrl
public static java.net.URL getUrl(java.lang.ClassLoader cl, java.lang.String loc) throws java.net.MalformedURLException- Throws:
java.net.MalformedURLException
-
loadProperties
public static void loadProperties(org.w3c.dom.Element config, java.util.Properties props) -
intArrayFromList
public static int[] intArrayFromList(java.util.List list) -
getSimpleName
public static java.lang.String getSimpleName(java.lang.Class c)
-