Package org.codehaus.classworlds
Class Configurator
- java.lang.Object
-
- org.codehaus.classworlds.Configurator
-
public class Configurator extends java.lang.ObjectLauncherconfigurator.- Version:
- $Id: Configurator.java 126 2006-01-12 04:17:51Z $
- Author:
- bob mcwhirter, Jason van Zyl
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.MapconfiguredRealmsProcessed Realms.static java.lang.StringIMPORT_PREFIXprivate LauncherlauncherThe launcher to configure.static java.lang.StringLOAD_PREFIXstatic java.lang.StringMAIN_PREFIXstatic java.lang.StringOPTIONALLY_PREFIXOptionally spec prefix.static java.lang.StringSET_PREFIXprivate ClassWorldworld
-
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 protected voidassociateRealms()Associate parent realms with their children.private booleancanIgnore(java.lang.String line)Determine if a line can be ignored because it is a comment or simply blank.voidconfigure(java.io.InputStream is)Configure from a file.protected java.lang.Stringfilter(java.lang.String text)Filter a string for system properties.protected voidloadGlob(java.lang.String line, ClassRealm realm)Load a glob into the specified classloader.protected voidloadGlob(java.lang.String line, ClassRealm realm, boolean optionally)Load a glob into the specified classloader.voidsetClassWorld(ClassWorld world)set world.
-
-
-
Field Detail
-
MAIN_PREFIX
public static final java.lang.String MAIN_PREFIX
- See Also:
- Constant Field Values
-
SET_PREFIX
public static final java.lang.String SET_PREFIX
- See Also:
- Constant Field Values
-
IMPORT_PREFIX
public static final java.lang.String IMPORT_PREFIX
- See Also:
- Constant Field Values
-
LOAD_PREFIX
public static final java.lang.String LOAD_PREFIX
- See Also:
- Constant Field Values
-
OPTIONALLY_PREFIX
public static final java.lang.String OPTIONALLY_PREFIX
Optionally spec prefix.- See Also:
- Constant Field Values
-
launcher
private Launcher launcher
The launcher to configure.
-
world
private ClassWorld world
-
configuredRealms
private java.util.Map configuredRealms
Processed Realms.
-
-
Constructor Detail
-
Configurator
public Configurator(Launcher launcher)
Construct.- Parameters:
launcher- The launcher to configure.
-
Configurator
public Configurator(ClassWorld world)
Construct.- Parameters:
classWorld- 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:
classWorld- The classWorld to configure.
-
configure
public void configure(java.io.InputStream is) throws java.io.IOException, java.net.MalformedURLException, ConfigurationException, DuplicateRealmException, NoSuchRealmExceptionConfigure 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
protected void associateRealms()
Associate parent realms with their children.
-
loadGlob
protected void loadGlob(java.lang.String line, ClassRealm realm) throws java.net.MalformedURLException, java.io.FileNotFoundExceptionLoad a glob into the specified classloader.- Parameters:
line- The path configuration line.realm- The realm to populate- Throws:
java.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.
-
loadGlob
protected void loadGlob(java.lang.String line, ClassRealm realm, boolean optionally) throws java.net.MalformedURLException, java.io.FileNotFoundExceptionLoad a glob into the specified classloader.- Parameters:
line- The path configuration line.realm- The realm to populateoptionally- Whether the path is optional or required- Throws:
java.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.
-
filter
protected java.lang.String filter(java.lang.String text) throws ConfigurationExceptionFilter a string for system properties.- Parameters:
text- The text to filter.- Returns:
- The filtered text.
- Throws:
ConfigurationException- If the property does not exist or if there is a syntax error.
-
canIgnore
private boolean canIgnore(java.lang.String line)
Determine if a line can be ignored because it is a comment or simply blank.- Parameters:
line- The line to test.- Returns:
trueif the line is ignorable, otherwisefalse.
-
-