|
||||||||||
| PREV CLASS (src) NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.system.server.ServerLoader
A helper class to load a JBoss server instance.
Basic usage is something like this:
// setup the basic server config properties
Properties props = new Properties(System.getProperties());
props.put(ServerConfig.SERVER_LIBRARY_URL, "http://myserver.com/myjboss/lib/");
// set some more properties
// create a new loader to do the dirty work
ServerLoader loader = new ServerLoader(props);
// add the jaxp & jmx library to use
loader.addLibrary("crimson.jar");
loader.addLibrary("jboss-jmx-core.jar");
// load and initialize the server instance
ClassLoader parent = Thread.currentThread().getContextClassLoader();
Server server = loader.load(parent);
server.init(props);
// start up the server
server.start();
// go make some coffee, drink a beer or play GTA3
// ...
// shutdown and go to sleep
server.shutdown();
| Field Summary | |
static java.lang.String |
DEFAULT_BOOT_LIBRARY_LIST
The default list of boot libraries. |
static java.lang.String |
DEFAULT_SERVER_TYPE
The default server type. |
protected java.util.List |
extraClasspath
A list of extra URLs to add to the classpath when loading the server. |
protected java.net.URL |
libraryURL
The URL where libraries are read from. |
protected java.util.Properties |
props
Configuration properties. |
| Constructor Summary | |
ServerLoader(java.util.Properties props)
Construct a ServerLoader. |
|
| Method Summary | |
void |
addEndorsedJars()
Add the jars from the lib/endorsed dir if it exists. |
void |
addLibraries(java.lang.String filenames)
Add a list of comma seperated library file names. |
void |
addLibrary(java.lang.String filename)
Add an extra library to the end of list of libraries which will be loaded from the library URL when loading the Server class. |
void |
addURL(java.net.URL url)
Add an extra URL to the classpath used to load the server. |
protected Server (src) |
createServer(java.lang.String typename,
java.lang.ClassLoader classLoader)
Construct a new instance of Server, loading all required classes from the given ClossLoader. |
protected java.net.URL[] |
getBootClasspath()
Retruns an array of URLs which will be used to load the core system and construct a new Server object instance. |
protected java.net.URL |
getURL(java.lang.String name)
Get a URL from configuration or system properties. |
Server (src) |
load(java.lang.ClassLoader parent)
Load a Server (src) instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String DEFAULT_BOOT_LIBRARY_LIST
public static final java.lang.String DEFAULT_SERVER_TYPE
protected java.util.Properties props
protected java.net.URL libraryURL
protected java.util.List extraClasspath
| Constructor Detail |
public ServerLoader(java.util.Properties props)
throws java.lang.Exception
props - Configuration properties.
java.lang.Exception - Invalid configuration| Method Detail |
public void addLibrary(java.lang.String filename)
throws java.net.MalformedURLException
filename - A filename (no directory parts)
java.net.MalformedURLException - Could not generate URL from library URL + filename
public void addLibraries(java.lang.String filenames)
throws java.net.MalformedURLException
filenames - A list of comma seperated filenames (with no directory parts)
java.net.MalformedURLException - Could not generate URL from library URL + filenamepublic void addURL(java.net.URL url)
url - A URL to add to the classpath.
public void addEndorsedJars()
throws java.net.MalformedURLException
java.net.MalformedURLException - Could not generate URL from library URL + filename
protected java.net.URL getURL(java.lang.String name)
throws java.net.MalformedURLException
java.net.MalformedURLException
protected java.net.URL[] getBootClasspath()
throws java.net.MalformedURLException
java.net.MalformedURLException
public Server (src) load(java.lang.ClassLoader parent)
throws java.lang.Exception
Server (src) instance.
java.lang.Exception - Failed to load or create Server instance.
protected Server (src) createServer(java.lang.String typename,
java.lang.ClassLoader classLoader)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS (src) NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||