|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Shell
An interface that is implemented by SensorShell and MultiSensorShell. This enables sensors that can restrict themselves to the use of the following public methods to easily toggle between the use of SensorShell or MultiSensorShell depending upon load requirements. As a simple example, a sensor might contain code similar to the following:
boolean useMulti = isMultiSensorShellRequested(); Shell shell = (useMulti) ? new MultiSensorShell(...) : new SensorShell(...); : shell.add(...) : shell.quit()Thus, the decision to use a SensorShell vs. a MultiSensorShell can be made at run-time.
Method Summary | |
---|---|
void |
add(java.util.Map<java.lang.String,java.lang.String> keyValMap)
Converts the values in the KeyValMap to a SensorData instance and adds it to the Shell. |
void |
add(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData sensorData)
Adds the passed SensorData instance to the Shell. |
SensorShellProperties |
getProperties()
Returns the SensorShell properties instance used to create this SensorShell. |
boolean |
hasOfflineData()
Returns true if any of shells in this interface have stored data offline. |
boolean |
ping()
Returns true if the host can be pinged and the email/password combination is valid. |
void |
quit()
Invokes quit() on this Shell, which invokes a final send() and closes any logging files. |
int |
send()
Immediately invokes send() on this Shell. |
void |
statechange(long resourceCheckSum,
java.util.Map<java.lang.String,java.lang.String> keyValMap)
Implements the "StateChange" algorithm. |
Method Detail |
---|
void add(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData sensorData) throws SensorShellException
sensorData
- The SensorData instance to be queued for transmission.
SensorShellException
- If problems occur sending the data.void add(java.util.Map<java.lang.String,java.lang.String> keyValMap) throws SensorShellException
keyValMap
- The map of key-value pairs.
SensorShellException
- If the Map cannot be translated into SensorData,
typically because a value
was passed for Timestamp or Runtime that could not be parsed into XMLGregorianCalendar.
Or if problems occur sending the data.boolean ping()
int send() throws SensorShellException
SensorShellException
- If problems occur sending the data.void quit() throws SensorShellException
SensorShellException
- If an exception occurred during any autosend.boolean hasOfflineData()
void statechange(long resourceCheckSum, java.util.Map<java.lang.String,java.lang.String> keyValMap) throws java.lang.Exception
Thus, if an editor is running but the user is out at lunch, repeated invocations of the StateChange method will not result in any new data being sent to the server.
resourceCheckSum
- An integer representing the state of the Resource.keyValMap
- A map of key-value pairs representing sensor data fields and properties.
java.lang.Exception
- If problems occur during the Add (if the Add actually occurs.)SensorShellProperties getProperties()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |