Launcher (classworlds 1.0-rc1 API)
Keywords: com.werken.classworlds.Launcher,Launcher class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.werken.classworlds
Class Launcher

    java.lang.Object
      |
      +--com.werken.classworlds.Launcher

public class Launcher
extends java.lang.Object

Command-line invokable application launcher.

This launcher class assists in the creation of classloaders and `ClassRealm`s from a configuration file and the launching of the application's `main` method from the correct class loaded through the correct classloader.

The path to the configuration file is specified using the `classworlds.conf` system property, typically specified using the `-D` switch to `java`.

Version:
  $Id: Launcher.java,v 1.11 2003/05/03 12:49:36 bwalding Exp $
Author:
  bob mcwhirter

Constructor Summary
`Launcher()` Construct.

Method Summary
`void` | `configure(java.io.InputStream is)` Configure from a file.
`protected java.lang.reflect.Method` | `getEnhancedMainMethod()` Retrieve the enhanced main entry method.
`java.lang.Class` | `getMainClass()` Retrieve the main entry class.
`java.lang.String` | `getMainClassName()` Retrieve the main entry class name.
`protected java.lang.reflect.Method` | `getMainMethod()` Retrieve the main entry method.
`ClassRealm` | `getMainRealm()` Retrieve the main entry realm.
`java.lang.String` | `getMainRealmName()` Retrieve the main entry realm name.
`ClassWorld` | `getWorld()` Retrieve this launcher's `ClassWorld`.
`void` | `launch(java.lang.String[] args)` Launch the application.
`protected void` | `launchEnhanced(java.lang.String[] args)` Attempt to launch the application through the enhanced main method.
`protected void` | `launchStandard(java.lang.String[] args)` Attempt to launch the application through the standard main method.
`static void` | `main(java.lang.String[] args)` Launch the launcher.
`void` | `setAppMain(java.lang.String mainClassName, java.lang.String mainRealmName)` Set the application's main entrypoint.
`void` | `setWorld(ClassWorld world)` Set this launcher's `ClassWorld`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Launcher

    public Launcher()

  Construct.

Method Detail

### setAppMain

    public void setAppMain(java.lang.String mainClassName,
                           java.lang.String mainRealmName)

  Set the application's main entrypoint.

  Parameters:
    `mainClassName` - The main class name.
    `mainRealmName` - The realm to load the class from.

### getMainRealmName

    public java.lang.String getMainRealmName()

  Retrieve the main entry realm name.

  Returns:
    The main entry realm name.

### getMainClassName

    public java.lang.String getMainClassName()

  Retrieve the main entry class name.

  Returns:
    The main entry class name.

### setWorld

    public void setWorld(ClassWorld world)

  Set this launcher's `ClassWorld`.

  Parameters:
    `world` - The world.

### getWorld

    public ClassWorld getWorld()

  Retrieve this launcher's `ClassWorld`.

  Returns:
    The world.

### configure

    public void configure(java.io.InputStream is)
                   throws java.io.IOException,
                          java.net.MalformedURLException,
                          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.

### getMainClass

    public java.lang.Class getMainClass()
                                 throws java.lang.ClassNotFoundException,
                                        NoSuchRealmException

  Retrieve the main entry class.

  Returns:
    The main entry class.
  Throws:
    `java.lang.ClassNotFoundException` - If the class cannot be found.
    `NoSuchRealmException` - If the specified main entry realm does not exist.

### getMainRealm

    public ClassRealm getMainRealm()
                            throws NoSuchRealmException

  Retrieve the main entry realm.

  Returns:
    The main entry realm.
  Throws:
    `NoSuchRealmException` - If the specified main entry realm does not exist.

### getEnhancedMainMethod

    protected java.lang.reflect.Method getEnhancedMainMethod()
                                                      throws java.lang.ClassNotFoundException,
                                                             java.lang.NoSuchMethodException,
                                                             NoSuchRealmException

  Retrieve the enhanced main entry method.

  Returns:
    The enhanced main entry method.
  Throws:
    `java.lang.ClassNotFoundException` - If the main entry class cannot be found.
    `java.lang.NoSuchMethodException` - If the main entry method cannot be found.
    `NoSuchRealmException` - If the main entry realm cannot be found.

### getMainMethod

    protected java.lang.reflect.Method getMainMethod()
                                              throws java.lang.ClassNotFoundException,
                                                     java.lang.NoSuchMethodException,
                                                     NoSuchRealmException

  Retrieve the main entry method.

  Returns:
    The main entry method.
  Throws:
    `java.lang.ClassNotFoundException` - If the main entry class cannot be found.
    `java.lang.NoSuchMethodException` - If the main entry method cannot be found.
    `NoSuchRealmException` - If the main entry realm cannot be found.

### launch

    public void launch(java.lang.String[] args)
                throws java.lang.ClassNotFoundException,
                       java.lang.IllegalAccessException,
                       java.lang.reflect.InvocationTargetException,
                       java.lang.NoSuchMethodException,
                       NoSuchRealmException

  Launch the application.

  Parameters:
    `args` - The application args.
  Throws:
    `java.lang.ClassNotFoundException` - If the main entry class cannot be found.
    `java.lang.IllegalAccessException` - If the method cannot be accessed.
    `java.lang.reflect.InvocationTargetException` - If the target of the invokation is invalid.
    `java.lang.NoSuchMethodException` - If the main entry method cannot be found.
    `NoSuchRealmException` - If the main entry realm cannot be found.

### launchEnhanced

    protected void launchEnhanced(java.lang.String[] args)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.IllegalAccessException,
                                  java.lang.reflect.InvocationTargetException,
                                  java.lang.NoSuchMethodException,
                                  NoSuchRealmException

  Attempt to launch the application through the enhanced main method.

  This will seek a method with the exact signature of:

        public static void main(String[] args, ClassWorld world)

  Parameters:
    `args` - The application args.
  Throws:
    `java.lang.ClassNotFoundException` - If the main entry class cannot be found.
    `java.lang.IllegalAccessException` - If the method cannot be accessed.
    `java.lang.reflect.InvocationTargetException` - If the target of the invokation is invalid.
    `java.lang.NoSuchMethodException` - If the main entry method cannot be found.
    `NoSuchRealmException` - If the main entry realm cannot be found.

### launchStandard

    protected void launchStandard(java.lang.String[] args)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.IllegalAccessException,
                                  java.lang.reflect.InvocationTargetException,
                                  java.lang.NoSuchMethodException,
                                  NoSuchRealmException

  Attempt to launch the application through the standard main method.

  This will seek a method with the exact signature of:

        public static void main(String[] args)

  Parameters:
    `args` - The application args.
  Throws:
    `java.lang.ClassNotFoundException` - If the main entry class cannot be found.
    `java.lang.IllegalAccessException` - If the method cannot be accessed.
    `java.lang.reflect.InvocationTargetException` - If the target of the invokation is invalid.
    `java.lang.NoSuchMethodException` - If the main entry method cannot be found.
    `NoSuchRealmException` - If the main entry realm cannot be found.

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Launch the launcher.

  Parameters:
    `args` - The application command-line arguments.
  Throws:
    `java.lang.Exception` - If an error occurs.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2003 The Werken Company. All Rights Reserved.