|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.smackx.pubsub.Node
public class Node
The main class for the majority of pubsub functionality. In general almost all pubsub capabilities are related to the concept of a node. All items are published to a node, and typically subscribed to by other users. These users then retrieve events based on this subscription.
Nested Class Summary | |
---|---|
class |
Node.ItemDeleteTranslator
This class translates low level item deletion events into api level objects for user consumption. |
class |
Node.ItemEventTranslator
This class translates low level item publication events into api level objects for user consumption. |
class |
Node.NodeConfigTranslator
This class translates low level node configuration events into api level objects for user consumption. |
Method Summary | |
---|---|
void |
addConfigurationListener(NodeConfigListener listener)
Register a listener for configuration events. |
void |
addItemDeleteListener(ItemDeleteListener listener)
Register an listener for item delete events. |
void |
addItemEventListener(ItemEventListener listener)
Register a listener for item publication events. |
void |
deleteAllItems()
Purges the node of all items. |
void |
deleteItem(java.util.Collection<java.lang.String> itemIds)
Delete the items with the specified id's from the node. |
void |
deleteItem(java.lang.String itemId)
Delete the item with the specified id from the node. |
DiscoverInfo |
discoverInfo()
Discover node information in standard DiscoverInfo format. |
DiscoverItems |
discoverItems()
Get information on the items in the node in standard DiscoverItems format. |
java.lang.String |
getId()
Get the NodeId |
java.util.List<Item> |
getItems()
Get the current items stored in the node. |
java.util.List<Item> |
getItems(java.util.Collection<java.lang.String> ids)
Get the items specified from the node. |
java.util.List<Item> |
getItems(int maxItems)
Get items persisted on the node, limited to the specified number. |
ConfigureForm |
getNodeConfiguration()
Returns a configuration form, from which you can create an answer form to be submitted via the sendConfigurationForm(Form) . |
SubscribeForm |
getSubscriptionOptions(java.lang.String jid)
Returns a SubscribeForm for subscriptions, from which you can create an answer form to be submitted via the sendConfigurationForm(Form) . |
SubscribeForm |
getSubscriptionOptions(java.lang.String jid,
java.lang.String subscriptionId)
Get the options for configuring the specified subscription. |
java.util.List<Subscription> |
getSubscriptions()
Get the subscriptions currently associated with this node. |
void |
publish()
Publishes an event to the node. |
void |
publish(java.util.Collection<Item> items)
Publishes multiple events to the node. |
void |
publish(Item item)
Publishes an event to the node. |
void |
removeConfigurationListener(NodeConfigListener listener)
Unregister a listener for configuration events. |
void |
removeItemDeleteListener(ItemDeleteListener listener)
Unregister a listener for item delete events. |
void |
removeItemEventListener(ItemEventListener listener)
Unregister a listener for publication events. |
void |
send()
Publishes an event to the node. |
void |
send(java.util.Collection<Item> items)
Publishes multiple events to the node. |
void |
send(Item item)
Publishes an event to the node. |
void |
sendConfigurationForm(org.jivesoftware.smackx.Form submitForm)
Update the configuration with the contents of the new Form |
Subscription |
subscribe(java.lang.String jid)
The user subscribes to the node using the supplied jid. |
Subscription |
subscribe(java.lang.String jid,
SubscribeForm subForm)
The user subscribes to the node using the supplied jid and subscription options. |
java.lang.String |
toString()
|
void |
unsubscribe(java.lang.String jid)
Remove the subscription related to the specified JID. |
void |
unsubscribe(java.lang.String jid,
java.lang.String subscriptionId)
Remove the specific subscription related to the specified JID. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.lang.String getId()
public ConfigureForm getNodeConfiguration() throws org.jivesoftware.smack.XMPPException
sendConfigurationForm(Form)
.
org.jivesoftware.smack.XMPPException
public void sendConfigurationForm(org.jivesoftware.smackx.Form submitForm) throws org.jivesoftware.smack.XMPPException
Form
submitForm
-
org.jivesoftware.smack.XMPPException
public DiscoverInfo discoverInfo() throws org.jivesoftware.smack.XMPPException
DiscoverInfo
format.
org.jivesoftware.smack.XMPPException
public DiscoverItems discoverItems() throws org.jivesoftware.smack.XMPPException
DiscoverItems
format.
DiscoverItems
format
org.jivesoftware.smack.XMPPException
public java.util.List<Subscription> getSubscriptions() throws org.jivesoftware.smack.XMPPException
Subscription
org.jivesoftware.smack.XMPPException
public Subscription subscribe(java.lang.String jid) throws org.jivesoftware.smack.XMPPException
Subscription.State
should be checked
on return since more actions may be required by the caller.
Subscription.State.pending
- The owner must approve the subscription
request before messages will be received.
Subscription.State.unconfigured
- If the Subscription.isConfigRequired()
is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.
jid
- The jid to subscribe as.
org.jivesoftware.smack.XMPPException
public Subscription subscribe(java.lang.String jid, SubscribeForm subForm) throws org.jivesoftware.smack.XMPPException
Subscription.State
should be checked
on return since more actions may be required by the caller.
Subscription.State.pending
- The owner must approve the subscription
request before messages will be received.
Subscription.State.unconfigured
- If the Subscription.isConfigRequired()
is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.
jid
- The jid to subscribe as.
org.jivesoftware.smack.XMPPException
public void unsubscribe(java.lang.String jid) throws org.jivesoftware.smack.XMPPException
unsubscribe(String, String)
.
jid
- The JID used to subscribe to the node
org.jivesoftware.smack.XMPPException
public void unsubscribe(java.lang.String jid, java.lang.String subscriptionId) throws org.jivesoftware.smack.XMPPException
jid
- The JID used to subscribe to the nodesubscriptionId
- The id of the subscription being removed
org.jivesoftware.smack.XMPPException
public SubscribeForm getSubscriptionOptions(java.lang.String jid) throws org.jivesoftware.smack.XMPPException
sendConfigurationForm(Form)
.
org.jivesoftware.smack.XMPPException
public SubscribeForm getSubscriptionOptions(java.lang.String jid, java.lang.String subscriptionId) throws org.jivesoftware.smack.XMPPException
jid
- JID the subscription is registered undersubscriptionId
- The subscription id
org.jivesoftware.smack.XMPPException
public java.util.List<Item> getItems() throws org.jivesoftware.smack.XMPPException
Item
in the node
org.jivesoftware.smack.XMPPException
public java.util.List<Item> getItems(java.util.Collection<java.lang.String> ids) throws org.jivesoftware.smack.XMPPException
getItems()
or an
event, that did not include the payload.
ids
- Item ids of the items to retrieve
Item
with payload
org.jivesoftware.smack.XMPPException
public java.util.List<Item> getItems(int maxItems) throws org.jivesoftware.smack.XMPPException
maxItems
- Maximum number of items to return
Item
org.jivesoftware.smack.XMPPException
public void publish()
ConfigureForm.isPersistItems()
=false
and ConfigureForm.isDeliverPayloads()
=false.
This is an asynchronous call which returns as soon as the
packet has been sent.
For synchronous calls use send()
.
public void publish(Item item)
send()
, which
publishes an event with NO item.
This is an asynchronous call which returns as soon as the
packet has been sent.
For synchronous calls use send(Item))
.
item
- - The item being sentpublic void publish(java.util.Collection<Item> items)
publish(Item)
.
In addition, if ConfigureForm.isPersistItems()
=false, only the last item in the input
list will get stored on the node, assuming it stores the last sent item.
This is an asynchronous call which returns as soon as the
packet has been sent.
For synchronous calls use send(Collection))
.
items
- - The collection of items being sentpublic void send() throws org.jivesoftware.smack.XMPPException
ConfigureForm.isPersistItems()
=false
and ConfigureForm.isDeliverPayloads()
=false.
This is a synchronous call which will throw an exception
on failure.
For asynchronous calls, use publish()
.
org.jivesoftware.smack.XMPPException
public void send(Item item) throws org.jivesoftware.smack.XMPPException
send()
, which
publishes an event with NO item.
This is a synchronous call which will throw an exception
on failure.
For asynchronous calls, use publish(Item)
.
item
- - The item being sent
org.jivesoftware.smack.XMPPException
public void send(java.util.Collection<Item> items) throws org.jivesoftware.smack.XMPPException
send(Item)
.
In addition, if ConfigureForm.isPersistItems()
=false, only the last item in the input
list will get stored on the node, assuming it stores the last sent item.
This is a synchronous call which will throw an exception
on failure.
For asynchronous calls, use publish(Collection))
.
items
- - The collection of Item
objects being sent
org.jivesoftware.smack.XMPPException
public void deleteAllItems() throws org.jivesoftware.smack.XMPPException
Note: Some implementations may keep the last item sent.
org.jivesoftware.smack.XMPPException
public void deleteItem(java.lang.String itemId) throws org.jivesoftware.smack.XMPPException
itemId
- The id of the item
org.jivesoftware.smack.XMPPException
public void deleteItem(java.util.Collection<java.lang.String> itemIds) throws org.jivesoftware.smack.XMPPException
itemIds
- The list of id's of items to delete
org.jivesoftware.smack.XMPPException
public void addItemEventListener(ItemEventListener listener)
listener
- The handler for the eventpublic void removeItemEventListener(ItemEventListener listener)
listener
- The handler to unregisterpublic void addConfigurationListener(NodeConfigListener listener)
listener
- The handler for the eventpublic void removeConfigurationListener(NodeConfigListener listener)
listener
- The handler to unregisterpublic void addItemDeleteListener(ItemDeleteListener listener)
listener
- The handler for the eventpublic void removeItemDeleteListener(ItemDeleteListener listener)
listener
- The handler to unregisterpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |