|
AR System Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bmc.arsys.api.AlertReceiver
public class AlertReceiver
Helper class to facilitate programming AR System Alert client programs. To create an
AR System Alert client program, simply instantiate object of this type
and pass in your own handler (an instance of a class that implements
Sample Test program
...
public void onAlertRecieved(AlertMessageInfo alertMsg) {
//implement callback logic
...
}
...
public void method check {
AlertReceiver receiver = null;
...
try {
receiver = new AlertReceiver(callback, portnum);
receiver.beginReceive(serverContext);
} catch (ARException e) {
//do logging etc
} finally {
//when done close the receiver
receiver.close();
}
}
...
Constructor Summary | |
---|---|
AlertReceiver(AlertCallbackHandler callbackHandler)
Constructs an AlertReceiver. |
|
AlertReceiver(AlertCallbackHandler callbackHandler,
int port)
Constructs an AlertReceiver. |
Method Summary | |
---|---|
boolean |
beginReceive(ARServerUser context)
Begin receiving alert messages for the user from a particular ARServer specified by the context. |
void |
close()
Close the server socket and stop the thread started to listen on the server socket. |
void |
stopReceive(ARServerUser context)
Stop receiving alert messages for the user from a particular ARServer specified by the context. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AlertReceiver(AlertCallbackHandler callbackHandler) throws IOException
callbackHandler
-
IOException
public AlertReceiver(AlertCallbackHandler callbackHandler, int port) throws IOException
callbackHandler
- handler that will be invoked upon receiving alertsport
- the port number, or 0 to use any free port.
IOException
- if an I/O error occurs when opening the socketMethod Detail |
---|
public boolean beginReceive(ARServerUser context) throws ARException
context
- specifies the user and AR Server to start receiving alerts
ARException
- if invalid loginpublic void stopReceive(ARServerUser context) throws ARException
context
- specifies the user and AR Server to stop receiving alerts
ARException
- if invalid loginpublic void close() throws IOException
IOException
- if an I/O error occurs when closing the socket.
|
AR System Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |