|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.extend.server.Bootstrap
public class Bootstrap
Bootstrap class. This class first tries to find home directory of the server:
Then class loader with class path is created with all jar files from lib subdirectory (of the home directory), and lib directory itself is added to the class path.
After that server directory is determined from arguments (TODO) or if none present from &quit;server/default" directory of the home directory.
Last part is to load Server
class (using reflection), pass home and server's urls to it
(in constructor) and then to invoke it calling create()
and start()
methods.
Constructor Summary | |
---|---|
Bootstrap()
|
Method Summary | |
---|---|
static Collection<URL> |
collectFiles(URL url)
Collects files from given url. |
static Collection<URL> |
collectFilesFromJar(URL original,
JarFile jarFile)
Collects files from jar file (root of) |
static Collection<URL> |
collectFilesFromPath(File path)
Collects files from given path |
static Collection<URL> |
collectFilesFromURL(URL url)
Collects files from give (generic) url |
static URLClassLoader |
createClassLoader(ClassLoader parent,
URL lib)
Creates class loader for given url. |
static URL |
getHomeLocation()
Gets home location. |
static void |
invokeMethod(Object object,
String methodName,
boolean mustBePresent)
Invokes parametherless method with given name. |
static void |
main(String[] args)
Main method |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bootstrap()
Method Detail |
---|
public static void main(String[] args) throws Exception
args
- arguments
Exception
public static URL getHomeLocation() throws MalformedURLException
MalformedURLException
public static URLClassLoader createClassLoader(ClassLoader parent, URL lib) throws IOException
parent
- parent class loader or null
lib
- url class loader to be created for.
URLClassLoader
instance
IOException
public static Collection<URL> collectFiles(URL url) throws IOException
url
- url
IOException
public static Collection<URL> collectFilesFromPath(File path) throws IOException
path
- directory
IOException
public static Collection<URL> collectFilesFromJar(URL original, JarFile jarFile) throws IOException
original
- original urljarFile
- jar file
IOException
public static Collection<URL> collectFilesFromURL(URL url) throws IOException
url
- url
IOException
public static void invokeMethod(Object object, String methodName, boolean mustBePresent)
mustBePresent
is set to true
NoSuchMethodException
is propagated wrapped in
RuntimeException
.
object
- instance on which method is going to be executedmethodName
- method namemustBePresent
- if set then method must be present or NoSuchMethodError
is thrown
RuntimeException
- if NoSuchMethodException
, IllegalArgumentException
,
IllegalAccessException
or InvocationTargetException
is thrown.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |