Class SodUtil


  • public class SodUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static edu.iris.Fissures.model.UnitImpl[] FREQ_UNITS  
      static org.python.util.PythonInterpreter interpreter  
      static edu.iris.Fissures.model.UnitImpl[] LENGTH_UNITS  
      static int pythonClassNum  
      static edu.iris.Fissures.model.UnitImpl[] TIME_UNITS  
    • Constructor Summary

      Constructors 
      Constructor Description
      SodUtil()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      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.util.Calendar createCalendar​(int year, int month, int day, int hour, int minute, int second, boolean ceiling)
      Creates a calendar in the given year.
      static java.lang.String elementPath​(org.w3c.dom.Element e)  
      static void fillInField​(int field, int value, boolean ceiling, java.util.Calendar cal)  
      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 name
      static MicroSecondDateSupplier getEarlierSupplier​(edu.iris.Fissures.model.TimeInterval 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)  
      protected static java.lang.String getJythonAcceptArgs​(java.lang.Class mustImplement)  
      static MicroSecondDateSupplier getLaterSupplier​(edu.iris.Fissures.model.TimeInterval duration)  
      static java.lang.String getNestedText​(org.w3c.dom.Element config)
      returns the nested text in the tag *
      static org.python.util.PythonInterpreter getPythonInterpreter()  
      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.
      protected static java.lang.Object inlineJython​(java.lang.String className, java.lang.Class mustImplement, java.lang.String jythonCode)  
      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.iris.Fissures.model.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 java.lang.Object loadJython​(java.lang.String tagName, java.lang.String[] armNames, org.w3c.dom.Element config)  
      static void loadProperties​(org.w3c.dom.Element config, java.util.Properties props)  
      static edu.iris.Fissures.model.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 edu.iris.Fissures.model.TimeInterval loadTimeInterval​(org.w3c.dom.Element config)  
      static MicroSecondTimeRangeSupplier loadTimeRange​(org.w3c.dom.Element config)  
      static edu.iris.Fissures.model.UnitImpl loadUnit​(org.w3c.dom.Element config)  
      static edu.iris.Fissures.model.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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • interpreter

        public static org.python.util.PythonInterpreter interpreter
      • pythonClassNum

        public static int pythonClassNum
      • LENGTH_UNITS

        public static final edu.iris.Fissures.model.UnitImpl[] LENGTH_UNITS
      • TIME_UNITS

        public static final edu.iris.Fissures.model.UnitImpl[] TIME_UNITS
      • FREQ_UNITS

        public static final edu.iris.Fissures.model.UnitImpl[] FREQ_UNITS
    • Constructor Detail

      • SodUtil

        public SodUtil()
    • Method Detail

      • 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)
      • elementPath

        public static java.lang.String elementPath​(org.w3c.dom.Element e)
      • getPythonInterpreter

        public static org.python.util.PythonInterpreter getPythonInterpreter()
      • loadJython

        public static java.lang.Object loadJython​(java.lang.String tagName,
                                                  java.lang.String[] armNames,
                                                  org.w3c.dom.Element config)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • listKnownScriptEngines

        public void listKnownScriptEngines()
      • inlineJython

        protected static java.lang.Object inlineJython​(java.lang.String className,
                                                       java.lang.Class mustImplement,
                                                       java.lang.String jythonCode)
                                                throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • getJythonAcceptArgs

        protected static java.lang.String getJythonAcceptArgs​(java.lang.Class mustImplement)
      • loadExternal

        public static java.lang.Object loadExternal​(java.lang.String tagName,
                                                    java.lang.String[] armNames,
                                                    org.w3c.dom.Element config)
                                             throws java.lang.Exception
        loads 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
      • createCalendar

        public static java.util.Calendar createCalendar​(int year,
                                                        int month,
                                                        int day,
                                                        int hour,
                                                        int minute,
                                                        int second,
                                                        boolean ceiling)
        Creates a calendar in the given year. Year must be specified, but all other fields can be -1 if unknown. If -1, they're either the greatest of least value of the calendar's current state depending on the value of ceiling.
      • fillInField

        public static void fillInField​(int field,
                                       int value,
                                       boolean ceiling,
                                       java.util.Calendar cal)
      • getEarlierSupplier

        public static MicroSecondDateSupplier getEarlierSupplier​(edu.iris.Fissures.model.TimeInterval duration)
      • getLaterSupplier

        public static MicroSecondDateSupplier getLaterSupplier​(edu.iris.Fissures.model.TimeInterval duration)
      • 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)
      • 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
        Throws:
        org.w3c.dom.DOMException
        javax.xml.transform.TransformerException
      • 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
      • 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)