public abstract class Node
extends java.lang.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 org.jivesoftware.smack.XMPPConnection |
con |
protected java.util.concurrent.ConcurrentHashMap<NodeConfigListener,org.jivesoftware.smack.PacketListener> |
configEventToListenerMap |
protected java.lang.String |
id |
protected java.util.concurrent.ConcurrentHashMap<ItemDeleteListener,org.jivesoftware.smack.PacketListener> |
itemDeleteToListenerMap |
protected java.util.concurrent.ConcurrentHashMap<ItemEventListener<Item>,org.jivesoftware.smack.PacketListener> |
itemEventToListenerMap |
protected java.lang.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(org.jivesoftware.smack.packet.IQ.Type type,
org.jivesoftware.smack.packet.PacketExtension ext) |
protected PubSub |
createPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type,
org.jivesoftware.smack.packet.PacketExtension ext,
PubSubNamespace ns) |
DiscoverInfo |
discoverInfo()
Discover node information in standard
DiscoverInfo format. |
java.lang.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(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 |
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 org.jivesoftware.smack.packet.Packet |
sendPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type,
NodeExtension ext) |
protected org.jivesoftware.smack.packet.Packet |
sendPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type,
NodeExtension ext,
PubSubNamespace ns) |
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.
|
protected org.jivesoftware.smack.XMPPConnection con
protected java.lang.String id
protected java.lang.String to
protected java.util.concurrent.ConcurrentHashMap<ItemEventListener<Item>,org.jivesoftware.smack.PacketListener> itemEventToListenerMap
protected java.util.concurrent.ConcurrentHashMap<ItemDeleteListener,org.jivesoftware.smack.PacketListener> itemDeleteToListenerMap
protected java.util.concurrent.ConcurrentHashMap<NodeConfigListener,org.jivesoftware.smack.PacketListener> configEventToListenerMap
public java.lang.String getId()
public ConfigureForm getNodeConfiguration() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
sendConfigurationForm(Form)
.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public void sendConfigurationForm(Form submitForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
Form
submitForm
- org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public DiscoverInfo discoverInfo() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
DiscoverInfo
format.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
public java.util.List<Subscription> getSubscriptions() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
Subscription
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public Subscription subscribe(java.lang.String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.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.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public Subscription subscribe(java.lang.String jid, SubscribeForm subForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.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.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public void unsubscribe(java.lang.String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
unsubscribe(String, String)
.jid
- The JID used to subscribe to the nodeorg.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public void unsubscribe(java.lang.String jid, java.lang.String subscriptionId) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
jid
- The JID used to subscribe to the nodesubscriptionId
- The id of the subscription being removedorg.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public SubscribeForm getSubscriptionOptions(java.lang.String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
sendConfigurationForm(Form)
.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
public SubscribeForm getSubscriptionOptions(java.lang.String jid, java.lang.String subscriptionId) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
jid
- JID the subscription is registered undersubscriptionId
- The subscription idorg.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.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 unregisterpublic java.lang.String toString()
toString
in class java.lang.Object
protected PubSub createPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type, org.jivesoftware.smack.packet.PacketExtension ext)
protected PubSub createPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type, org.jivesoftware.smack.packet.PacketExtension ext, PubSubNamespace ns)
protected org.jivesoftware.smack.packet.Packet sendPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type, NodeExtension ext) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NotConnectedException
protected org.jivesoftware.smack.packet.Packet sendPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type, NodeExtension ext, PubSubNamespace ns) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NotConnectedException