org.codehaus.plexus.classworlds.launcher

## Class Configurator

- java.lang.Object
- - org.codehaus.plexus.classworlds.launcher.Configurator

All Implemented Interfaces:
  ConfigurationHandler

    public class Configurator
    extends Object
    implements ConfigurationHandler

`Launcher` configurator.

Author:
  bob mcwhirter, Jason van Zyl

### Constructor Summary

Constructors
Constructor and Description
`Configurator(ClassWorld world)` Construct.
`Configurator(Launcher launcher)` Construct.

### Method Summary

Methods
`void` `addImportFrom(String relamName, String importSpec)` Add an import specification from a realm
`void` `addLoadFile(File file)` Add a file to the realm
`void` `addLoadURL(URL url)` Add an URL to the realm
`void` `addRealm(String realmName)` Define a new realm
`void` `associateRealms()` Associate parent realms with their children.
`void` `configure(InputStream is)` Configure from a file.
`void` `setAppMain(String mainClassName, String mainRealmName)` Define the main class name
`void` `setClassWorld(ClassWorld world)` set world.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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(InputStream is)
                   throws IOException,
                          ConfigurationException,
                          DuplicateRealmException,
                          NoSuchRealmException

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.
  `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(String relamName,
                     String importSpec)
                       throws NoSuchRealmException

Description copied from interface: `ConfigurationHandler`
Add an import specification from a realm

Specified by:
  `addImportFrom` in interface `ConfigurationHandler`
Parameters:
  `relamName` - the realm name
  `importSpec` - the import specification
Throws:
  `NoSuchRealmException`

#### addLoadFile

    public void addLoadFile(File file)

Description copied from interface: `ConfigurationHandler`
Add a file to the realm

Specified by:
  `addLoadFile` in interface `ConfigurationHandler`
Parameters:
  `file` - the file to load content from

#### addLoadURL

    public void addLoadURL(URL url)

Description copied from interface: `ConfigurationHandler`
Add an URL to the realm

Specified by:
  `addLoadURL` in interface `ConfigurationHandler`
Parameters:
  `url` - the url to load content from

#### addRealm

    public void addRealm(String realmName)
                  throws DuplicateRealmException

Description copied from interface: `ConfigurationHandler`
Define a new realm

Specified by:
  `addRealm` in interface `ConfigurationHandler`
Parameters:
  `realmName` - the new realm name
Throws:
  `DuplicateRealmException`

#### setAppMain

    public void setAppMain(String mainClassName,
                  String mainRealmName)

Description copied from interface: `ConfigurationHandler`
Define the main class name

Specified by:
  `setAppMain` in interface `ConfigurationHandler`
Parameters:
  `mainClassName` - the main class name
  `mainRealmName` - the main realm from which the main class is loaded