public abstract class Node extends Object
Modifier and Type | Class and Description |
---|---|
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.
|
Modifier and Type | Field and Description |
---|---|
protected XMPPConnection |
con |
protected ConcurrentHashMap<NodeConfigListener,StanzaListener> |
configEventToListenerMap |
protected String |
id |
protected ConcurrentHashMap<ItemDeleteListener,StanzaListener> |
itemDeleteToListenerMap |
protected ConcurrentHashMap<ItemEventListener<Item>,StanzaListener> |
itemEventToListenerMap |
protected String |
to |
Modifier and Type | Method and Description |
---|---|
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.
|
protected PubSub |
createPubsubPacket(IQ.Type type,
ExtensionElement ext) |
protected PubSub |
createPubsubPacket(IQ.Type type,
ExtensionElement ext,
PubSubNamespace ns) |
DiscoverInfo |
discoverInfo()
Discover node information in standard
DiscoverInfo format. |
List<Affiliation> |
getAffiliations()
Get the affiliations of this node.
|
List<Affiliation> |
getAffiliations(List<ExtensionElement> additionalExtensions,
Collection<ExtensionElement> returnedExtensions)
Get the affiliations of this node.
|
String |
getId()
Get the NodeId
|
ConfigureForm |
getNodeConfiguration()
Returns a configuration form, from which you can create an answer form to be submitted
via the
sendConfigurationForm(Form) . |
SubscribeForm |
getSubscriptionOptions(String jid)
Returns a SubscribeForm for subscriptions, from which you can create an answer form to be submitted
via the
sendConfigurationForm(Form) . |
SubscribeForm |
getSubscriptionOptions(String jid,
String subscriptionId)
Get the options for configuring the specified subscription.
|
List<Subscription> |
getSubscriptions()
Get the subscriptions currently associated with this node.
|
List<Subscription> |
getSubscriptions(List<ExtensionElement> additionalExtensions,
Collection<ExtensionElement> returnedExtensions)
Get the subscriptions currently associated with this node.
|
List<Subscription> |
getSubscriptionsAsOwner()
Get the subscriptions currently associated with this node as owner.
|
List<Subscription> |
getSubscriptionsAsOwner(List<ExtensionElement> additionalExtensions,
Collection<ExtensionElement> returnedExtensions)
Get the subscriptions currently associated with this node as owner.
|
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 |
sendConfigurationForm(Form submitForm)
Update the configuration with the contents of the new
Form |
protected PubSub |
sendPubsubPacket(PubSub packet) |
Subscription |
subscribe(String jid)
The user subscribes to the node using the supplied jid.
|
Subscription |
subscribe(String jid,
SubscribeForm subForm)
The user subscribes to the node using the supplied jid and subscription
options.
|
String |
toString() |
void |
unsubscribe(String jid)
Remove the subscription related to the specified JID.
|
void |
unsubscribe(String jid,
String subscriptionId)
Remove the specific subscription related to the specified JID.
|
protected XMPPConnection con
protected ConcurrentHashMap<ItemEventListener<Item>,StanzaListener> itemEventToListenerMap
protected ConcurrentHashMap<ItemDeleteListener,StanzaListener> itemDeleteToListenerMap
protected ConcurrentHashMap<NodeConfigListener,StanzaListener> configEventToListenerMap
public ConfigureForm getNodeConfiguration() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
sendConfigurationForm(Form)
.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void sendConfigurationForm(Form submitForm) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
Form
submitForm
- XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public DiscoverInfo discoverInfo() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
DiscoverInfo
format.XMPPException.XMPPErrorException
SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public List<Subscription> getSubscriptions() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
public List<Subscription> getSubscriptions(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
additionalExtensions
can be used e.g. to add a "Result Set Management" extension.
returnedExtensions
will be filled with the stanza(/packet) extensions found in the answer.
additionalExtensions
- returnedExtensions
- a collection that will be filled with the returned packet
extensionsSubscription
SmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
public List<Subscription> getSubscriptionsAsOwner() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
Subscription
XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
getSubscriptionsAsOwner(List, Collection)
public List<Subscription> getSubscriptionsAsOwner(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
Unlike getSubscriptions(List, Collection)
, which only retrieves the subscriptions of the current entity
("user"), this method returns a list of all subscriptions. This requires the entity to have the sufficient
privileges to manage subscriptions.
additionalExtensions
can be used e.g. to add a "Result Set Management" extension.
returnedExtensions
will be filled with the stanza(/packet) extensions found in the answer.
additionalExtensions
- returnedExtensions
- a collection that will be filled with the returned stanza(/packet) extensionsSubscription
SmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
public List<Affiliation> getAffiliations() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
additionalExtensions
can be used e.g. to add a "Result Set Management" extension.
returnedExtensions
will be filled with the stanza(/packet) extensions found in the answer.
additionalExtensions
- additional PacketExtensions
add to the requestreturnedExtensions
- a collection that will be filled with the returned packet
extensionsAffiliation
SmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
public Subscription subscribe(String jid) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
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.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public Subscription subscribe(String jid, SubscribeForm subForm) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
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.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void unsubscribe(String jid) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
unsubscribe(String, String)
.jid
- The JID used to subscribe to the nodeXMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void unsubscribe(String jid, String subscriptionId) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
jid
- The JID used to subscribe to the nodesubscriptionId
- The id of the subscription being removedXMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public SubscribeForm getSubscriptionOptions(String jid) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
sendConfigurationForm(Form)
.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
jid
- JID the subscription is registered undersubscriptionId
- The subscription idXMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
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 unregisterprotected PubSub createPubsubPacket(IQ.Type type, ExtensionElement ext)
protected PubSub createPubsubPacket(IQ.Type type, ExtensionElement ext, PubSubNamespace ns)
protected PubSub sendPubsubPacket(PubSub packet) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException