com.p6spy.engine.common
Class P6Util
public
class
P6Util
extends Object
Description: Utility classes
$Author: cheechq $
$Revision: 1.15 $
$Date: 2003/06/03 19:20:20 $
$Id: P6Util.java,v 1.15 2003/06/03 19:20:20 cheechq Exp $
$Log: P6Util.java,v $
Revision 1.15 2003/06/03 19:20:20 cheechq
removed unused imports
Revision 1.14 2003/04/15 02:49:09 cheechq
bug fix for jdk 1.2 support
Revision 1.13 2003/04/15 02:10:54 cheechq
jdk 1.2 support mod
Revision 1.12 2003/02/28 07:28:10 jeffgoke
added bug fix to enable jdk 1.2 support
Revision 1.11 2003/02/12 15:32:14 jeffgoke
Fixed bug where space in the realdriver name was causing the system to crash
Revision 1.10 2003/01/29 05:38:42 jeffgoke
added fix to not close reader if it is null
Revision 1.9 2003/01/28 17:00:58 jeffgoke
rewrote options to the ability for a module to have its own option set
Revision 1.8 2003/01/23 23:43:51 jeffgoke
try the thread and classloader system resources if we can't find the class loader
Revision 1.7 2003/01/23 01:40:45 jeffgoke
added code to try to use the classpath loader first, and if that fails, try our manual method
Revision 1.6 2003/01/15 22:09:41 aarvesen
Don't crap out if you can't find a context loader, press on
Revision 1.5 2003/01/10 21:39:43 jeffgoke
removed p6util.warn and moved warn handling to logging. this gives a consistent log file.
Revision 1.4 2003/01/08 18:11:13 aarvesen
Trap the no more element exception to avoid a stupid crashing bug.
Revision 1.3 2003/01/03 21:14:54 aarvesen
added the (unused) removeDots method
added the (widely used) forName method to implement better class loading
Revision 1.2 2002/10/06 18:21:37 jeffgoke
no message
Revision 1.1 2002/05/24 07:32:01 jeffgoke
version 1 rewrite
Revision 1.7 2002/05/18 06:39:52 jeffgoke
Peter Laird added Outage detection. Added junit tests for outage detection.
Fixed multi-driver tests.
Revision 1.6 2002/05/16 04:58:40 jeffgoke
Viktor Szathmary added multi-driver support.
Rewrote P6SpyOptions to be easier to manage.
Fixed several bugs.
Revision 1.5 2002/05/05 00:43:00 jeffgoke
Added Philip's reload code.
Revision 1.4 2002/04/15 05:13:32 jeffgoke
Simon Sadedin added timing support. Fixed bug where batch execute was not
getting logged. Added result set timing. Updated the log format to include
categories, and updated options to control the categories. Updated
documentation.
Revision 1.3 2002/04/10 06:49:26 jeffgoke
added more debug information and a new property for setting the log's date format
Revision 1.2 2002/04/07 20:43:59 jeffgoke
fixed bug that caused null connection to return an empty connection instead of null.
added an option allowing the user to truncate.
added a release target to the build to create the release files.
Revision 1.1.1.1 2002/04/07 04:52:26 jeffgoke
no message
Revision 1.4 2001-08-05 09:16:03-05 andy
version on the website
Revision 1.3 2001-08-02 07:52:43-05 andy
<>
Revision 1.2 2001-07-30 23:37:24-05 andy
<>
Revision 1.1 2001-07-30 23:03:32-05 andy
<>
Revision 1.0 2001-07-30 17:49:09-05 andy
Initial revision
Method Summary |
static int | atoi(Object s) |
static File | classLoadPropertyFile(URL purl) |
static String | classPathFile(String file)
Here we attempt to find the file in the current dir and the classpath
If we can't find it then we return null |
static String | dynamicGet(Class klass, String property) A utility for dynamically getting the value of a given static class
method |
static Collection | dynamicGetOptions(Class klass) |
static void | dynamicSet(Class klass, String property, String value) A utility for dynamically setting the value of a given static class
method |
static long | elapsed(Date start) |
static ArrayList | findAllMethods(Class klass) |
static Class | forName(String name)
A utiltity for using the current class loader (rather than the
system class loader) when instantiating a new class.
|
static Object | get(Class klass, String method) |
protected static String | getCheckedPath() |
protected static String | getClassPathAsString(ClassLoader classLoader) |
static String | getPath(URL theURL) |
static PrintStream | getPrintStream(String file, boolean append) |
static boolean | isTrue(String s, boolean defaultValue) |
static Properties | loadProperties(String file) |
static ArrayList | loadProperties(String file, String prefix) |
static int | parseInt(String i, int defaultValue) |
static long | parseLong(String l, long defaultValue) |
protected static void | removeDots(Properties props) |
static ArrayList | reverseArrayList(ArrayList arraylist) |
static void | set(Class klass, String method, Object[] args) |
static Date | timeNow() |
static String | timeTaken(Date start, String msg) |
public static int atoi(Object s)
public static File classLoadPropertyFile(URL purl)
public static String classPathFile(String file)
Here we attempt to find the file in the current dir and the classpath
If we can't find it then we return null
public static String dynamicGet(Class klass, String property)
A utility for dynamically getting the value of a given static class
method
public static Collection dynamicGetOptions(Class klass)
public static void dynamicSet(Class klass, String property, String value)
A utility for dynamically setting the value of a given static class
method
public static long elapsed(Date start)
public static ArrayList findAllMethods(Class klass)
public static Class forName(String name)
A utiltity for using the current class loader (rather than the
system class loader) when instantiating a new class.
The idea is that the thread's current loader might have an
obscure notion of what your class path is (e.g. an app server) that
will not be captured properly by the system class loader.
taken from http://sourceforge.net/forum/message.php?msg_id=1720229
Parameters: name class name to load
Returns: the newly loaded class
public static Object get(Class klass, String method)
protected static String getCheckedPath()
protected static String getClassPathAsString(ClassLoader classLoader)
public static String getPath(URL theURL)
public static PrintStream getPrintStream(String file, boolean append)
public static boolean isTrue(String s, boolean defaultValue)
public static Properties loadProperties(String file)
public static ArrayList loadProperties(String file, String prefix)
public static int parseInt(String i, int defaultValue)
public static long parseLong(String l, long defaultValue)
protected static void removeDots(Properties props)
public static ArrayList reverseArrayList(ArrayList arraylist)
public static void set(Class klass, String method, Object[] args)
public static Date timeNow()
public static String timeTaken(Date start, String msg)