|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--aktbus.core.AktBusReceiver
The AktBusReceiver class receives an AktMessage through a socket.
It can also be subclassed to receive messages which are subclasses of AktMessage.
To do so, you should create a subclass of AktBusReceiver
and define the message_creator
method which construct your customised message
from a String.
The original AktBusReceiver receives a single message and disconnects from
the client by the receive
or receive_with_path
method.
In expanding it to accommodate piggy-packed reply, receive_with_extra
is added, which does not disconnect after receiving an incoming message.
This allows a customised reply to be sent through the same connection.
If you use the piggy-packed feature, make sure that you call the
close_connection
method on the AktMessageWithExtra
object when
you finish.
Constructor Summary | |
AktBusReceiver()
Creates an AktBusReceiver object that listens to a free port. |
|
AktBusReceiver(int port)
Creates an AktBusReceiver object that listens to a certain port. |
Method Summary | |
void |
close()
Shutdown the receiver and release the port in use. |
int |
get_port()
Returns the local port number that the AktBusReceiver is listening to. |
AktMessage |
receive_message()
Receive and return an AktMessage. |
AktMessage |
receive_message(int timeout,
java.lang.Class reply_class)
Receive and return an AktMessage with timeout and expect a reply of a certain class. |
AktMessageWithExtra |
receive_with_extra()
Waits and receive an AktMessageWithExtra. |
AktMessageWithExtra |
receive_with_extra(int timeout,
java.lang.Class result_class)
Waits and receive an AktMessageWithExtra with timeout. |
AktMessageWithExtra |
receive_with_extra(int timeout,
java.lang.String class_string)
Waits and receive an AktMessageWithExtra with timeout. |
AktMessageWithPath |
receive()
Waits and receive an AktMessageWithPath. |
AktMessageWithPath |
receive(int timeout,
java.lang.Class result_class)
Waits and receive an AktMessageWithPath with timeout. |
AktMessageWithPath |
receive(int timeout,
java.lang.String class_string)
Waits and receive an AktMessageWithPath with timeout. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AktBusReceiver() throws java.io.IOException
get_port()
method.java.io.IOException
- When any I/O error occurs.public AktBusReceiver(int port) throws java.io.IOException
port
- The port number to listen.
If port
is 0
, then a free port will be used.java.io.IOException
- When any I/O error occurs.Method Detail |
public int get_port()
public void close() throws java.io.IOException
java.io.IOException
- When an I/O error occurs during closing.public AktMessage receive_message() throws org.xml.sax.SAXException, java.io.IOException, java.lang.Exception
receive_message(int)
instead
To reply an instance of a subclass of AktMessage
,
use receive_message(int,java.lang.String)
or receive_message(int,java.lang.Class)
.org.xml.sax.SAXException
- When the received content cannot be parsed into XML.java.io.IOException
- If anything goes wrong witht the I/O.java.lang.Exception
- When other general error occurs.public AktMessage receive_message(int timeout, java.lang.Class reply_class) throws org.xml.sax.SAXException, java.io.IOException, java.lang.Exception
timeout
- The timeout value in second.reply_class
- The expect class of the replying message in a java.lang.Class object.org.xml.sax.SAXException
- When the received content cannot be parsed into XML.java.io.IOException
- If anything goes wrong witht the I/O.java.lang.Exception
- When other general error occurs.public AktMessageWithPath receive() throws java.io.IOException, org.xml.sax.SAXException, java.lang.Exception
org.xml.sax.SAXException
- When the received content cannot be parsed into XML.java.io.IOException
- If anything goes wrong witht the I/O.java.lang.Exception
- When other general error occurs.public AktMessageWithPath receive(int timeout, java.lang.String class_string) throws java.io.IOException, org.xml.sax.SAXException, java.lang.Exception
timeout
- The timeout value in second.class_string
- The expected class of the reply as a String.public AktMessageWithPath receive(int timeout, java.lang.Class result_class) throws java.io.IOException, org.xml.sax.SAXException, java.lang.Exception
timeout
- The timeout value in second.result_class
- The expected class of the reply as an java.lang.Class object.public AktMessageWithExtra receive_with_extra() throws org.xml.sax.SAXException, java.io.IOException, java.lang.Exception
public AktMessageWithExtra receive_with_extra(int timeout, java.lang.String class_string) throws java.io.IOException, org.xml.sax.SAXException, java.lang.Exception
timeout
- The timeout value in second.class_string
- The expected class of the reply message as a String.public AktMessageWithExtra receive_with_extra(int timeout, java.lang.Class result_class) throws java.io.IOException, org.xml.sax.SAXException, java.lang.Exception
timeout
- The timeout value in second.result_class
- The expected class of the reply message as a java.lang.Class object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |