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:
".class" is the Main class to run.".xml" is a configuration file for the command line"/" is a directory from which to add all jar and zip files."/*" is a directory from which to add all unconsidered jar and zip files."/**" is a directory from which to recursively add all unconsidered jar and zip files.= are used to assign system properties.~= are used to assign start properties./= are used to assign a canonical path.property expansion:
${name} is expanded to a start property$(name) is expanded to either a start property or a system 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:
alwaysneveravailable classname - true if class on classpathproperty name - true if set as start propertysystem name - true if set as system propertyexists file - true if file/dir existsjava OPERATOR version - java version compared to literalnargs OPERATOR number - number of command line args compared to literal"<",">","<=",">=",
"==","!="
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
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_SECTION |
| Constructor and Description |
|---|
Config() |
| Modifier and Type | Method and Description |
|---|---|
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() |
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) |
public static final String DEFAULT_SECTION
public static boolean isDebug()
public static void debug(String msg)
public static void debug(Throwable t)
public Classpath getClasspath()
public Classpath getActiveClasspath()
getCombinedClasspath(Collection)public Classpath getCombinedClasspath(Collection<String> optionIds)
optionIds - the list of section ids to fetchClasspath representing combination all of the selected sectionIds, combined with the default
section id, and '*' special id.public String getMainClassname()
public static void clearProperties()
public static Properties getProperties()
public Classpath getSectionClasspath(String sectionId)
sectionId - public Set<String> getSectionIds()
public void parse(CharSequence buf) throws IOException
buf - IOExceptionpublic void parse(InputStream stream) throws IOException
stream - the stream to read fromIOExceptionpublic void parse(Reader reader) throws IOException
IOExceptionpublic void parse(URL url) throws IOException
IOExceptionpublic void setArgCount(int argCount)
public void addActiveOption(String option)
public void removeActiveOption(String option)
Copyright © 2016. All rights reserved.