|
|||||||||||
| PREV CLASS 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 String |
DEFAULT_BOOT_LIBRARY_LIST
The default list of boot libraries. |
static String |
DEFAULT_SERVER_TYPE
The default server type. |
protected List |
extraClasspath
A list of extra URLs to add to the classpath when loading the server. |
protected URL |
libraryURL
The URL where libraries are read from. |
protected Properties |
props
Configuration properties. |
| Constructor Summary | |
ServerLoader(Properties props)
Construct a ServerLoader. |
|
| Method Summary | |
void |
addLibraries(String filenames)
Add a list of comma seperated library file names. |
void |
addLibrary(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(URL url)
Add an extra URL to the classpath used to load the server. |
protected Server |
createServer(String typename,
ClassLoader classLoader)
Construct a new instance of Server, loading all required classes from the given ClossLoader. |
protected URL[] |
getBootClasspath()
Retruns an array of URLs which will be used to load the core system and construct a new Server object instance. |
protected URL |
getURL(String name)
Get a URL from configuration or system properties. |
Server |
load(ClassLoader parent)
Load a Server instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String DEFAULT_BOOT_LIBRARY_LIST
public static final String DEFAULT_SERVER_TYPE
protected Properties props
protected URL libraryURL
protected List extraClasspath
| Constructor Detail |
public ServerLoader(Properties props) throws Exception
props - Configuration properties.
Exception - Invalid configuration| Method Detail |
public void addLibrary(String filename) throws MalformedURLException
filename - A filename (no directory parts)
MalformedURLException - Could not generate URL from library URL + filenamepublic void addLibraries(String filenames) throws MalformedURLException
filenames - A list of comma seperated filenames (with no directory parts)
MalformedURLException - Could not generate URL from library URL + filenamepublic void addURL(URL url)
url - A URL to add to the classpath.protected URL getURL(String name) throws MalformedURLException
MalformedURLExceptionprotected URL[] getBootClasspath() throws MalformedURLException
MalformedURLExceptionpublic Server load(ClassLoader parent) throws Exception
Server instance.
Exception - Failed to load or create Server instance.protected Server createServer(String typename, ClassLoader classLoader) throws Exception
Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||