public class TargetList extends AbstractParameter implements TargetProviding<SporeTarget>, Reloadable
get() method. Default action is to check if the #KEY_FILE
property is set. If so, the file is located via the inherited
ResourceSupplying.KEY_URLRESOURCES and the targets are loaded as
ParsedTargets into
an internal list during initialization.
This target is exit cleaning, meaning that the total list of targets hosted
by this parameter is dumped when the KEY_DUMP key is present.
In the current version, KEY_DUMP should point to a directory,
where all targets are dumped.
The parameter is reloadable in a sense that its properties might be changed, then restore target is called.
TargetList.TargetDump| Modifier and Type | Class and Description |
|---|---|
static class |
TargetList.Check
Checks the file given on the command line.
|
static class |
TargetList.Invoke
Mainly used for parsing input-xml files and writing them as serialized
targets.
|
static class |
TargetList.TargetDump
A class that is a thread and dumps all of the targets registered at
VM-exit to the scheduler to the dump directory.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private Collection<SporeTarget> |
alltargets
A list containing all targets, even those not wanted.
|
private static boolean |
DEFIGNORESERIAL
Default ignore of serialized targtes.
|
static String |
DEFNAME
The default name of the target list.
|
private static String |
DEFURLRESOURCES
The default path for resource loccation.
|
static String |
KEY_CHAINFILE
The file holding targets relevant only for chained targets.
|
static String |
KEY_DUMP
The file holding target-xml file names.
|
static String |
KEY_HISTORYDB
If present, the properties of the history database.
|
static String |
KEY_IGNORESERIAL
If pointing to true, serialized versions are always ignored.
|
static String |
KEY_REMOVE
The key to the comma-list of unwanted targets.
|
static String |
KEY_STELLA
The telescope we work on.
|
static String |
KEY_TARGETDB
If present, the properties of the target database.
|
static String |
KEY_TARGETFILE
The file holding target-xml file names.
|
private Collection<SporeTarget> |
targets
A list of parsed targets used.
|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORSERIAL, XMLCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
TargetList(Map<String,String> sprop)
Constructs a new target list parameter.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Object dom)
Adds a new target to this scheduler.
|
boolean |
addTarget(SporeTarget dom)
Add a target to all targets.
|
void |
clear()
Empties the targets hash map.
|
void |
exit()
Exits this parameter.
|
Object |
get()
Returns the
Collection of targets currently handled by the
target list. |
Collection<SporeTarget> |
getActiveTargets()
Returns all active targets.
|
List<String> |
getAllNames()
Returns a set of all target names.
|
Collection<SporeTarget> |
getAllTargets()
Returns all targets known to this provider.
|
Collection<SporeTarget> |
getCompletedTargets()
Parsed Targets provide a complete flag.
|
SporeTarget |
getFromActive(String name)
Gets from all targets.
|
SporeTarget |
getFromAll(String name)
Gets from all targets.
|
private SporeTarget |
getTargetFromResource(String xmlname)
Returns a parsed document from a resource.
|
void |
init()
The init section.
|
private SporeTarget |
parseTargetResource(URL xml,
URL serial)
Returns the newer of two versions.
|
double |
reload()
Calls the super method and then restores my targets.
|
boolean |
remove(TargetDefinition dom)
Removes the target-defining DOM from the scheduler, classified
by its name.
|
boolean |
removeTarget(SporeTarget dom)
Removes the target-defining DOM from the scheduler, classified
by its name.
|
double |
rescanned(String key,
String old,
String newval)
Makes this method public, no further changes.
|
private Collection<SporeTarget> |
resolveFileTargets(List<String> files)
Reads the file indicated by the argument.
|
boolean |
restore()
Restores all targets.
|
boolean |
restoreTargets()
Restores all targets.
|
Object |
set(Object list)
Loads a list of target definitions to this scheduler.
|
createParameter, delivers, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, overrideDefaultName, register, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiespublic static final String KEY_TARGETFILE
public static final String KEY_CHAINFILE
public static final String KEY_REMOVE
public static final String KEY_IGNORESERIAL
public static final String KEY_DUMP
public static final String KEY_HISTORYDB
public static final String KEY_TARGETDB
public static final String KEY_STELLA
public static final String DEFNAME
private static final String DEFURLRESOURCES
private static final boolean DEFIGNORESERIAL
private Collection<SporeTarget> targets
private Collection<SporeTarget> alltargets
public void init()
throws InitException
KEY_TARGETFILE is set, the target list
is searched, read and passed to the resolveFileTargets(java.util.List<java.lang.String>)
method.init in interface Initializableinit in class AbstractParameterInitExceptionpublic double rescanned(String key, String old, String newval)
rescanned in interface Reloadablerescanned in class AbstractParameterpublic double reload()
reload in interface Reloadablereload in class PropertyContainerpublic Collection<SporeTarget> getCompletedTargets()
getCompletedTargets in interface TargetProviding<SporeTarget>HistoryAware,
Appointablepublic Collection<SporeTarget> getAllTargets()
TargetProvidinggetAllTargets in interface TargetProviding<SporeTarget>public Collection<SporeTarget> getActiveTargets()
TargetProvidingTargetProviding.getAllTargets().getActiveTargets in interface TargetProviding<SporeTarget>public boolean restore()
restore in interface TargetProviding<SporeTarget>public boolean restoreTargets()
public void exit()
KEY_DUMP key points to a
directory, all targets hosted by this parameter are dumped as xml-files
into the specified directory.exit in interface ExitCleaningexit in class AbstractParameterpublic Object set(Object list)
SporeTargets.
Only these enter the final set.public Object get()
Collection of targets currently handled by the
target list.public SporeTarget getFromAll(String name)
getFromAll in interface TargetProviding<SporeTarget>public SporeTarget getFromActive(String name)
getFromActive in interface TargetProviding<SporeTarget>public boolean add(Object dom)
SporeTarget.
It's priority is also retrieved and, if valid, added to the look-up
table matching priorities to target names. If the argument is
null false is returned.target - An object that must be an instance of
SporeTarget.IllegalArgumentException - If the argument is not an instance of
SporeTarget.public boolean addTarget(SporeTarget dom)
TargetProvidingaddTarget in interface TargetProviding<SporeTarget>public boolean removeTarget(SporeTarget dom)
removeTarget in interface TargetProviding<SporeTarget>public boolean remove(TargetDefinition dom)
public void clear()
clear in interface TargetProviding<SporeTarget>public List<String> getAllNames()
private Collection<SporeTarget> resolveFileTargets(List<String> files)
ResourceSupplying.KEY_URLRESOURCES property is given, the files are assumed to
lie
underneath this dir.DOMTarget#parseTarget
method.
The parsed documents are then returned in a target set.file - An object of the file typeprivate SporeTarget getTargetFromResource(String xmlname)
private SporeTarget parseTargetResource(URL xml, URL serial)