public class Configurator
extends java.lang.Object
Launcher
configurator.Modifier and Type | Field | Description |
---|---|---|
private java.util.Map |
configuredRealms |
Processed Realms.
|
static java.lang.String |
IMPORT_PREFIX |
|
private Launcher |
launcher |
The launcher to configure.
|
static java.lang.String |
LOAD_PREFIX |
|
static java.lang.String |
MAIN_PREFIX |
|
static java.lang.String |
OPTIONALLY_PREFIX |
Optionally spec prefix.
|
static java.lang.String |
SET_PREFIX |
|
private ClassWorld |
world |
Constructor | Description |
---|---|
Configurator(ClassWorld world) |
Construct.
|
Configurator(Launcher launcher) |
Construct.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
associateRealms() |
Associate parent realms with their children.
|
private boolean |
canIgnore(java.lang.String line) |
Determine if a line can be ignored because it is
a comment or simply blank.
|
void |
configure(java.io.InputStream is) |
Configure from a file.
|
protected java.lang.String |
filter(java.lang.String text) |
Filter a string for system properties.
|
protected void |
loadGlob(java.lang.String line,
ClassRealm realm) |
Load a glob into the specified classloader.
|
protected void |
loadGlob(java.lang.String line,
ClassRealm realm,
boolean optionally) |
Load a glob into the specified classloader.
|
void |
setClassWorld(ClassWorld world) |
set world.
|
public static final java.lang.String MAIN_PREFIX
public static final java.lang.String SET_PREFIX
public static final java.lang.String IMPORT_PREFIX
public static final java.lang.String LOAD_PREFIX
public static final java.lang.String OPTIONALLY_PREFIX
private Launcher launcher
private ClassWorld world
private java.util.Map configuredRealms
public Configurator(Launcher launcher)
launcher
- The launcher to configure.public Configurator(ClassWorld world)
classWorld
- The classWorld to configure.public void setClassWorld(ClassWorld world)
classWorld
- The classWorld to configure.public void configure(java.io.InputStream is) throws java.io.IOException, java.net.MalformedURLException, ConfigurationException, DuplicateRealmException, NoSuchRealmException
is
- The config input streamjava.io.IOException
- If an error occurs reading the config file.java.net.MalformedURLException
- If the config file contains invalid URLs.ConfigurationException
- If the config file is corrupt.DuplicateRealmException
- If the config file defines two realms with the same id.NoSuchRealmException
- If the config file defines a main entry point in
a non-existent realm.protected void associateRealms()
protected void loadGlob(java.lang.String line, ClassRealm realm) throws java.net.MalformedURLException, java.io.FileNotFoundException
line
- The path configuration line.realm
- The realm to populatejava.net.MalformedURLException
- If the line does not represent
a valid path element.java.io.FileNotFoundException
- If the line does not represent
a valid path element in the filesystem.protected void loadGlob(java.lang.String line, ClassRealm realm, boolean optionally) throws java.net.MalformedURLException, java.io.FileNotFoundException
line
- The path configuration line.realm
- The realm to populateoptionally
- Whether the path is optional or requiredjava.net.MalformedURLException
- If the line does not represent
a valid path element.java.io.FileNotFoundException
- If the line does not represent
a valid path element in the filesystem.protected java.lang.String filter(java.lang.String text) throws ConfigurationException
text
- The text to filter.ConfigurationException
- If the property does not
exist or if there is a syntax error.private boolean canIgnore(java.lang.String line)
line
- The line to test.true
if the line is ignorable,
otherwise false
.