|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hackystat.sensorshell.SingleSensorShell
public class SingleSensorShell
Provides the implementation of a single SensorShell instance.
Constructor Summary | |
---|---|
SingleSensorShell(SensorShellProperties properties,
boolean isInteractive)
Constructs a new SensorShell instance that can be provided with notification data to be sent eventually to a specific user key and host. |
|
SingleSensorShell(SensorShellProperties properties,
boolean isInteractive,
java.lang.String tool)
Constructs a new SensorShell instance that can be provided with notification data to be sent eventually to a specific user key and host. |
|
SingleSensorShell(SensorShellProperties properties,
boolean isInteractive,
java.lang.String toolName,
java.io.File commandFile)
Constructs a new SensorShell instance that can be provided with notification data to be sent eventually to a specific user key and host. |
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. |
java.util.logging.Logger |
getLogger()
Returns the Logger associated with this sensorshell. |
OfflineManager |
getOfflineManager()
Returns the offline manager associated with this instance. |
SensorShellProperties |
getProperties()
Returns the SensorShell properties instance used to create this SensorShell. |
java.util.Date |
getStartTime()
Returns a Date instance indicating when this SensorShell was started. |
long |
getTotalSent()
Returns the total number of instances sent by this shell's SensorDataCommand. |
boolean |
hasOfflineData()
Returns true if this shell has stored any data offline. |
boolean |
isInteractive()
Returns true if this sensorshell is being run interactively from the command line. |
boolean |
ping()
Returns true if the host can be pinged and the email/password combination is valid. |
void |
print(java.lang.String line)
Prints out the line without newline if in interactive mode. |
void |
println(java.lang.String line)
Prints out the line plus newline if in interactive mode, and always logs the line. |
(package private) void |
printPrompt()
Print out a prompt if in interactive mode. |
(package private) void |
processInputString(java.lang.String inputString)
Process a single input string representing a command. |
void |
quit()
Invokes quit() on this Shell, which invokes a final send() and closes any logging files. |
(package private) java.lang.String |
readLine()
Returns a string with the next line of input from the user. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingleSensorShell(SensorShellProperties properties, boolean isInteractive)
properties
- The sensor properties instance for this run.isInteractive
- Whether this SensorShell is being interactively invoked or not.public SingleSensorShell(SensorShellProperties properties, boolean isInteractive, java.lang.String tool)
properties
- The sensor properties instance for this run.isInteractive
- Whether this SensorShell is being interactively invoked or not.tool
- Indicates the invoking tool that is added to the log file name.public SingleSensorShell(SensorShellProperties properties, boolean isInteractive, java.lang.String toolName, java.io.File commandFile)
properties
- The sensor properties instance for this run.isInteractive
- Whether this SensorShell is being interactively invoked or not.toolName
- The invoking tool that is added to the log file name.commandFile
- A file containing shell commands, or null if none provided.Method Detail |
---|
public OfflineManager getOfflineManager()
void processInputString(java.lang.String inputString) throws SensorShellException
inputString
- A command as a String.
SensorShellException
- If problems occur sending the data.void printPrompt()
java.lang.String readLine()
public final void println(java.lang.String line)
line
- The line to be printed.public final void print(java.lang.String line)
line
- The line to be printed.public java.util.Date getStartTime()
public boolean hasOfflineData()
hasOfflineData
in interface Shell
public long getTotalSent()
public boolean isInteractive()
public java.util.logging.Logger getLogger()
public void add(java.util.Map<java.lang.String,java.lang.String> keyValMap) throws SensorShellException
add
in interface Shell
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.public void add(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData sensorData) throws SensorShellException
add
in interface Shell
sensorData
- The SensorData instance to be queued for transmission.
SensorShellException
- If problems occur sending the data.public int send() throws SensorShellException
send
in interface Shell
SensorShellException
- If problems occur sending the data.public void quit() throws SensorShellException
quit
in interface Shell
SensorShellException
- If an exception occurred during any autosend.public boolean ping()
ping
in interface Shell
public 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.
statechange
in interface Shell
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.)public SensorShellProperties getProperties()
getProperties
in interface Shell
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |