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

## org.eclipse.jetty.start
Class Config

    java.lang.Object
      org.eclipse.jetty.start.Config

    public class Config

extends java.lang.Object

It allows an application to be started with the command `"java -jar start.jar"`.

The behaviour of Main is controlled by the `"org/eclipse/start/start.config"` file obtained as a resource or file. This can be overridden with the START system property. The format of each line in this file is:

Each line contains entry in the format:

       SUBJECT [ [!] CONDITION [AND|OR] ]*

where SUBJECT:

- ends with `".class"` is the Main class to run.
- ends with `".xml"` is a configuration file for the command line
- ends with `"/"` is a directory from which to add all jar and zip files.
- ends with `"/*"` is a directory from which to add all unconsidered jar and zip files.
- ends with `"/**"` is a directory from which to recursively add all unconsidered jar and zip files.
- Containing `=` are used to assign system properties.
- Containing `~=` are used to assign start properties.
- Containing `/=` are used to assign a canonical path.
- all other subjects are treated as files to be added to the classpath.

property expansion:

- `${name}` is expanded to a start property
- `$(name)` is expanded to either a start property or a system property.
- The start property `${version}` is defined as the version of the start.jar

Files starting with `"/"` are considered absolute, all others are relative to the home directory.

CONDITION is one of:

- `always`
- `never`
- `available classname` - true if class on classpath
- `property name` - true if set as start property
- `system name` - true if set as system property
- `exists file` - true if file/dir exists
- `java OPERATOR version` - java version compared to literal
- `nargs OPERATOR number` - number of command line args compared to literal
- OPERATOR := one of `"<"`,`">"`,`"<="`,`">="`, `"=="`,`"!="`

CONDITIONS can be combined with `AND` `OR` or `!`, with `AND` being the assume operator for a list of CONDITIONS.

Classpath operations are evaluated on the fly, so once a class or jar is added to the classpath, subsequent available conditions will see that class.

The configuration file may be divided into sections with option names like: [ssl,default]

Note: a special discovered section identifier `[=path_to_directory/*]` is allowed to auto-create section IDs, based on directory names found in the path specified in the "path_to_directory/" part of the identifier.

Clauses after a section header will only be included if they match one of the tags in the options property. By default options are set to "default,*" or the OPTIONS property may be used to pass in a list of tags, eg. :

        java -jar start.jar OPTIONS=jetty,jsp,ssl

The tag '*' is always appended to the options, so any section with the * tag is always applied.

The property map maintained by this class is static and shared between all instances in the same classloader

Field Summary
`static java.lang.String` | `DEFAULT_SECTION`

Constructor Summary
`Config()`

Method Summary
`void` | `addActiveOption(java.lang.String option)`
`static void` | `clearProperties()`
`static void` | `debug(java.lang.String msg)`
`static void` | `debug(java.lang.Throwable t)`
`Classpath` | `getActiveClasspath()` Get the active classpath, as dictated by OPTIONS= entries.
`java.util.Set<java.lang.String>` | `getActiveOptions()`
`Classpath` | `getClasspath()` Get the default classpath.
`Classpath` | `getCombinedClasspath(java.util.Collection<java.lang.String> optionIds)` Get the combined classpath representing the default classpath plus all named sections.
`java.lang.String` | `getMainClassname()`
`java.security.Policy` | `getPolicyInstance(java.lang.ClassLoader cl)`
`static java.util.Properties` | `getProperties()`
`static java.lang.String` | `getProperty(java.lang.String name)`
`static java.lang.String` | `getProperty(java.lang.String name, java.lang.String dftValue)`
`Classpath` | `getSectionClasspath(java.lang.String sectionId)` Get the classpath for the named section
`java.util.Set<java.lang.String>` | `getSectionIds()` Get the list of section Ids.
`java.util.List<java.lang.String>` | `getXmlConfigs()`
`static boolean` | `isDebug()`
`void` | `parse(java.lang.CharSequence buf)` Parse the configuration
`void` | `parse(java.io.InputStream stream)` Parse the configuration
`void` | `parse(java.io.Reader reader)`
`void` | `parse(java.net.URL url)`
`void` | `removeActiveOption(java.lang.String option)`
`void` | `setArgCount(int argCount)`
`void` | `setProperty(java.lang.String name, java.lang.String value)`

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

