public class Config extends Object
Modifier and Type | Method and Description |
---|---|
Section |
addSection(String name)
Define a new section with a given name and makes the new section the active section.
|
static boolean |
checkDirection(String direction)
Check if a direction is an allowed value.
|
void |
dump(PrintStream out)
Display the in-memory sections to an opened
PrintStream . |
static String |
findRoot()
Search for the root folder of a Mimic managed collection starting with the current folder.
|
static String |
findRoot(String path)
Search for the root folder of a Mimic managed collection starting with the given folder.
|
ArrayList<Section> |
getSection(String name)
Search the in-memory list of sections and return a list of sections with the given name.
|
ArrayList<Section> |
getSection(String name,
String tag)
Search the in-memory list of sections with the given name and assigned tag and return a list of matching sections.
|
Section |
getSectionFirst(String name)
Search the in-memory list of sections and return the first section with the given name.
|
Section |
getSectionFirst(String name,
String tag)
Search the in-memory list of sections and return the first section with the given name and tag name.
|
void |
init()
Initialize a collection for management with Mimic.
|
boolean |
load()
Load a configuration file into memory.
|
static void |
main(String[] args)
Command-line interface.
|
static void |
setMessage(String flags)
Set what messages to output based on character codes.
|
void |
setProperty(Section section,
String name,
String value)
Set the value of a property for a section.
|
void |
setProperty(String name,
String value)
Set the value of a property for the active section.
|
void |
showHelp()
Show the help for the tool.
|
void |
store()
Store in-memory configuration sections in the configuration file.
|
public Config()
public Config(String pathname)
public static void main(String[] args)
args
- command-line arguments.public void showHelp()
public void init() throws IOException
IOException
- if unable to create new configuration file.public void store() throws IOException
IOException
- if unable to write configuration file.public boolean load() throws IOException
IOException
- if unable to open or read configuration file.public static boolean checkDirection(String direction)
direction
- the direction value to check.public Section addSection(String name)
name
- the name to assign to the section.Section
public ArrayList<Section> getSection(String name)
public ArrayList<Section> getSection(String name, String tag)
public Section getSectionFirst(String name)
name
- the name of the section to find.Section
for the matching section, or null if no section was found.public Section getSectionFirst(String name, String tag)
name
- the name of the section to find.tag
- the tag name within a section to find.Section
for the matching section, or null if no section was found.public void setProperty(String name, String value)
name
- the name of the property.value
- the value to assign to the property.public void setProperty(Section section, String name, String value)
section
- the section in which to define the property.name
- the name of the property.value
- the value to assign to the property.public static String findRoot()
public static String findRoot(String path)
public static void setMessage(String flags)
flags
- sequence of flag character codes.public void dump(PrintStream out)
PrintStream
.out
- an opened PrintStream
Copyright © 2014-2016 Regents University of California. All Rights Reserved.