public class Configurator extends java.lang.Object implements ConfigurationHandler
Launcher
configurator.Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,ClassRealm> |
configuredRealms
Processed Realms.
|
private ClassRealm |
curRealm
Current Realm.
|
private java.lang.ClassLoader |
foreignClassLoader |
private Launcher |
launcher
The launcher to configure.
|
private ClassWorld |
world |
Constructor and Description |
---|
Configurator(ClassWorld world)
Construct.
|
Configurator(Launcher launcher)
Construct.
|
Modifier and Type | Method and Description |
---|---|
void |
addImportFrom(java.lang.String relamName,
java.lang.String importSpec)
Add an import specification from a realm
|
void |
addLoadFile(java.io.File file)
Add a file to the realm
|
void |
addLoadURL(java.net.URL url)
Add an URL to the realm
|
void |
addRealm(java.lang.String realmName)
Define a new realm
|
void |
associateRealms()
Associate parent realms with their children.
|
void |
configure(java.io.InputStream is)
Configure from a file.
|
void |
setAppMain(java.lang.String mainClassName,
java.lang.String mainRealmName)
Define the main class name
|
void |
setClassWorld(ClassWorld world)
set world.
|
private Launcher launcher
private ClassWorld world
private java.util.Map<java.lang.String,ClassRealm> configuredRealms
private ClassRealm curRealm
private java.lang.ClassLoader foreignClassLoader
public Configurator(Launcher launcher)
launcher
- The launcher to configure.public Configurator(ClassWorld world)
world
- The classWorld to configure.public void setClassWorld(ClassWorld world)
world
- The classWorld to configure.public void configure(java.io.InputStream is) throws java.io.IOException, 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.public void associateRealms()
public void addImportFrom(java.lang.String relamName, java.lang.String importSpec) throws NoSuchRealmException
ConfigurationHandler
addImportFrom
in interface ConfigurationHandler
relamName
- the realm nameimportSpec
- the import specificationNoSuchRealmException
public void addLoadFile(java.io.File file)
ConfigurationHandler
addLoadFile
in interface ConfigurationHandler
file
- the file to load content frompublic void addLoadURL(java.net.URL url)
ConfigurationHandler
addLoadURL
in interface ConfigurationHandler
url
- the url to load content frompublic void addRealm(java.lang.String realmName) throws DuplicateRealmException
ConfigurationHandler
addRealm
in interface ConfigurationHandler
realmName
- the new realm nameDuplicateRealmException
public void setAppMain(java.lang.String mainClassName, java.lang.String mainRealmName)
ConfigurationHandler
setAppMain
in interface ConfigurationHandler
mainClassName
- the main class namemainRealmName
- the main realm from which the main class is loaded