Class Configurator
- java.lang.Object
-
- org.codehaus.plexus.classworlds.launcher.Configurator
-
- All Implemented Interfaces:
ConfigurationHandler
public class Configurator extends java.lang.Object implements ConfigurationHandler
Launcher
configurator.
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description Configurator(ClassWorld world)
Construct.Configurator(Launcher launcher)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addImportFrom(java.lang.String relamName, java.lang.String importSpec)
Add an import specification from a realmvoid
addLoadFile(java.io.File file)
Add a file to the realmvoid
addLoadURL(java.net.URL url)
Add an URL to the realmvoid
addRealm(java.lang.String realmName)
Define a new realmvoid
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 namevoid
setClassWorld(ClassWorld world)
set world.
-
-
-
Field Detail
-
launcher
private Launcher launcher
The launcher to configure.
-
world
private ClassWorld world
-
configuredRealms
private java.util.Map<java.lang.String,ClassRealm> configuredRealms
Processed Realms.
-
curRealm
private ClassRealm curRealm
Current Realm.
-
foreignClassLoader
private java.lang.ClassLoader foreignClassLoader
-
-
Constructor Detail
-
Configurator
public Configurator(Launcher launcher)
Construct.- Parameters:
launcher
- The launcher to configure.
-
Configurator
public Configurator(ClassWorld world)
Construct.- Parameters:
world
- The classWorld to configure.
-
-
Method Detail
-
setClassWorld
public void setClassWorld(ClassWorld world)
set world. this setter is provided so you can use the same configurator to configure several "worlds"- Parameters:
world
- The classWorld to configure.
-
configure
public void configure(java.io.InputStream is) throws java.io.IOException, ConfigurationException, DuplicateRealmException, NoSuchRealmException
Configure from a file.- Parameters:
is
- The config input stream- Throws:
java.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.
-
associateRealms
public void associateRealms()
Associate parent realms with their children.
-
addImportFrom
public void addImportFrom(java.lang.String relamName, java.lang.String importSpec) throws NoSuchRealmException
Description copied from interface:ConfigurationHandler
Add an import specification from a realm- Specified by:
addImportFrom
in interfaceConfigurationHandler
- Parameters:
relamName
- the realm nameimportSpec
- the import specification- Throws:
NoSuchRealmException
- if realm doesn't exist
-
addLoadFile
public void addLoadFile(java.io.File file)
Description copied from interface:ConfigurationHandler
Add a file to the realm- Specified by:
addLoadFile
in interfaceConfigurationHandler
- Parameters:
file
- the file to load content from
-
addLoadURL
public void addLoadURL(java.net.URL url)
Description copied from interface:ConfigurationHandler
Add an URL to the realm- Specified by:
addLoadURL
in interfaceConfigurationHandler
- Parameters:
url
- the url to load content from
-
addRealm
public void addRealm(java.lang.String realmName) throws DuplicateRealmException
Description copied from interface:ConfigurationHandler
Define a new realm- Specified by:
addRealm
in interfaceConfigurationHandler
- Parameters:
realmName
- the new realm name- Throws:
DuplicateRealmException
- when realm with name already exists
-
setAppMain
public void setAppMain(java.lang.String mainClassName, java.lang.String mainRealmName)
Description copied from interface:ConfigurationHandler
Define the main class name- Specified by:
setAppMain
in interfaceConfigurationHandler
- Parameters:
mainClassName
- the main class namemainRealmName
- the main realm from which the main class is loaded
-
-