public class LeafNode extends Node
Node.ItemDeleteTranslator, Node.ItemEventTranslator, Node.NodeConfigTranslator
con, configEventToListenerMap, id, itemDeleteToListenerMap, itemEventToListenerMap, to
Modifier and Type | Method and Description |
---|---|
void |
deleteAllItems()
Purges the node of all items.
|
void |
deleteItem(Collection<String> itemIds)
Delete the items with the specified id's from the node.
|
void |
deleteItem(String itemId)
Delete the item with the specified id from the node.
|
DiscoverItems |
discoverItems()
Get information on the items in the node in standard
DiscoverItems format. |
<T extends Item> |
getItems()
Get the current items stored in the node.
|
<T extends Item> |
getItems(Collection<String> ids)
Get the items specified from the node.
|
<T extends Item> |
getItems(int maxItems)
Get items persisted on the node, limited to the specified number.
|
<T extends Item> |
getItems(int maxItems,
String subscriptionId)
Get items persisted on the node, limited to the specified number
based on the subscription associated with the provided subscriptionId.
|
<T extends Item> |
getItems(String subscriptionId)
Get the current items stored in the node based
on the subscription associated with the provided
subscription id.
|
void |
publish()
Publishes an event to the node.
|
<T extends Item> |
publish(Collection<T> items)
Publishes multiple events to the node.
|
<T extends Item> |
publish(T item)
Publishes an event to the node.
|
void |
send()
Publishes an event to the node.
|
<T extends Item> |
send(Collection<T> items)
Publishes multiple events to the node.
|
<T extends Item> |
send(T item)
Publishes an event to the node.
|
addConfigurationListener, addItemDeleteListener, addItemEventListener, createPubsubPacket, createPubsubPacket, discoverInfo, getAffiliations, getAffiliations, getId, getNodeConfiguration, getSubscriptionOptions, getSubscriptionOptions, getSubscriptions, getSubscriptions, removeConfigurationListener, removeItemDeleteListener, removeItemEventListener, sendConfigurationForm, sendPubsubPacket, subscribe, subscribe, toString, unsubscribe, unsubscribe
public DiscoverItems discoverItems() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
DiscoverItems
format.DiscoverItems
formatXMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public <T extends Item> List<T> getItems() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
Item
in the nodeXMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public <T extends Item> List<T> getItems(String subscriptionId) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
subscriptionId
- - The subscription id for the
associated subscription.Item
in the nodeXMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public <T extends Item> List<T> getItems(Collection<String> ids) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
getItems()
or an
event, that did not include the payload.ids
- Item ids of the items to retrieveItem
with payloadXMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public <T extends Item> List<T> getItems(int maxItems) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
maxItems
- Maximum number of items to returnItem
XMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public <T extends Item> List<T> getItems(int maxItems, String subscriptionId) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
maxItems
- Maximum number of items to returnsubscriptionId
- The subscription which the retrieval is based
on.Item
XMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public void publish() throws SmackException.NotConnectedException
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 <T extends Item> void publish(T item) throws SmackException.NotConnectedException
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 sentSmackException.NotConnectedException
public <T extends Item> void publish(Collection<T> items) throws SmackException.NotConnectedException
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 sentSmackException.NotConnectedException
public void send() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
ConfigureForm.isPersistItems()
=false
and ConfigureForm.isDeliverPayloads()
=false.
This is a synchronous call which will throw an exception
on failure.
For asynchronous calls, use publish()
.public <T extends Item> void send(T item) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
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 sentXMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public <T extends Item> void send(Collection<T> items) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
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 sentXMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void deleteAllItems() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
Note: Some implementations may keep the last item sent.
XMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public void deleteItem(String itemId) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
itemId
- The id of the itemXMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void deleteItem(Collection<String> itemIds) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
itemIds
- The list of id's of items to deleteXMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException