Package com.isode.som
Class SomCommand
java.lang.Object
com.isode.som.SomCommand
- All Implemented Interfaces:
SomResponseProcessor
- Direct Known Subclasses:
SomPumiceCommand
,SomQmgrCommand
Class which represents a generic SOM command.
- Author:
- tc
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSomCommand
(SomSession sess) Create a new SomCommand object.SomCommand
(SomSession sess, SomHandler handler) Create a new SomCommand object.SomCommand
(SomSession sess, SomHandler handler, SomCommandListener listener) Create a new SomCommand object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispatch()
Send off a command once constructed.protected String
protected SomSession
Obtain the SomSession object with which a command is associated.void
notifyListener
(int status) Tell the command listener about an event.void
notifyListener
(int status, String detail) Tell the command listener about an event which includes a detail stringvoid
notifyListener
(int status, String[] pairs) Tell the listener about an event which includes an array of data pairsvoid
processResponse
(String commandData, byte[] data, int status) Process response to command.
-
Field Details
-
opSession
-
opListener
-
-
Constructor Details
-
SomCommand
Create a new SomCommand object.- Parameters:
sess
- SomSession to use for command
-
SomCommand
Create a new SomCommand object.- Parameters:
sess
- SomSession to use for command which must not be nullhandler
- SomHandler which will be used during session establishment which must not be null
-
SomCommand
Create a new SomCommand object.- Parameters:
sess
- SomSession to use for commandhandler
- SomHandler which be will used during session establishment which must not be nulllistener
- SomCommandListener which will handle results and error info which may be null
-
-
Method Details
-
dispatch
Send off a command once constructed. Wait for a response if we are operating synchronously.- Throws:
SomException
- Indicating a problem with the command
-
getSession
Obtain the SomSession object with which a command is associated.- Returns:
- SomSession object
-
processResponse
Process response to command.- Specified by:
processResponse
in interfaceSomResponseProcessor
-
getCommandString
- Returns:
- The command string to be sent over the wire.
- Throws:
SomException
- Indicating a problem with the command
-
notifyListener
public void notifyListener(int status) Tell the command listener about an event.- Parameters:
status
- the status code
-
notifyListener
Tell the command listener about an event which includes a detail string- Parameters:
status
- the status codedetail
- which must not be null
-
notifyListener
Tell the listener about an event which includes an array of data pairs- Parameters:
status
- the status codepairs
- which must not be null
-