Class AppUtils

java.lang.Object
org.jumpmind.util.AppUtils

public class AppUtils extends Object
General application utility methods
  • Field Details

  • Constructor Details

    • AppUtils

      public AppUtils()
  • Method Details

    • getSymHome

      public static String getSymHome()
    • getCanonicalSymHome

      public static String getCanonicalSymHome(String dirName)
    • getHostName

      public static String getHostName()
    • getPortNumber

      public static String getPortNumber()
    • getProtocol

      public static String getProtocol()
    • getIpAddress

      public static String getIpAddress()
    • getTimezoneOffset

      public static String getTimezoneOffset()
      This method will return the timezone in RFC822 format.

      The format ("-+HH:MM") has advantages over the older timezone codes ("AAA"). The difference of 5 hours from GMT is obvious with "-05:00" but only implied with "EST". There is no ambiguity saying "-06:00", but you don't know if "CST" means Central Standard Time ("-06:00") or China Standard Time ("+08:00"). The timezone codes need to be loaded on the system, and definitions are not standardized between systems. Therefore, to remain agnostic to operating systems and databases, the RFC822 format is the best choice.

    • getLocalDateForOffset

      public static Date getLocalDateForOffset(String timezoneOffset)
      Parameters:
      timezoneOffset - see description for getTimezoneOffset()
      Returns:
      a date object that represents the local date and time at the passed in offset
    • sleep

      public static void sleep(long ms)
      Useful method to sleep that catches and ignores the InterruptedException
      Parameters:
      ms - milliseconds to sleep
    • isSystemPropertySet

      public static boolean isSystemPropertySet(String propName, boolean defaultValue)
    • unzip

      public static void unzip(InputStream in, File toDir)
    • formatStackTrace

      public static String formatStackTrace(StackTraceElement[] stackTrace)
    • formatStackTrace

      public static String formatStackTrace(StackTraceElement[] stackTrace, int indentSpaces, boolean indentFirst)
    • newInstance

      public static <T> T newInstance(Class<T> clazz, Class<?> defaultClass)
    • newInstance

      public static <T> T newInstance(Class<T> clazz, Class<?> defaultClass, Object[] args, Class<?>[] argTypes)