|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.werken.forehead.Forehead
ClassLoader configurator and application launcher.
This is the main command-line entry-point into the
forehead
framework. Please see
the forehead
documentation for usage
instructions.
Field Summary | |
private java.util.Map |
classLoaders
ClassLoaders indexed by name. |
private java.lang.Class |
entryClass
The entry-point class. |
private ForeheadClassLoader |
entryLoader
The loader to use for entry-point lookup. |
private java.lang.reflect.Method |
entryMethod
The entry-point method. |
private static Forehead |
INSTANCE
Singleton. |
private ForeheadClassLoader |
rootLoader
Root unnamed loader. |
Constructor Summary | |
Forehead()
Construct. |
Method Summary | |
void |
config(java.io.BufferedReader in)
Configure from an BufferedReader . |
void |
config(java.io.InputStream in)
Configure from an InputStream . |
void |
config(java.io.Reader in)
Configure from an Reader . |
protected ForeheadClassLoader |
createClassLoader(ForeheadClassLoader parent,
java.lang.String name)
Create a new ClassLoader given a parent and a name. |
ForeheadClassLoader |
getClassLoader(java.lang.String name)
Retrieve a ClassLoader by name. |
static Forehead |
getInstance()
|
protected void |
load(java.lang.String line,
ForeheadClassLoader loader)
Load a glob, file, or URL into the specified classloader. |
protected void |
loadFileOrUrl(java.lang.String line,
ForeheadClassLoader loader)
Load a file or URL into the specified classloader. |
protected void |
loadGlob(java.lang.String line,
ForeheadClassLoader loader)
Load a glob into the specified classloader. |
static void |
main(java.lang.String[] args)
Main. |
java.lang.String |
resolveProperties(java.lang.String input,
java.util.Properties props)
Resolve imported properties. |
void |
run(java.lang.String[] args)
Launch the wrapped application. |
protected void |
setupEntry(java.lang.String line)
Setup the entry-point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Forehead INSTANCE
private java.util.Map classLoaders
private ForeheadClassLoader rootLoader
private ForeheadClassLoader entryLoader
private java.lang.Class entryClass
private java.lang.reflect.Method entryMethod
Constructor Detail |
public Forehead()
Method Detail |
public void config(java.io.InputStream in) throws ForeheadException, java.io.IOException, java.lang.ClassNotFoundException
InputStream
.
in
- InputStream
carrying configuration information.
ForeheadException
- If there is an error during configuration.
java.io.IOException
- If there is an error reading configuration information.
java.lang.ClassNotFoundException
- If unable to locate entry-point class.public void config(java.io.Reader in) throws ForeheadException, java.io.IOException, java.lang.ClassNotFoundException
Reader
.
in
- Reader
carrying configuration information.
ForeheadException
- If there is an error during configuration.
java.io.IOException
- If there is an error reading configuration information.
java.lang.ClassNotFoundException
- If unable to locate entry-point class.public void config(java.io.BufferedReader in) throws ForeheadException, java.io.IOException, java.lang.ClassNotFoundException
BufferedReader
.
in
- BufferedReader
carrying configuration information.
ForeheadException
- If there is an error during configuration.
java.io.IOException
- If there is an error reading configuration information.
java.lang.ClassNotFoundException
- If unable to locate entry-point class.protected void setupEntry(java.lang.String line) throws MalformedEntryDescriptorException, NoSuchClassLoaderException, java.lang.ClassNotFoundException
line
- The entry-point configuration line.
MalformedEntryDescriptorException
- If the entry-point descriptor is malformed.
NoSuchClassLoaderException
- If the entry-point descriptor references
an unknown ClassLoader.
java.lang.ClassNotFoundException
- If unable to locate the entry-point class.protected void load(java.lang.String line, ForeheadClassLoader loader) throws java.net.MalformedURLException
line
- The path configuration line.loader
- The loader to populate
java.net.MalformedURLException
- If the line does not represent
a valid path element.protected void loadGlob(java.lang.String line, ForeheadClassLoader loader) throws java.net.MalformedURLException
line
- The path configuration line.loader
- The loader to populate
java.net.MalformedURLException
- If the line does not represent
a valid path element.protected void loadFileOrUrl(java.lang.String line, ForeheadClassLoader loader) throws java.net.MalformedURLException
line
- The path configuration line.loader
- The loader to populate
java.net.MalformedURLException
- If the line does not represent
a valid path element.protected ForeheadClassLoader createClassLoader(ForeheadClassLoader parent, java.lang.String name)
parent
- The parent of the ClassLoader to create.name
- The name of the ClassLoader to create.
ClassLoader
.public ForeheadClassLoader getClassLoader(java.lang.String name)
name
- The name of the ClassLoader to retrieve.
null
if none.public java.lang.String resolveProperties(java.lang.String input, java.util.Properties props)
input
- The string input to resolve properties.props
- Properties to resolve against.
public void run(java.lang.String[] args) throws NoSuchEntryMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
args
- Command-line args to pass to wrapped application.
NoSuchEntryMethodException
- If unable to find the entry method on the class.
java.lang.IllegalAccessException
- If an error occurs while attempting to invoke the
entry-point method.
java.lang.reflect.InvocationTargetException
- If an error occurs while attempting to invoke the
entry-point method.public static Forehead getInstance()
public static void main(java.lang.String[] args)
args
- Command-line arguments to pass to the wrapped
application.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |