public class GlobalSet extends AbstractGlobalGroup implements ExitCleaning, Initializable, Reloadable
Parameters to a set. On construct
the provided properties should either contain a KEY_LIST pointing
to a comma separated global properties list, or a KEY_FILE which
should point to a file in the users personal java configuration
directory Path where the names of the properties files
for all globals that comprise this global set should be
listed. Each entry found
is then used to generated a new Map object and pass it to the
AbstractParameter.createParameter(java.util.Map<java.lang.String, java.lang.String>) factory method. Additinally to
the normal
global construction the global properties are scanned for the necessity to
register additional globals to allow value generating capabilities of
the newly generated global to unfold.
| Modifier and Type | Class and Description |
|---|---|
static class |
GlobalSet.Astronomical |
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static String |
DEFTIMEPARAMETER
Default time name.
|
private Map<String,Parameter> |
global
The mapping of global-names to globals.
|
static String |
KEY_DUMP
The file where all parameter values should be stored on exit.
|
static String |
KEY_FILE
The key to a file containing a (long) list of all sensors.
|
static String |
KEY_LIST
The key to a comma-seperated list of all triggers.
|
static String |
KEY_TIMEPARAMETER
The name of the parameter delivering the current time.
|
static String |
PARENCLOSE
Curly bracket close.
|
static String |
PARENOPEN
Curly bracket open.
|
private TargetDefinition |
target
The last target that has been registered to this parameter set.
|
KEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
GlobalSet(Map<String,String> info)
Constructs a new global set with the given properties.
|
GlobalSet(Map<String,String> info,
List<Parameter> l) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addGlobalDependency(Parameter newbie) |
void |
addParameter(Parameter newbie)
Adds a parameter to the parameter set.
|
Map<String,Object> |
change(Map<String,Object> all)
Changes a bunch of parameters in this cluster.
|
static GlobalGrouping |
createInstance()
Creates a parameter set with mainly astronomic parameters
|
static GlobalGrouping |
createInstance(Collection<GlobalSet.Astronomical> ra)
Creates a parameter set with mainly astronomic parameters
|
private static GlobalGrouping |
createInstance(Map<Class<? extends Parameter>,String> cls)
Creates a parameter set given a mapping of parameter classes to possible
construction strings
|
static GlobalGrouping |
createInstance(String all)
Creates a parameter set from a string.A ll names are scanned as class
names in
the stella.parameter package.
|
private static List<Parameter> |
createList(Map<String,String> i) |
private void |
crossRegister() |
long |
currentTimeMillis()
Gets the current time as defined in the cluster.
|
void |
exit()
Performs an ordered shutdown.
|
Object |
get(String name)
Returns the parameter's value as an object or null if not found
in hashtable.
|
Set<String> |
getAllParameterNames()
Returns all names of the globals this global set serves.
|
Collection<Parameter> |
getAllParameters()
Returns all globals in this set.
|
Parameter |
getParameter(String name)
Returns the global specified by the given name.
|
TargetDefinition |
getTarget()
Returns the cached target defintion.
|
Boolean |
getTrigger(String name)
Returns the value of the specified global if the parameter is a
Trigger. |
Number |
getValue(String name)
Returns the value of the specified global if the parameter is a
Value. |
void |
init()
Initializes this global set.
|
(package private) void |
initLookup(List<Parameter> l) |
void |
registerTarget(TargetDefinition newtarget)
Sets a target to all parameters in this set.
|
double |
reload()
All reloadable
parameters itself are asked to reload themself.
|
Parameter |
removeParameter(String name)
Removes a parameter from this set.
|
double |
rescanned(String key,
String old,
String newval)
Called if the properties have changed and a reload is requested.
|
private static Class<? extends Parameter> |
resolveClass(String classname)
From a class name, get a class that is a subtype of Parameter
|
Object |
rmiGet(String name)
Returns the parameter's value as an object.
|
Set<String> |
rmiGetAllParameterNames()
Returns all names of the parameters this parameter set serves, tailored
for rmi-access.
|
Object |
set(String name,
Object val)
Sets the value of the specified parameter as in
Parameter.set(java.lang.Object)
method.Note that this may result in
an UnsupportedOperationException to be thrown if the
specified parameter does not support setting its value. |
Boolean |
setTrigger(String name,
Boolean newval)
Sets the value of the specified global.
|
Number |
setValue(String name,
Number newval)
Sets the value of the specified global.
|
Boolean |
toggleTrigger(String name)
Toggles a trigger.
|
String |
toString()
Returns a multi-lined Stringrepresentation of the parameter set.
|
createParameterCluster, getForclone, 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 PARENOPEN
public static final String PARENCLOSE
public static final String KEY_TIMEPARAMETER
public static final String KEY_LIST
public static final String KEY_FILE
public static final String KEY_DUMP
private static final String DEFTIMEPARAMETER
private TargetDefinition target
public GlobalSet(Map<String,String> info)
KEY_LIST or the KEY_FILE for
properties of the globals.
Entries in the file are one properties file per line, lines
starting with '#' are ignored.
This constructor calls the init() method if the provided file
could successfully be parsed into a collection of proprties file names.
public static final GlobalGrouping createInstance()
public static final GlobalGrouping createInstance(Collection<GlobalSet.Astronomical> ra)
public static final GlobalGrouping createInstance(String all)
private static Class<? extends Parameter> resolveClass(String classname) throws ClassNotFoundException
classname - ClassNotFoundExceptionprivate static final GlobalGrouping createInstance(Map<Class<? extends Parameter>,String> cls)
public void init()
Initialization includes instantiating of all the
globals found in the array via the
AbstractParameter.createParameter(java.util.Map<java.lang.String, java.lang.String>) factory method and registring
additional globals required if they are ParameterDepending.
init in interface Initializableprivate void crossRegister()
public void exit()
ExitCleaning interface are cleaned. No special order is
guaranteed.exit in interface ExitCleaningpublic double rescanned(String key, String old, String newval)
PropertySupplying.KEY_CLASS: If class changed, an illegal argument
exception is thrown.KEY_LIST and KEY_FILE: The parameters
served should not be changed here, this can be done
explicetly by calling addParameter(globals.Parameter).rescanned in interface Reloadablerescanned in class PropertyContainerpublic double reload()
reload in interface Reloadablereload in class PropertyContainerpublic void registerTarget(TargetDefinition newtarget)
registerTarget in interface TargetDependingpublic TargetDefinition getTarget()
getTarget in interface GlobalGroupingpublic Map<String,Object> change(Map<String,Object> all)
change in interface GlobalAccessiblepublic Collection<Parameter> getAllParameters()
getAllParameters in interface GlobalAccessiblepublic Set<String> getAllParameterNames()
getAllParameterNames in interface GlobalAccessiblepublic Set<String> rmiGetAllParameterNames() throws RemoteException
getAllParameterNames(), but pipes the
names into an individual set because the key set of a hash map is
transient.RemoteExceptionpublic Parameter getParameter(String name)
getParameter in interface GlobalAccessiblepublic Object rmiGet(String name) throws RemoteException
get(java.lang.String).RemoteExceptionpublic long currentTimeMillis()
GlobalAccessibleSystem.currentTimeMilliscurrentTimeMillis in interface GlobalAccessiblepublic Object get(String name)
get in interface GlobalAccessiblepublic Object set(String name, Object val)
Parameter.set(java.lang.Object)
method.Note that this may result in
an UnsupportedOperationException to be thrown if the
specified parameter does not support setting its value.set in interface GlobalAccessiblepublic Number getValue(String name)
Value. If the global is a RemoteParameter,
the
RemoteParameter.remoteGet() method is
querried, otherwise Value.getValue() is returned.getValue in interface GlobalAccessiblepublic Number setValue(String name, Number newval)
setValue in interface GlobalAccessiblepublic Boolean getTrigger(String name)
Trigger. If the global is a RemoteParameter,
the RemoteParameter.remoteGet() method is
querried, otherwise Triggering.getTrigger() is returned.getTrigger in interface GlobalAccessiblepublic Boolean setTrigger(String name, Boolean newval)
setTrigger in interface GlobalAccessiblepublic Boolean toggleTrigger(String name)
toggleTrigger in interface GlobalAccessiblepublic void addParameter(Parameter newbie)
DeviceTrigger.
A device trigger is linked to a command
server and gets true if the appropriate device is ready. Uses the
DeviceTrigger.KEY_PING in the server's
properties to derive the
triggers is-alive intervall. To the triggers the appropriate
servers must have been registered, the trigger must already be running.
For paramters added that are either TargetDependingParameter,
WeatherDependingParameter, ErrorDependingParameter, or
DriverDepending, the appropriate target etc. is registered.
addParameter in interface GlobalAccessibleprotected void addGlobalDependency(Parameter newbie)
newbie - public Parameter removeParameter(String name)
RemoteParameter object.removeParameter in interface GlobalAccessiblepublic String toString()
toString in class PropertyContainer