public abstract class Bootstrap extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
BOOT_PROPERTIES_NAME |
protected static String |
LIBRARY_PROPERTIES_NAME |
protected static String |
OPENNMS_HOME_PROPERTY |
protected static String |
RRD_PROPERTIES_NAME |
Constructor and Description |
---|
Bootstrap() |
Modifier and Type | Method and Description |
---|---|
protected static void |
executeClass(String classToExec,
String classToExecMethod,
String[] classToExecArgs,
boolean appendClasspath) |
protected static void |
executeClass(String classToExec,
String classToExecMethod,
String[] classToExecArgs,
boolean appendClasspath,
boolean recurse) |
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,
List<URL> urls)
Add JARs found in dir to the LinkedList urls.
|
static ClassLoader |
loadClasses(String dirStr,
boolean recursive,
boolean append)
Create a ClassLoader with the JARs found in dirStr.
|
protected static void |
loadDefaultProperties() |
protected static boolean |
loadDefaultProperties(File opennmsHome)
Load default properties from the specified OpenNMS home into the
system properties.
|
protected static boolean |
loadProperties(File f)
Copy properties from a property file to the system properties.
|
protected static void |
loadProperties(InputStream is)
Copy properties from a property input stream to the system properties.
|
static void |
main(String[] args)
Bootloader main method.
|
static ClassLoader |
newClassLoader(List<URL> urls)
Create a ClassLoader with the list of URLs found in urls.
|
protected static final String BOOT_PROPERTIES_NAME
protected static final String RRD_PROPERTIES_NAME
protected static final String LIBRARY_PROPERTIES_NAME
protected static final String OPENNMS_HOME_PROPERTY
public static ClassLoader loadClasses(String dirStr, boolean recursive, boolean append) throws MalformedURLException
dirStr
- List of directories to search for JARs, separated by
File.pathSeparator
recursive
- Whether to recurse into subdirectories of the directories in
dirStrappend
- TODOClassLoader
object.MalformedURLException
- if any.public static ClassLoader loadClasses(File dir, boolean recursive) throws MalformedURLException
dir
- Directory to search for JARsrecursive
- Whether to recurse into subdirectories of dirClassLoader
object.MalformedURLException
- if any.public static ClassLoader newClassLoader(List<URL> urls)
urls
- List of URLs to add to the ClassLoader's search list.ClassLoader
object.public static void loadClasses(File dir, boolean recursive, List<URL> urls) throws MalformedURLException
dir
- Directory to search for JARsrecursive
- Whether to recurse into subdirectories of the directory in
dirurls
- LinkedList to append found JARs ontoMalformedURLException
- if any.public static File findOpenNMSHome()
protected static void loadProperties(InputStream is) throws IOException
is
- InputStream of the properties file to load.IOException
protected static boolean loadProperties(File f) throws IOException
IOException
protected static boolean loadDefaultProperties(File opennmsHome) throws IOException
opennmsHome
- the OpenNMS home directoryIOException
public static void main(String[] args) throws Exception
findOpenNMSHome
to determine the
OpenNMS home directory if the bootstrap.properties file has not yet
been loaded. Sets the opennms.home system property to the path returned
from findOpenNMSHome.loadClasses
to create
a new ClassLoader. ${opennms.home}/etc and ${opennms.home}/lib are
passed to loadClasses.args
- Command line argumentsException
- if any.protected static void executeClass(String classToExec, String classToExecMethod, String[] classToExecArgs, boolean appendClasspath) throws MalformedURLException, ClassNotFoundException, NoSuchMethodException
protected static void executeClass(String classToExec, String classToExecMethod, String[] classToExecArgs, boolean appendClasspath, boolean recurse) throws MalformedURLException, ClassNotFoundException, NoSuchMethodException
Copyright © 2015. All rights reserved.