|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PostinaNetworkLayer
The main interface representing the functionalities of Postina.
| Method Summary | |
|---|---|
void |
addClientListener(PostinaClientListener listener)
This method registers a listener to changes in the client structure. |
void |
addMsgListener(PostinaMsgListener listener)
Registers a listener to messages being delivered. |
void |
broadcast(java.io.Serializable content)
This method broadcasts a serializable, that is it all clients in the network will receive this message. |
PostinaID |
connect()
Connects to the P2P-network and initializes the node. |
PostinaID |
connect(java.net.InetAddress bindAddress,
int bindport,
java.util.Collection<java.net.InetSocketAddress> bootAddresses)
This method is an alternative to the other connect method to
specify all configuration parameters as an argument, which is especially
important for the localBindAddress. |
PostinaID |
connect(int bindport,
java.util.Collection<java.net.InetSocketAddress> bootAddresses)
Connects to the P2P-network and initializes the node. |
void |
disconnect()
Disconnects the node from the P2P-network. |
PostinaID |
getID()
Gets the PostinaID of the current client. |
PostinaMessage |
getNextMessage()
Gets the next message in the queue. |
PostinaTopic |
getTopic(java.lang.String topicName)
Gets the PostinaTopic for a given string name of a topic. |
boolean |
isConnected()
This method checks if the node is connected to the network. |
void |
publish(PostinaTopic topic,
java.io.Serializable content)
Publishes a message to a PostinaTopic. |
void |
publish(java.lang.String topicName,
java.io.Serializable content)
Publishes a message to the topic identified by a string. |
void |
removeClientListener(PostinaClientListener listener)
This method unregisters a listener to changes in the client structure. |
void |
removeMsgListener(PostinaMsgListener listener)
Removes a listener, that is this listener will not be informed about any future messages. |
void |
send(PostinaID destination,
java.io.Serializable content)
Sends a message directly to the client identified by the PostinaID. |
void |
sendReliable(PostinaID destination,
java.io.Serializable content)
|
void |
subscribe(java.util.Collection<PostinaTopic> topics)
Subscribes the current client to the Collection of
PostinaTopics. |
void |
subscribe(PostinaTopic topic)
Subscribes the current client to a PostinaTopic. |
void |
subscribe(java.lang.String topicName)
Subscribes the current client to the topic identified by a string. |
void |
subscribeOther(java.util.Collection<PostinaTopic> topics,
PostinaID client)
Subscribes the client specified by the PostinaID to a
Collection of PostinaTopics. |
void |
subscribeOther(PostinaTopic topic,
PostinaID client)
Subscribes the client specified by the PostinaID to a
PostinaTopic. |
void |
subscribeOther(java.lang.String topicName,
PostinaID client)
Subscribes the client specified by the PostinaID to the
topic identified by the string. |
void |
unsubscribe(java.util.Collection<PostinaTopic> topics)
Unsubscribes the current client from the Collection of
PostinaTopics. |
void |
unsubscribe(PostinaTopic topic)
Unsubscribes the current client from the PostinaTopic. |
void |
unsubscribe(java.lang.String topicName)
Unsubscribes the current client from the topic identified by the given string. |
void |
unsubscribeOther(java.util.Collection<PostinaTopic> topics,
PostinaID client)
Unsubscribes the client specified by the PostinaID from a
Collectionof PostinaTopics. |
void |
unsubscribeOther(PostinaTopic topic,
PostinaID client)
Unsubscribes the client specified by the PostinaID to a
PostinaTopic. |
void |
unsubscribeOther(java.lang.String topicName,
PostinaID client)
Unsubscribes the client specified by the PostinaID from
the topic identified by the string. |
| Method Detail |
|---|
void addClientListener(PostinaClientListener listener)
listener - The listener registering.void addMsgListener(PostinaMsgListener listener)
listener - The PostinaMsgListener registering as a
listener.
void broadcast(java.io.Serializable content)
throws PostinaNotConnectedException
content - The serializable that has to be broadcasted.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
PostinaID connect()
throws PostinaJoinFailedException,
PostinaAlreadyConnectedException
connect(bindport,bootAddresses).
PostinaID of the node.
PostinaJoinFailedException
PostinaAlreadyConnectedException - If a connected client tries to connect a second time, an
exception is thrown.
PostinaID connect(java.net.InetAddress bindAddress,
int bindport,
java.util.Collection<java.net.InetSocketAddress> bootAddresses)
throws PostinaJoinFailedException,
PostinaAlreadyConnectedException
connect method to
specify all configuration parameters as an argument, which is especially
important for the localBindAddress. This is useful when the application
is run on a computer having multiple network interfaces (i.e. multiple
network addresses), especially for servers. It is the responsibility of
the application using Postina that the chosen interface is visible to
other clients, otherwise Postina will not work.
bindAddress - The InetAddress to which the node should bind locally.bindport - The port (integer value) the node should bind to locally.bootAddresses - A Collection of InetSocketAddresses
(i.e. IP:Port) indicating bootstrap nodes
PostinaID of the node.
PostinaJoinFailedException - thrown when process of connecting is interrupted
unexpectedly.
PostinaAlreadyConnectedException - If a connected client tries to connect a second time, an
exception is thrown.
PostinaID connect(int bindport,
java.util.Collection<java.net.InetSocketAddress> bootAddresses)
throws PostinaJoinFailedException,
PostinaAlreadyConnectedException
bindport - The port (integer value) the node should bind to locally.bootAddresses - A Collection of InetSocketAddresses
(i.e. IP:Port) indicating bootstrap nodes
PostinaID of the node.
PostinaJoinFailedException - thrown when process of connecting is interrupted
unexpectedly.
PostinaAlreadyConnectedException - If a connected client tries to connect a second time, an
exception is thrown.
void disconnect()
throws PostinaNotConnectedException
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
PostinaID getID()
throws PostinaNotConnectedException
PostinaID of the current client. Once the
connection is established, this is the only possibility for an
application to get the PostinaID.
PostinaID of the current client.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
PostinaMessage getNextMessage()
throws PostinaNoQueueException,
PostinaNotConnectedException
PostinaNoQueueException is
thrown.
PostinaMessage representing the message that
has been published or sent by another client.
PostinaNoQueueException - If there are any listeneres registered to the client, the
queue is deactivated and requests to get next message in the
queue cause an PostinaNoQueueException
exception to be thrown.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
PostinaTopic getTopic(java.lang.String topicName)
throws PostinaNotConnectedException
PostinaTopic for a given string name of a topic.
This is the only way for an application to get an
PostinaTopic. The PostinaTopic is used
when issuing (un)subscriptions and publications.
topicName - The string name of the topic.
PostinaTopic representing the given topic.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.boolean isConnected()
true if we are connected.
void publish(PostinaTopic topic,
java.io.Serializable content)
throws PostinaNotConnectedException
PostinaTopic. All clients
subscribed to this topic will get the message. Note that any
Serializable can be published, but subscribers will
receive an PostinaMessage containing the submitted
Serializable.
topic - The PostinaTopic to which the
Serializable will be published.content - The Serializable to be published.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void publish(java.lang.String topicName,
java.io.Serializable content)
throws PostinaNotConnectedException
publish(PostinaTopic, Serializable).
topicName - The string identifying the topic to which the message should
be published.content - The Serializable to be published.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.void removeClientListener(PostinaClientListener listener)
listener - The listener unregistering.void removeMsgListener(PostinaMsgListener listener)
listener - The PostinaMsgListener unregistering.
void send(PostinaID destination,
java.io.Serializable content)
throws PostinaNotConnectedException
PostinaID. Only the client specified receives this
private message. Note that the message will be delivered as a
PostinaMessage.
destination - The PostinaID uniquely identifying the client
which should receive the private message.content - The Serializable representing the message to be
sent.
PostinaNotConnectedException
void sendReliable(PostinaID destination,
java.io.Serializable content)
throws PostinaNotConnectedException
PostinaNotConnectedException
void subscribe(java.util.Collection<PostinaTopic> topics)
throws PostinaNotConnectedException
Collection of
PostinaTopics. This is more efficient than issuing
several separate subscriptions.
topics - The Collection of PostinaTopics
to which the current client subscribes.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void subscribe(PostinaTopic topic)
throws PostinaNotConnectedException
PostinaTopic.
topic - The PostinaTopic to which the client should be
subscribed.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void subscribe(java.lang.String topicName)
throws PostinaNotConnectedException
string. This is syntactic sugar for
subscribe(PostinaTopic).
topicName - The string identifying the topic to which the current client
subscribes.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void subscribeOther(java.util.Collection<PostinaTopic> topics,
PostinaID client)
throws PostinaNotConnectedException
PostinaID to a
Collection of PostinaTopics. This is more
efficient than issuing several separate subscriptions.
topics - The Collection of PostinaTopics
to which the client should subscribe.client - The PostinaID identifying the client which
should be subscribed to the given PostinaTopics.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void subscribeOther(PostinaTopic topic,
PostinaID client)
throws PostinaNotConnectedException
PostinaID to a
PostinaTopic.
topic - The PostinaTopic to which the client should be
subscribed.client - The PostinaID identifying the client which
should be subscribed to the given PostinaTopic
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void subscribeOther(java.lang.String topicName,
PostinaID client)
throws PostinaNotConnectedException
PostinaID to the
topic identified by the string. This is only syntactic
sugar for subscribeOther(PostinaTopic, PostinaID).
topicName - The string identifying the topic to which the
given client should subscribe.client - The PostinaID identifying the client which
should be subscribed to the given topic.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void unsubscribe(java.util.Collection<PostinaTopic> topics)
throws PostinaNotConnectedException
Collection of
PostinaTopics. This is more efficient than issuing
several separate subscriptions.
topics - The Collection of PostinaTopics
from which the current client should be unsubscribed.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void unsubscribe(PostinaTopic topic)
throws PostinaNotConnectedException
PostinaTopic.
The client will not get any future publications to this topic. Note that
a subscription is not confirmed as there is no positive feedback.
However, a PostinaSubscribeFailedException is thrown when
the subscription fails.
topic - The PostinaTopic from which the client does
have to unsubscribe.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void unsubscribe(java.lang.String topicName)
throws PostinaNotConnectedException
string. This is syntactic sugar for
unsubscribe(PostinaTopic).
topicName - The string identifying the topic from which the
client should unsubscribe.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void unsubscribeOther(java.util.Collection<PostinaTopic> topics,
PostinaID client)
throws PostinaNotConnectedException
PostinaID from a
Collectionof PostinaTopics. This is more
efficient than issuing several separate unsubscriptions.
topics - The Collection of PostinaTopics
from which the client should be unsubscribed.client - The PostinaID identifying the client which
should be unsubscribed from the given
PostinaTopics.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void unsubscribeOther(PostinaTopic topic,
PostinaID client)
throws PostinaNotConnectedException
PostinaID to a
PostinaTopic.
topic - The PostinaTopic from which the client should
be unsubscribed.client - The PostinaID identifying the client which
should be unsubscribed from the given
PostinaTopic
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
void unsubscribeOther(java.lang.String topicName,
PostinaID client)
throws PostinaNotConnectedException
PostinaID from
the topic identified by the string. This is only
syntactic sugar for
unsubscribeOther(PostinaTopic, PostinaID).
topicName - The string identifying the topic from which the
given client should unsubscribe.client - The PostinaID identifying the client which
should be unsubscribed from the given topic.
PostinaNotConnectedException - If the node is not connected to the network, an exception is
thrown.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||