jsynoptic.ui
Class PluginLookup

java.lang.Object
  extended by jsynoptic.ui.PluginLookup

public class PluginLookup
extends java.lang.Object

This class contains utilities to get/set dynamically the class path and the native library path It is strongly dependent on Sun's JDK implementation. Patches to support other JVMs welcome :)


Field Summary
static BasicMessageWriter messageWriter
          Resources
protected static java.lang.String separator
           
protected static java.lang.Class sysclass
           
protected static java.net.URLClassLoader sysloader
           
 
Constructor Summary
PluginLookup()
           
 
Method Summary
static void addClassPath(java.io.File f)
          Adds the given file to the classpath.
static void addClassPath(java.lang.String s)
          Adds the given string to the classpath.
static void addClassPath(java.net.URL url)
          Adds the given URL to the classpath.
static void addNativePath(java.io.File localPath)
          Adds the given local path to the native library paths
static void addPluginPaths()
          This method tries to automatically add the plugin paths It looks for the main class is in the classpath Then it adds the content of the "plugins" sirectory sibling to the core one, if it exists I also adds all sub-directories found inside it as class directories, and all jars found in the subdirectories in the class path too.
static boolean addPluginPaths(boolean userChoice, java.awt.Window parentWindow)
          This method tries to add the plugin paths It looks for the main class is in the classpath Then it adds the content of the "plugins" sirectory sibling to the core one, if it exists I also adds all sub-directories found inside it as class directories, and all jars found in the subdirectories in the class path too.
static java.lang.String getClassPath()
           
static java.lang.String getNativePath()
           
static boolean isNativeLibrary(java.io.File f)
          Helper function to determine if a given file is a dynamic native library
static java.util.Vector lookup()
           
static void main(java.lang.String[] args)
           
static java.util.Vector search(java.lang.Class theClass)
          Public method to search for all implementors of a given class object, in the classpath
static java.util.Vector search(java.lang.Class theClass, java.lang.String dirOrJar, java.util.Vector entries)
           
static java.util.Vector search(java.lang.String dirOrJar, java.util.Vector entries)
           
protected static void searchFile(java.lang.Class theClass, java.io.File d, java.util.Vector results, java.lang.String prefix)
           
protected static void searchJar(java.lang.Class theClass, java.util.jar.JarFile j, java.util.Vector results)
           
protected static void testElement(java.lang.Class theClass, java.lang.String name, java.util.Vector results)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageWriter

public static BasicMessageWriter messageWriter
Resources


separator

protected static java.lang.String separator

sysloader

protected static java.net.URLClassLoader sysloader

sysclass

protected static java.lang.Class sysclass
Constructor Detail

PluginLookup

public PluginLookup()
Method Detail

testElement

protected static void testElement(java.lang.Class theClass,
                                  java.lang.String name,
                                  java.util.Vector results)

searchJar

protected static void searchJar(java.lang.Class theClass,
                                java.util.jar.JarFile j,
                                java.util.Vector results)
                         throws java.io.IOException
Throws:
java.io.IOException

searchFile

protected static void searchFile(java.lang.Class theClass,
                                 java.io.File d,
                                 java.util.Vector results,
                                 java.lang.String prefix)

search

public static java.util.Vector search(java.lang.Class theClass)
Public method to search for all implementors of a given class object, in the classpath


search

public static java.util.Vector search(java.lang.String dirOrJar,
                                      java.util.Vector entries)

search

public static java.util.Vector search(java.lang.Class theClass,
                                      java.lang.String dirOrJar,
                                      java.util.Vector entries)

lookup

public static java.util.Vector lookup()

addClassPath

public static void addClassPath(java.lang.String s)
Adds the given string to the classpath. A great thanks to java forum user 8025 = antony_miguel for dynamic classpath modification


addClassPath

public static void addClassPath(java.io.File f)
Adds the given file to the classpath. A great thanks to java forum user 8025 = antony_miguel for dynamic classpath modification


addClassPath

public static void addClassPath(java.net.URL url)
Adds the given URL to the classpath. A great thanks to java forum user 8025 = antony_miguel for dynamic classpath modification


addNativePath

public static void addNativePath(java.io.File localPath)
Adds the given local path to the native library paths


isNativeLibrary

public static boolean isNativeLibrary(java.io.File f)
Helper function to determine if a given file is a dynamic native library


addPluginPaths

public static void addPluginPaths()
This method tries to automatically add the plugin paths It looks for the main class is in the classpath Then it adds the content of the "plugins" sirectory sibling to the core one, if it exists I also adds all sub-directories found inside it as class directories, and all jars found in the subdirectories in the class path too.


addPluginPaths

public static boolean addPluginPaths(boolean userChoice,
                                     java.awt.Window parentWindow)
This method tries to add the plugin paths It looks for the main class is in the classpath Then it adds the content of the "plugins" sirectory sibling to the core one, if it exists I also adds all sub-directories found inside it as class directories, and all jars found in the subdirectories in the class path too.

Parameters:
userChoice - if true then the user can confirm the selected paths
parentWindow - the owner for the dialog box displayed in interactive mode
Returns:
false if user selects cancel

getClassPath

public static java.lang.String getClassPath()

getNativePath

public static java.lang.String getNativePath()

main

public static void main(java.lang.String[] args)