org.codehaus.plexus.classworlds.launcher

Class Configurator

public class Configurator extends Object

Launcher configurator.

Version: $Id$

Author: bob mcwhirter Jason van Zyl

Field Summary
MapconfiguredRealms
Processed Realms.
static StringIMPORT_PREFIX
Launcherlauncher
The launcher to configure.
static StringLOAD_PREFIX
static StringMAIN_PREFIX
static StringOPTIONALLY_PREFIX
Optionally spec prefix.
static StringSET_PREFIX
ClassWorldworld
Constructor Summary
Configurator(Launcher launcher)
Construct.
Configurator(ClassWorld world)
Construct.
Method Summary
voidassociateRealms()
Associate parent realms with their children.
booleancanIgnore(String line)
Determine if a line can be ignored because it is a comment or simply blank.
voidconfigure(InputStream is)
Configure from a file.
protected Stringfilter(String text)
Filter a string for system properties.
protected voidloadGlob(String line, ClassRealm realm)
Load a glob into the specified classloader.
protected voidloadGlob(String line, ClassRealm realm, boolean optionally)
Load a glob into the specified classloader.
voidsetClassWorld(ClassWorld world)
set world. this setter is provided so you can use the same configurator to configure several "worlds"

Field Detail

configuredRealms

private Map configuredRealms
Processed Realms.

IMPORT_PREFIX

public static final String IMPORT_PREFIX

launcher

private Launcher launcher
The launcher to configure.

LOAD_PREFIX

public static final String LOAD_PREFIX

MAIN_PREFIX

public static final String MAIN_PREFIX

OPTIONALLY_PREFIX

public static final String OPTIONALLY_PREFIX
Optionally spec prefix.

SET_PREFIX

public static final String SET_PREFIX

world

private ClassWorld world

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

associateRealms

public void associateRealms()
Associate parent realms with their children.

canIgnore

private boolean canIgnore(String line)
Determine if a line can be ignored because it is a comment or simply blank.

Parameters: line The line to test.

Returns: true if the line is ignorable, otherwise false.

configure

public void configure(InputStream is)
Configure from a file.

Parameters: is The config input stream

Throws: IOException If an error occurs reading the config file. MalformedURLException If the config file contains invalid URLs. ConfigurationException If the config file is corrupt. org.codehaus.plexus.classworlds.realm.DuplicateRealmException If the config file defines two realms with the same id. org.codehaus.plexus.classworlds.realm.NoSuchRealmException If the config file defines a main entry point in a non-existent realm.

filter

protected String filter(String text)
Filter 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.

loadGlob

protected void loadGlob(String line, ClassRealm realm)
Load a glob into the specified classloader.

Parameters: line The path configuration line. realm The realm to populate

Throws: MalformedURLException If the line does not represent a valid path element. FileNotFoundException If the line does not represent a valid path element in the filesystem.

loadGlob

protected void loadGlob(String line, ClassRealm realm, boolean optionally)
Load a glob into the specified classloader.

Parameters: line The path configuration line. realm The realm to populate optionally Whether the path is optional or required

Throws: MalformedURLException If the line does not represent a valid path element. FileNotFoundException If the line does not represent a valid path element in the filesystem.

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.