Field Detail

### DEFAULT_SECTION

    public static final java.lang.String DEFAULT_SECTION

See Also:
  Constant Field Values

Constructor Detail

### Config

    public Config()

Method Detail

### isDebug

    public static boolean isDebug()

### debug

    public static void debug(java.lang.String msg)

### debug

    public static void debug(java.lang.Throwable t)

### getClasspath

    public Classpath getClasspath()

  Get the default classpath.

  Returns:
    the default classpath

### getActiveClasspath

    public Classpath getActiveClasspath()

  Get the active classpath, as dictated by OPTIONS= entries.

  Returns:
    the Active classpath
  See Also:
    `getCombinedClasspath(Collection)`

### getCombinedClasspath

    public Classpath getCombinedClasspath(java.util.Collection<java.lang.String> optionIds)

  Get the combined classpath representing the default classpath plus all named sections. NOTE: the default classpath will be prepended, and the '*' classpath will be appended.

  Parameters:
    `optionIds` - the list of section ids to fetch
  Returns:
    the `Classpath` representing combination all of the selected sectionIds, combined with the default section id, and '*' special id.

### getMainClassname

    public java.lang.String getMainClassname()

### clearProperties

    public static void clearProperties()

### getProperties

    public static java.util.Properties getProperties()

### getProperty

    public static java.lang.String getProperty(java.lang.String name)

### getProperty

    public static java.lang.String getProperty(java.lang.String name,
                                               java.lang.String dftValue)

### getSectionClasspath

    public Classpath getSectionClasspath(java.lang.String sectionId)

  Get the classpath for the named section

  Parameters:
    `sectionId` -
  Returns:
    the classpath for the specified section id

### getSectionIds

    public java.util.Set<java.lang.String> getSectionIds()

  Get the list of section Ids.

  Returns:
    the set of unique section ids

### getXmlConfigs

    public java.util.List<java.lang.String> getXmlConfigs()

### parse

    public void parse(java.lang.CharSequence buf)
               throws java.io.IOException

  Parse the configuration

  Parameters:
    `buf` -
  Throws:
    `java.io.IOException`

### parse

    public void parse(java.io.InputStream stream)
               throws java.io.IOException

  Parse the configuration

  Parameters:
    `stream` - the stream to read from
  Throws:
    `java.io.IOException`

### parse

    public void parse(java.io.Reader reader)
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### parse

    public void parse(java.net.URL url)
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### setArgCount

    public void setArgCount(int argCount)

### setProperty

    public void setProperty(java.lang.String name,
                            java.lang.String value)

### getPolicyInstance

    public java.security.Policy getPolicyInstance(java.lang.ClassLoader cl)
                                           throws java.lang.ClassNotFoundException,
                                                  java.lang.SecurityException,
                                                  java.lang.NoSuchMethodException,
                                                  java.lang.IllegalArgumentException,
                                                  java.lang.InstantiationException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

  Throws:
    `java.lang.ClassNotFoundException`
    `java.lang.SecurityException`
    `java.lang.NoSuchMethodException`
    `java.lang.IllegalArgumentException`
    `java.lang.InstantiationException`
    `java.lang.IllegalAccessException`
    `java.lang.reflect.InvocationTargetException`

### addActiveOption

    public void addActiveOption(java.lang.String option)

### getActiveOptions

    public java.util.Set<java.lang.String> getActiveOptions()

### removeActiveOption

    public void removeActiveOption(java.lang.String option)

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 © 1995-2010 Mort Bay Consulting. All Rights Reserved.