Package org.jumpmind.util
Class AppUtils
java.lang.Object
org.jumpmind.util.AppUtils
General application utility methods
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatStackTrace
(StackTraceElement[] stackTrace) static String
formatStackTrace
(StackTraceElement[] stackTrace, int indentSpaces, boolean indentFirst) static String
getCanonicalSymHome
(String dirName) static String
static String
static Date
getLocalDateForOffset
(String timezoneOffset) static String
static String
static String
static String
This method will return the timezone in RFC822 format.static boolean
isSystemPropertySet
(String propName, boolean defaultValue) static <T> T
newInstance
(Class<T> clazz, Class<?> defaultClass) static <T> T
newInstance
(Class<T> clazz, Class<?> defaultClass, Object[] args, Class<?>[] argTypes) static void
sleep
(long ms) Useful method to sleep that catches and ignores theInterruptedException
static void
unzip
(InputStream in, File toDir)
-
Field Details
-
SYSPROP_HOST_NAME
- See Also:
-
SYSPROP_PORT_NUMBER
- See Also:
-
SYSPROP_IP_ADDRESS
- See Also:
-
-
Constructor Details
-
AppUtils
public AppUtils()
-
-
Method Details
-
getSymHome
-
getCanonicalSymHome
-
getHostName
-
getPortNumber
-
getProtocol
-
getIpAddress
-
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
- Parameters:
timezoneOffset
- see description forgetTimezoneOffset()
- 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 theInterruptedException
- Parameters:
ms
- milliseconds to sleep
-
isSystemPropertySet
-
unzip
-
formatStackTrace
-
formatStackTrace
public static String formatStackTrace(StackTraceElement[] stackTrace, int indentSpaces, boolean indentFirst) -
newInstance
-
newInstance
-