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 |
OPENNMS_PROPERTIES_D_NAME |
protected static String |
OPENNMS_PROPERTIES_NAME |
protected static String |
RRD_PROPERTIES_NAME |
protected static Path |
VERSION_PROPERTIES |
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) |
protected static File |
findOpenNMSHome()
Find the OpenNMS home directory.
|
static File |
findOpenNMSHomeUsingJarPath()
Determine the OpenNMS home directory based on the location of the JAR
file containing this code.
|
protected static List<File> |
getPropertiesFiles(File opennmsHome)
Retrieves the list of configuration files containing
system properties to be set.
|
protected static boolean |
isValidOpenNMSHome(File opennmsHome)
Validates the OpenNMS home directory by checking
for known mandatory files.
|
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 |
loadSystemProperties(File opennmsHome)
Load default properties from the specified OpenNMS home into 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 Path VERSION_PROPERTIES
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_PROPERTIES_NAME
protected static final String OPENNMS_PROPERTIES_D_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
dirStr.append
- Append the URLs of the current {@link java.lang.Thread#getContextClassLoader())
to this classloader.ClassLoader
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.protected static List<File> getPropertiesFiles(File opennmsHome)
opennmsHome
- the OpenNMS home directoryprotected static void loadSystemProperties(File opennmsHome) throws IOException
opennmsHome
- the OpenNMS home directoryIOException
protected static boolean isValidOpenNMSHome(File opennmsHome)
opennmsHome
- the OpenNMS home directoryprotected static File findOpenNMSHome() throws Exception
Exception
public static File findOpenNMSHomeUsingJarPath()
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 ClassNotFoundException, NoSuchMethodException, IOException
protected static void executeClass(String classToExec, String classToExecMethod, String[] classToExecArgs, boolean appendClasspath, boolean recurse) throws ClassNotFoundException, NoSuchMethodException, IOException
Copyright © 2021. All rights reserved.