org.opennms.bootstrap
Class Bootstrap

java.lang.Object
  extended by org.opennms.bootstrap.Bootstrap

public class Bootstrap
extends Object

Bootstrap application for starting OpenNMS.


Constructor Summary
Bootstrap()
           
 
Method Summary
static File findOpenNMSHome()
          Determine the OpenNMS home directory based on the location of the JAR file containing this code.
static ClassLoader loadClasses(File dir, boolean recursive)
          Create a ClassLoader with the JARs found in dir.
static void loadClasses(File dir, boolean recursive, LinkedList<URL> urls)
          Add JARs found in dir to the LinkedList urls.
static ClassLoader loadClasses(String dirStr, boolean recursive)
          Create a ClassLoader with the JARs found in dirStr.
static void main(String[] args)
          Bootloader main method.
static ClassLoader newClassLoader(LinkedList<URL> urls)
          Create a ClassLoader with the list of URLs found in urls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bootstrap

public Bootstrap()
Method Detail

loadClasses

public static ClassLoader loadClasses(String dirStr,
                                      boolean recursive)
                               throws MalformedURLException
Create a ClassLoader with the JARs found in dirStr.

Parameters:
dirStr - List of directories to search for JARs, separated by File.pathSeparator
recursive - Whether to recurse into subdirectories of the directories in dirStr
Throws:
MalformedURLException

loadClasses

public static ClassLoader loadClasses(File dir,
                                      boolean recursive)
                               throws MalformedURLException
Create a ClassLoader with the JARs found in dir.

Parameters:
dir - Directory to search for JARs
recursive - Whether to recurse into subdirectories of dir
Throws:
MalformedURLException

newClassLoader

public static ClassLoader newClassLoader(LinkedList<URL> urls)
Create a ClassLoader with the list of URLs found in urls.

Parameters:
urls - List of URLs to add to the ClassLoader's search list.

loadClasses

public static void loadClasses(File dir,
                               boolean recursive,
                               LinkedList<URL> urls)
                        throws MalformedURLException
Add JARs found in dir to the LinkedList urls.

Parameters:
dir - Directory to search for JARs
recursive - Whether to recurse into subdirectories of the directory in dir
urls - LinkedList to append found JARs onto
Throws:
MalformedURLException

findOpenNMSHome

public static File findOpenNMSHome()
Determine the OpenNMS home directory based on the location of the JAR file containing this code. Finds the JAR file containing this code, and if it is found, the file name of the JAR (e.g.: opennms_bootstrap.jar) and its parent directory (e.g.: the lib directory) are removed from the path and the resulting path (e.g.: /opt/OpenNMS) is returned.

Returns:
Home directory or null if it couldn't be found

main

public static void main(String[] args)
                 throws Exception
Bootloader main method. Takes the following steps to initialize a ClassLoader, set properties, and start OpenNMS:

Parameters:
args - Command line arguments
Throws:
Exception


Copyright ? 2007. All Rights Reserved.