Package de.tudresden.sumo.util
Class Query
- java.lang.Object
-
- java.util.Observable
-
- de.tudresden.sumo.util.Query
-
- Direct Known Subclasses:
CloseQuery
,CommandProcessor
public abstract class Query extends java.util.Observable
-
-
Constructor Summary
Constructors Constructor Description Query(java.net.Socket sock)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doClose()
Disconnect client from the sumo serverprotected ResponseMessage
doQuery(RequestMessage msg)
Sends a request message to SUMO and returns a response message.protected ResponseContainer
doQuerySingle(Command request)
LikedoQuery(RequestMessage)
, but good for one-command/ one-response queries.protected void
doSetOrder(int index)
Set multi-client ordering indexprotected void
doSimulationStep(double targetTime)
Do next time step and update subscription resultsprotected void
fireAndForget(Command request)
fireAndForget functionjava.io.DataOutputStream
getOutStream()
protected ResponseMessage
queryAndVerify(RequestMessage reqMsg)
LikedoQuery(RequestMessage)
; in addition, verifies that all responses are successful and and the statuses match the requests.protected ResponseContainer
queryAndVerifySingle(Command request)
LikequeryAndVerify(RequestMessage)
, but good for one-command/ one-response queries.protected static void
verify(java.lang.String description, int expected, byte actual)
protected static void
verify(java.lang.String description, int expected, short actual)
protected static void
verify(java.lang.String description, java.lang.Object expected, java.lang.Object actual)
protected static java.lang.String
verifyGetVarResponse(Command resp, int commandID, int variable, java.lang.String objectID)
-
-
-
Method Detail
-
doQuery
protected ResponseMessage doQuery(RequestMessage msg) throws java.io.IOException
Sends a request message to SUMO and returns a response message.- Parameters:
msg
-- Throws:
java.io.IOException
-
queryAndVerify
protected ResponseMessage queryAndVerify(RequestMessage reqMsg) throws java.io.IOException
LikedoQuery(RequestMessage)
; in addition, verifies that all responses are successful and and the statuses match the requests.- Parameters:
reqMsg
-- Returns:
- the verified response message
- Throws:
java.io.IOException
- See Also:
doQuery(RequestMessage)
-
doQuerySingle
protected ResponseContainer doQuerySingle(Command request) throws java.io.IOException
LikedoQuery(RequestMessage)
, but good for one-command/ one-response queries.- Parameters:
request
-- Throws:
java.io.IOException
-
doSetOrder
protected void doSetOrder(int index) throws java.io.IOException
Set multi-client ordering index- Parameters:
index
-- Throws:
java.io.IOException
-
doClose
protected void doClose() throws java.io.IOException
Disconnect client from the sumo server- Throws:
java.io.IOException
-
doSimulationStep
protected void doSimulationStep(double targetTime) throws java.io.IOException
Do next time step and update subscription results- Parameters:
targetTime
-- Throws:
java.io.IOException
-
queryAndVerifySingle
protected ResponseContainer queryAndVerifySingle(Command request) throws java.io.IOException
LikequeryAndVerify(RequestMessage)
, but good for one-command/ one-response queries.- Parameters:
request
-- Returns:
- the response container for the specified request
- Throws:
java.io.IOException
-
fireAndForget
protected void fireAndForget(Command request)
fireAndForget function- Parameters:
request
-- Throws:
java.io.IOException
-
verifyGetVarResponse
protected static java.lang.String verifyGetVarResponse(Command resp, int commandID, int variable, java.lang.String objectID) throws TraCIException.UnexpectedData
- Throws:
TraCIException.UnexpectedData
-
verify
protected static void verify(java.lang.String description, java.lang.Object expected, java.lang.Object actual) throws TraCIException.UnexpectedData
- Throws:
TraCIException.UnexpectedData
-
verify
protected static void verify(java.lang.String description, int expected, short actual) throws TraCIException.UnexpectedData
- Throws:
TraCIException.UnexpectedData
-
verify
protected static void verify(java.lang.String description, int expected, byte actual) throws TraCIException.UnexpectedData
- Throws:
TraCIException.UnexpectedData
-
getOutStream
public java.io.DataOutputStream getOutStream()
-
-