public final class CommandLineUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LOG_CONTEXT_PREFIX
Prefix of system properties used for log context.
|
static String |
SCHEME_CLASSPATH
The scheme name of Java class path.
|
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
buildPluginLoader(ClassLoader parent,
List<File> files)
Creates a class loader for loading plug-ins.
|
static Properties |
loadProperties(URI path,
ClassLoader loader)
Loads properties from the specified URI.
|
static ParameterList |
parseArguments(String arguments)
Parses the specified arguments string and returns key-value pairs.
|
static List<File> |
parseFileList(String fileListOrNull)
Parses a string of file list separated by the platform dependent path separator.
|
static void |
prepareLogContext()
Prepares log context.
|
static void |
prepareRuntimeContext()
Prepares runtime context.
|
static String |
toName(URI uri)
Returns the name of URI for hint.
|
static URI |
toUri(String path)
Converts the path to the related URI.
|
public static final String LOG_CONTEXT_PREFIX
public static final String SCHEME_CLASSPATH
public static void prepareRuntimeContext()
public static void prepareLogContext()
LOG_CONTEXT_PREFIX
),
then this method will put each key-value pairs into log MDC.public static String toName(URI uri)
uri
- the target URIIllegalArgumentException
- if some parameters were null
public static URI toUri(String path) throws URISyntaxException
path
- target pathURISyntaxException
- if failed to convert the pathIllegalArgumentException
- if some parameters were null
public static Properties loadProperties(URI path, ClassLoader loader) throws IOException
loader
's class path path
- path to the target propertiesloader
- the class loader for the scheme "classpath",
or null
to use the system class loaderIOException
- if failed to load the propertiesIllegalArgumentException
- if any parameter is null
public static List<File> parseFileList(String fileListOrNull)
fileListOrNull
- target string, or null
public static ClassLoader buildPluginLoader(ClassLoader parent, List<File> files)
parent
- parent class loader, or null
to use the system class loaderfiles
- plug-in class paths (*.jar file or class path directory)IllegalArgumentException
- if some parameters were null
public static ParameterList parseArguments(String arguments)
ArgumentList
as the goal symbol.
The each result pair will have Value_key
as its key,
and Value_value
as value.
ArgumentList:
ArgumentList "," Argument
Argument
","
(Empty)
Argument:
Value_key "=" Value_value
Value:
Character*
Character:
any character except ",", "=", "\\"
"\" any character
arguments
- the arguments represented in a string, or null
as empty argumentsCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.