org.codehaus.plexus.classworlds.launcher

Class Configurator


public class Configurator
extends java.lang.Object

Launcher configurator.
Version:
$Id$
Authors:
bob mcwhirter
Jason van Zyl

Field Summary

static java.lang.String
IMPORT_PREFIX
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

Constructor Summary

Configurator(ClassWorld world)
Construct.
Configurator(Launcher launcher)
Construct.

Method Summary

void
associateRealms()
Associate parent realms with their children.
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.

Field Details

IMPORT_PREFIX

public static final java.lang.String IMPORT_PREFIX
Field Value:
"import"

LOAD_PREFIX

public static final java.lang.String LOAD_PREFIX
Field Value:
"load"

MAIN_PREFIX

public static final java.lang.String MAIN_PREFIX
Field Value:
"main is"

OPTIONALLY_PREFIX

public static final java.lang.String OPTIONALLY_PREFIX
Optionally spec prefix.
Field Value:
"optionally"

SET_PREFIX

public static final java.lang.String SET_PREFIX
Field Value:
"set"

Constructor Details

Configurator

public Configurator(ClassWorld world)
Construct.
Parameters:
world - The classWorld to configure.

Configurator

public Configurator(Launcher launcher)
Construct.
Parameters:
launcher - The launcher to configure.

Method Details

associateRealms

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

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:
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.

filter

protected java.lang.String filter(java.lang.String text)
            throws ConfigurationException
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(java.lang.String line,
                        ClassRealm realm)
            throws java.net.MalformedURLException,
                   java.io.FileNotFoundException
Load 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.FileNotFoundException
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:
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.

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.