stella.parameter
Class SwitchStub
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.ParameterStub
stella.parameter.TriggerStub
stella.parameter.SwitchStub
- All Implemented Interfaces:
- Cloneable, Runnable, Remote, Parameter, Switch, Trigger, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying, RmiListener
public class SwitchStub
- extends TriggerStub
- implements Switch
The stub representation for a remote switch. The remote value bound to is
normally a RS485Switch or a OneWireSwitch. This class
provides local access to the turning the switch. This classes should always
set the blocking property to true, as we first try to get the switch's
state before we turn.
|
Constructor Summary |
SwitchStub(Map prop)
Constructs a new switch stub. |
SwitchStub(String remotename)
For convenience, we support a constructor with only the remote name. |
|
Method Summary |
boolean |
turnOff()
If the remote parameter we are registered to is a RemoteSwitch,
we try to turn it. |
boolean |
turnOn(long timeout)
If the remote parameter we are registered to is a RemoteSwitch,
we try to turn it. |
| Methods inherited from class stella.parameter.ParameterStub |
cancel, disconnect, exit, getAsociatedThread, getFormatted, init, isConnected, maxTimeToCancel, rebind, rescanned, run, set |
| Methods inherited from class util.PropertyResources |
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
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, reload, removeProperty, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from interface util.PropertySupplying |
defaultBoolean, 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, stringProperties |
SwitchStub
public SwitchStub(String remotename)
throws RemoteException
- For convenience, we support a constructor with only the remote name.
- Throws:
RemoteException
SwitchStub
public SwitchStub(Map prop)
throws RemoteException
- Constructs a new switch stub. This parameter connects to a remote
switch.
- Throws:
RemoteException
turnOn
public boolean turnOn(long timeout)
- If the remote parameter we are registered to is a
RemoteSwitch,
we try to turn it. To ensure a proper handle to the remote parameter,
we first try to get the value, which ensures proper binding if the
ParameterStub.KEY_BLOCK property is true.
- Specified by:
turnOn in interface Switch
- Parameters:
timeout - The maximum time the switch should be on (ms), zero for
unlimited.
- Returns:
- True, if switch was successfully turned on.
turnOff
public boolean turnOff()
- If the remote parameter we are registered to is a
RemoteSwitch,
we try to turn it. To ensure a proper handle to the remote parameter,
we first try to get the value, which ensures proper binding if the
ParameterStub.KEY_BLOCK property is true.
- Specified by:
turnOff in interface Switch
- Returns:
- True, if switch was successfully turned off.