public abstract class Node extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Node.ItemReplyPolicy
Policy that defines whether owners or publisher should receive replies to items.
|
Modifier and Type | Field and Description |
---|---|
protected AccessModel |
accessModel
Access model that specifies who is allowed to subscribe and retrieve items.
|
protected Collection<NodeAffiliate> |
affiliates
The JIDs of those who have an affiliation with this node.
|
protected String |
bodyXSLT
The URL of an XSL transformation which can be applied to payloads in order
to generate an appropriate message body element.
|
protected Collection<org.xmpp.packet.JID> |
contacts
The JIDs of those to contact with questions.
|
protected Date |
creationDate
The datetime when the node was created.
|
protected org.xmpp.packet.JID |
creator
The JID of the node creator.
|
protected String |
dataformXSLT
The URL of an XSL transformation which can be applied to the payload format
in order to generate a valid Data Forms result that the client could display
using a generic Data Forms rendering engine.
|
protected boolean |
deliverPayloads
Flag that indicates whether to deliver payloads with event notifications.
|
protected String |
description
A description of the node.
|
protected String |
language
The default language of the node.
|
protected String |
name
The name of the node.
|
protected String |
nodeID
The unique identifier for a node within the context of a pubsub service.
|
protected boolean |
notifyConfigChanges
Flag that indicates whether to notify subscribers when the node configuration changes.
|
protected boolean |
notifyDelete
Flag that indicates whether to notify subscribers when the node is deleted.
|
protected boolean |
notifyRetract
Flag that indicates whether to notify subscribers when items are removed from the node.
|
protected CollectionNode |
parent
Keeps the Node that is containing this node.
|
protected String |
payloadType
The type of payload data to be provided at the node.
|
protected boolean |
presenceBasedDelivery
Flag that indicates whether to deliver notifications to available users only.
|
protected PublisherModel |
publisherModel
Publisher model that specifies who is allowed to publish items to the node.
|
protected Node.ItemReplyPolicy |
replyPolicy
Policy that defines whether owners or publisher should receive replies to items.
|
protected Collection<org.xmpp.packet.JID> |
replyRooms
List of multi-user chat rooms to specify for replyroom.
|
protected Collection<org.xmpp.packet.JID> |
replyTo
List of JID(s) to specify for replyto.
|
protected Collection<String> |
rosterGroupsAllowed
The roster group(s) allowed to subscribe and retrieve items.
|
protected PubSubService |
service
Reference to the publish and subscribe service.
|
protected boolean |
subscriptionConfigurationRequired
Flag that indicates whether new subscriptions should be configured to be active.
|
protected boolean |
subscriptionEnabled
Flag that indicates that subscribing and unsubscribing are enabled.
|
protected Map<String,NodeSubscription> |
subscriptionsByID
Map that contains the current subscriptions to the node.
|
protected Map<String,NodeSubscription> |
subscriptionsByJID
Map that contains the current subscriptions to the node.
|
Modifier and Type | Method and Description |
---|---|
void |
addAffiliate(NodeAffiliate affiliate) |
protected void |
addFormFields(org.xmpp.forms.DataForm form,
boolean isEditing)
Adds the required form fields to the specified form.
|
NodeAffiliate |
addNoneAffiliation(org.xmpp.packet.JID jid)
Adds a new affiliation or updates an existing affiliation of the specified entity JID
to become a none affiliate.
|
NodeAffiliate |
addOutcast(org.xmpp.packet.JID jid)
Sets that the specified entity is an outcast of the node.
|
NodeAffiliate |
addOwner(org.xmpp.packet.JID jid)
Adds a new affiliation or updates an existing affiliation of the specified entity JID
to become a node owner.
|
NodeAffiliate |
addPublisher(org.xmpp.packet.JID jid)
Adds a new affiliation or updates an existing affiliation of the specified entity JID
to become a node publisher.
|
void |
addSubscription(NodeSubscription subscription) |
void |
approveSubscription(NodeSubscription subscription,
boolean approved)
Approves or cancels a subscriptions that was pending to be approved by a node owner.
|
protected void |
broadcastNodeEvent(org.xmpp.packet.Message message,
boolean includeAll)
Broadcasts a node event to subscribers of the node.
|
void |
cancelSubscription(NodeSubscription subscription)
Cancels an existing subscription to the node.
|
void |
cancelSubscription(NodeSubscription subscription,
boolean sendToCluster)
Cancels an existing subscription to the node.
|
protected void |
changeParent(CollectionNode newParent)
Changes the parent node of this node.
|
void |
configure(org.xmpp.forms.DataForm completedForm)
Changes the node configuration based on the completed data form.
|
protected abstract void |
configure(org.xmpp.forms.FormField field)
Configures the node with the completed form field.
|
void |
createSubscription(org.xmpp.packet.IQ originalIQ,
org.xmpp.packet.JID owner,
org.xmpp.packet.JID subscriber,
boolean authorizationRequired,
org.xmpp.forms.DataForm options)
Creates a new subscription and possibly a new affiliate if the owner of the subscription
does not have any existing affiliation with the node.
|
boolean |
delete()
Deletes this node from memory and the database.
|
protected abstract void |
deletingNode()
Notification message indicating that the node is being deleted.
|
boolean |
equals(Object obj) |
AccessModel |
getAccessModel()
Returns the access model that specifies who is allowed to subscribe and retrieve items.
|
NodeAffiliate |
getAffiliate(org.xmpp.packet.JID jid)
|
Collection<NodeAffiliate> |
getAllAffiliates()
Returns all affiliates of the node.
|
Collection<NodeSubscription> |
getAllSubscriptions()
Returns all subscriptions to the node.
|
String |
getBodyXSLT()
Returns the URL of an XSL transformation which can be applied to payloads in order
to generate an appropriate message body element.
|
org.xmpp.forms.DataForm |
getConfigurationForm()
Returns a data form used by the owner to edit the node configuration.
|
Collection<org.xmpp.packet.JID> |
getContacts()
Returns the JIDs of those to contact with questions.
|
Date |
getCreationDate()
Returns the datetime when the node was created.
|
org.xmpp.packet.JID |
getCreator()
Returns the JID of the node creator.
|
String |
getDataformXSLT()
Returns the URL of an XSL transformation which can be applied to the payload format
in order to generate a valid Data Forms result that the client could display
using a generic Data Forms rendering engine.
|
String |
getDescription()
Returns the description of the node.
|
String |
getLanguage()
Returns the default language of the node.
|
PublishedItem |
getLastPublishedItem()
Returns the last
PublishedItem that was published to the node or null if
the node does not have published items. |
org.xmpp.forms.DataForm |
getMetadataForm()
Returns a data form containing the node configuration that is going to be used for
service discovery.
|
Date |
getModificationDate()
Returns the last date when the ndoe's configuration was modified.
|
String |
getName()
Returns the name of the node.
|
String |
getNodeID()
Returns the unique identifier for a node within the context of a pubsub service.
|
Collection<Node> |
getNodes()
Returns the list of nodes contained by this node.
|
Collection<org.xmpp.packet.JID> |
getOwners()
Returns a collection with the JID of the node owners.
|
CollectionNode |
getParent()
Returns the collection node that is containing this node.
|
Collection<CollectionNode> |
getParents()
Returns the complete hierarchy of parents of this node.
|
String |
getPayloadType()
Returns the type of payload data to be provided at the node.
|
Collection<NodeSubscription> |
getPendingSubscriptions()
Returns a list with the subscriptions to the node that are pending to be approved by
a node owner.
|
PublishedItem |
getPublishedItem(String itemID)
Returns the
PublishedItem whose ID matches the specified item ID or null
if none was found. |
List<PublishedItem> |
getPublishedItems()
Returns the list of
PublishedItem that were published to the node. |
List<PublishedItem> |
getPublishedItems(int recentItems)
Returns a list of
PublishedItem with the most recent N items published to
the node. |
PublisherModel |
getPublisherModel()
Returns the publisher model that specifies who is allowed to publish items to the node.
|
Collection<org.xmpp.packet.JID> |
getPublishers()
Returns a collection with the JID of the enitities with an affiliation of
NodeAffiliate.Affiliation.publisher . |
Node.ItemReplyPolicy |
getReplyPolicy() |
Collection<org.xmpp.packet.JID> |
getReplyRooms() |
Collection<org.xmpp.packet.JID> |
getReplyTo() |
Collection<String> |
getRosterGroupsAllowed()
Returns the roster group(s) allowed to subscribe and retrieve items.
|
PubSubService |
getService()
Returns the
PubSubService to which this node belongs. |
NodeSubscription |
getSubscription(org.xmpp.packet.JID subscriberJID)
Returns the subscription whose subscription JID matches the specified JID or
null
if none was found. |
NodeSubscription |
getSubscription(String subscriptionID)
Returns the subscription whose subscription ID matches the specified ID or
null
if none was found. |
Collection<NodeSubscription> |
getSubscriptions(org.xmpp.packet.JID owner)
Returns the list of subscriptions owned by the specified user.
|
int |
hashCode() |
boolean |
isAdmin(org.xmpp.packet.JID user)
Returns true if the specified user is allowed to administer the node.
|
boolean |
isChildNode(Node child)
Returns true if the specified node is a first-level children of this node.
|
boolean |
isCollectionNode()
Returns true if this node is a node container.
|
boolean |
isDescendantNode(Node child)
Returns true if the specified node is a direct child node of this node or
a descendant of the children nodes.
|
boolean |
isMultipleSubscriptionsEnabled()
Returns true if a user may have more than one subscription with the node.
|
boolean |
isNotifiedOfConfigChanges()
Returns true if subscribers will be notified when the node configuration changes.
|
boolean |
isNotifiedOfDelete()
Returns true if subscribers will be notified when the node is deleted.
|
boolean |
isNotifiedOfRetract()
Returns true if subscribers will be notified when items are removed from the node.
|
boolean |
isPayloadDelivered()
Returns true if event notifications will include payloads.
|
boolean |
isPresenceBasedDelivery()
Returns true if notifications are going to be delivered to available users only.
|
boolean |
isPresenceBasedDelivery(org.xmpp.packet.JID user)
Returns true if notifications to the specified user will be delivered when the
user is online.
|
boolean |
isRootCollectionNode()
Returns true if this node is the root node of the pubsub service.
|
boolean |
isSendItemSubscribe()
Returns true if the last published item is going to be sent to new subscribers.
|
boolean |
isSubscriptionConfigurationRequired()
Returns true if new subscriptions should be configured to be active.
|
boolean |
isSubscriptionEnabled()
Returns true if users are allowed to subscribe and unsubscribe.
|
void |
removeOutcast(org.xmpp.packet.JID jid)
Removes the banning to subscribe to the node for the specified entity.
|
void |
removeOwner(org.xmpp.packet.JID jid)
Removes the owner affiliation of the specified entity JID.
|
void |
removePublisher(org.xmpp.packet.JID jid)
Removes the publisher affiliation of the specified entity JID.
|
void |
saveToDB()
Saves the node configuration to the backend store.
|
protected void |
sendEventNotification(org.xmpp.packet.JID subscriberJID,
org.xmpp.packet.Message notification,
Collection<String> subIDs)
Sends an event notification to the specified subscriber.
|
String |
toString() |
protected PubSubService service
protected CollectionNode parent
protected String nodeID
protected boolean deliverPayloads
protected Node.ItemReplyPolicy replyPolicy
protected boolean notifyConfigChanges
protected boolean notifyDelete
protected boolean notifyRetract
protected boolean presenceBasedDelivery
protected PublisherModel publisherModel
protected boolean subscriptionEnabled
protected AccessModel accessModel
protected Collection<String> rosterGroupsAllowed
protected Collection<org.xmpp.packet.JID> replyRooms
protected Collection<org.xmpp.packet.JID> replyTo
protected String payloadType
protected String bodyXSLT
protected String dataformXSLT
protected Date creationDate
protected org.xmpp.packet.JID creator
protected String description
protected String language
protected Collection<org.xmpp.packet.JID> contacts
protected String name
protected boolean subscriptionConfigurationRequired
protected Collection<NodeAffiliate> affiliates
protected Map<String,NodeSubscription> subscriptionsByID
protected Map<String,NodeSubscription> subscriptionsByJID
public NodeAffiliate addOwner(org.xmpp.packet.JID jid)
jid
- the JID of the user being added as a node owner.public void removeOwner(org.xmpp.packet.JID jid)
NodeAffiliate.Affiliation.none
.jid
- the JID of the user being removed as a node owner.public NodeAffiliate addPublisher(org.xmpp.packet.JID jid)
jid
- the JID of the user being added as a node publisher.public void removePublisher(org.xmpp.packet.JID jid)
NodeAffiliate.Affiliation.none
.jid
- the JID of the user being removed as a node publisher.public NodeAffiliate addNoneAffiliation(org.xmpp.packet.JID jid)
jid
- the JID of the user with affiliation "none".public NodeAffiliate addOutcast(org.xmpp.packet.JID jid)
jid
- the JID of the user that is no longer able to publish or subscribe to the node.public void removeOutcast(org.xmpp.packet.JID jid)
jid
- the JID of the user that is no longer an outcast.public Collection<NodeSubscription> getSubscriptions(org.xmpp.packet.JID owner)
isMultipleSubscriptionsEnabled()
.
Each subscription may have a different subscription JID if the owner wants to receive
notifications in different resources (or even JIDs).owner
- the owner of the subscriptions.public Collection<NodeSubscription> getAllSubscriptions()
subId
, otherwise it returns
the subscriptions by JID
.public Collection<NodeAffiliate> getAllAffiliates()
public NodeAffiliate getAffiliate(org.xmpp.packet.JID jid)
NodeAffiliate
of the specified JID
or null
if none was found. Users that have a subscription with the node will ALWAYS
have an affiliation even if the affiliation is of type none
.jid
- the JID of the user to look his affiliation with this node.null
if none was found.public Collection<org.xmpp.packet.JID> getOwners()
NodeAffiliate.Affiliation.owner
. Owners are allowed to purge
and delete the node. Moreover, owners may also get The collection can be modified
since it represents a snapshot.public Collection<org.xmpp.packet.JID> getPublishers()
NodeAffiliate.Affiliation.publisher
. When using the publisher model
OpenPublisher
anyone may publish
to the node so this collection may be empty or may not contain the complete list
of publishers. The returned collection can be modified since it represents a snapshot.public void configure(org.xmpp.forms.DataForm completedForm) throws NotAcceptableException
completedForm
- the completed data form.NotAcceptableException
- if completed data form tries to leave the node without owners.protected abstract void configure(org.xmpp.forms.FormField field) throws NotAcceptableException
configure(org.xmpp.forms.DataForm)
.
Subclasses should implement this method in order to configure the node with form
fields specific to the node type.field
- the form field specific to the node type.NotAcceptableException
- if field cannot be configured because of invalid data.public org.xmpp.forms.DataForm getConfigurationForm()
protected void addFormFields(org.xmpp.forms.DataForm form, boolean isEditing)
form
- the form containing the node configuration.isEditing
- true when the form will be used to edit the node configuration.public org.xmpp.forms.DataForm getMetadataForm()
public boolean isRootCollectionNode()
public boolean isMultipleSubscriptionsEnabled()
subid
attribute. By default multiple
subscriptions is enabled.public boolean isCollectionNode()
public boolean isChildNode(Node child)
child
- the node to check if it is a direct child of this node.public boolean isDescendantNode(Node child)
child
- the node to check if it is a descendant of this node.public boolean isAdmin(org.xmpp.packet.JID user)
user
- the user to check if he is an admin.public PubSubService getService()
PubSubService
to which this node belongs.public String getNodeID()
public String getName()
public boolean isPayloadDelivered()
public Node.ItemReplyPolicy getReplyPolicy()
public boolean isNotifiedOfConfigChanges()
public boolean isNotifiedOfDelete()
public boolean isNotifiedOfRetract()
public boolean isPresenceBasedDelivery()
public boolean isPresenceBasedDelivery(org.xmpp.packet.JID user)
user
- the JID of the affiliate that has to be subscribed to the node.public boolean isSendItemSubscribe()
public PublisherModel getPublisherModel()
public boolean isSubscriptionEnabled()
public boolean isSubscriptionConfigurationRequired()
public AccessModel getAccessModel()
public Collection<String> getRosterGroupsAllowed()
RosterAccess
access model.public Collection<org.xmpp.packet.JID> getReplyRooms()
public Collection<org.xmpp.packet.JID> getReplyTo()
public String getPayloadType()
public String getBodyXSLT()
public String getDataformXSLT()
public Date getCreationDate()
public Date getModificationDate()
public org.xmpp.packet.JID getCreator()
public String getDescription()
public String getLanguage()
public Collection<org.xmpp.packet.JID> getContacts()
public Collection<Node> getNodes()
CollectionNode
may
contain other nodes.public CollectionNode getParent()
public Collection<CollectionNode> getParents()
public void saveToDB()
public void addAffiliate(NodeAffiliate affiliate)
public void addSubscription(NodeSubscription subscription)
public NodeSubscription getSubscription(org.xmpp.packet.JID subscriberJID)
null
if none was found. Accessing subscriptions by subscription JID and not by subscription ID
is only possible when the node does not allow multiple subscriptions from the same entity.
If the node allows multiple subscriptions and this message is sent then an
IllegalStateException exception is going to be thrown.subscriberJID
- the JID of the entity that receives event notifications.null
if none was found.IllegalStateException
- If this message was used when the node supports multiple
subscriptions.public NodeSubscription getSubscription(String subscriptionID)
null
if none was found. Accessing subscriptions by subscription ID is always possible no matter
if the node allows one or multiple subscriptions for the same entity. Even when users can
only subscribe once to the node a subscription ID is going to be internally created though
never returned to the user.subscriptionID
- the ID of the subscription.null
if none was found.public boolean delete()
protected abstract void deletingNode()
protected void changeParent(CollectionNode newParent)
No notifications are sent due to the new parent adoption process.
newParent
- the new parent node of this node.protected void broadcastNodeEvent(org.xmpp.packet.Message message, boolean includeAll)
message
- the message containing the node event.includeAll
- true if all subscribers will be notified no matter their
subscriptions status or configuration.protected void sendEventNotification(org.xmpp.packet.JID subscriberJID, org.xmpp.packet.Message notification, Collection<String> subIDs)
subscriberJID
- the subscriber JID that will get the notification.notification
- the message to send to the subscriber.subIDs
- the list of affected subscription IDs or null when node does not
allow multiple subscriptions.public void createSubscription(org.xmpp.packet.IQ originalIQ, org.xmpp.packet.JID owner, org.xmpp.packet.JID subscriber, boolean authorizationRequired, org.xmpp.forms.DataForm options)
The originalIQ parameter may be null
when using this API internally. When no
IQ packet was sent then no IQ result will be sent to the sender. The rest of the
functionality is the same.
originalIQ
- the IQ packet sent by the entity to subscribe to the node or
null when using this API internally.owner
- the JID of the affiliate.subscriber
- the JID where event notifications are going to be sent.authorizationRequired
- true if the new subscriptions needs to be authorized by
a node owner.options
- the data form with the subscription configuration or null if subscriber
didn't provide a configuration.public void cancelSubscription(NodeSubscription subscription, boolean sendToCluster)
none
then
remove the existing affiliation too.subscription
- the subscription to cancel.sendToCluster
- True to forward cancel order to cluster peerspublic void cancelSubscription(NodeSubscription subscription)
none
then
remove the existing affiliation too.subscription
- the subscription to cancel.public PublishedItem getPublishedItem(String itemID)
PublishedItem
whose ID matches the specified item ID or null
if none was found. Item ID may or may not exist and it depends on the node's configuration.
When the node is configured to not include payloads in event notifications and
published items are not persistent then item ID is not used. In this case a null
value will always be returned.itemID
- the ID of the item to retrieve.public List<PublishedItem> getPublishedItems()
PublishedItem
that were published to the node. The
returned collection cannot be modified. Collection nodes does not support publishing
of items so an empty list will be returned in that case.public List<PublishedItem> getPublishedItems(int recentItems)
PublishedItem
with the most recent N items published to
the node. The returned collection cannot be modified. Collection nodes does not
support publishing of items so an empty list will be returned in that case.recentItems
- number of recent items to retrieve.public Collection<NodeSubscription> getPendingSubscriptions()
AuthorizeAccess
then the result will
be an empty collection.public PublishedItem getLastPublishedItem()
PublishedItem
that was published to the node or null
if
the node does not have published items. Collection nodes does not support publishing
of items so a null
will be returned in that case.null
if
the node does not have published items.public void approveSubscription(NodeSubscription subscription, boolean approved)
subscription
- the subscriptions that was approved or rejected.approved
- true when susbcription was approved. Otherwise the subscription was rejected.Copyright © 2003–2019 Ignite Realtime. All rights reserved.