org.eclipse.jetty.start
Class Config

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

public class Config
extends 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:

property expansion:

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

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

debug

public static void debug(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(Collection<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 String getMainClassname()

clearProperties

public static void clearProperties()

getProperties

public static Properties getProperties()

getProperty

public static String getProperty(String name)

getProperty

public static String getProperty(String name,
                                 String defaultValue)

getSectionClasspath

public Classpath getSectionClasspath(String sectionId)
Get the classpath for the named section

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

getSectionIds

public Set<String> getSectionIds()
Get the list of section Ids.

Returns:
the set of unique section ids

getXmlConfigs

public List<String> getXmlConfigs()

parse

public void parse(CharSequence buf)
           throws IOException
Parse the configuration

Parameters:
buf -
Throws:
IOException

parse

public void parse(InputStream stream)
           throws IOException
Parse the configuration

Parameters:
stream - the stream to read from
Throws:
IOException

parse

public void parse(Reader reader)
           throws IOException
Throws:
IOException

parse

public void parse(URL url)
           throws IOException
Throws:
IOException

setArgCount

public void setArgCount(int argCount)

setProperty

public void setProperty(String name,
                        String value)

getPolicyInstance

public Policy getPolicyInstance(ClassLoader cl)
                         throws ClassNotFoundException,
                                SecurityException,
                                NoSuchMethodException,
                                IllegalArgumentException,
                                InstantiationException,
                                IllegalAccessException,
                                InvocationTargetException
Throws:
ClassNotFoundException
SecurityException
NoSuchMethodException
IllegalArgumentException
InstantiationException
IllegalAccessException
InvocationTargetException

addActiveOption

public void addActiveOption(String option)

getActiveOptions

public Set<String> getActiveOptions()

removeActiveOption

public void removeActiveOption(String option)


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.