Package org.jivesoftware.openfire.pubsub
Class CollectionNode
java.lang.Object
org.jivesoftware.openfire.pubsub.Node
org.jivesoftware.openfire.pubsub.CollectionNode
- All Implemented Interfaces:
Externalizable
,Serializable
,Cacheable
A type of node that contains nodes and/or other collections but no published
items. Collections provide the foundation entity to provide a means of representing
hierarchical node structures.
- Author:
- Matt Tucker
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Policy that defines who may associate leaf nodes with a collection.Nested classes/interfaces inherited from class org.jivesoftware.openfire.pubsub.Node
Node.ItemReplyPolicy, Node.UniqueIdentifier
-
Field Summary
Fields inherited from class org.jivesoftware.openfire.pubsub.Node
accessModel, affiliates, bodyXSLT, contacts, creationDate, creator, dataformXSLT, deliverPayloads, description, language, name, nodeID, notifyConfigChanges, notifyDelete, notifyRetract, parentIdentifier, payloadType, presenceBasedDelivery, publisherModel, replyPolicy, replyRooms, replyTo, rosterGroupsAllowed, serviceIdentifier, subscriptionConfigurationRequired, subscriptionEnabled, subscriptionsByID, subscriptionsByJID
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionNode
(PubSubService.UniqueIdentifier serviceId, CollectionNode parentNode, String nodeID, org.xmpp.packet.JID creator, boolean subscriptionEnabled, boolean deliverPayloads, boolean notifyConfigChanges, boolean notifyDelete, boolean notifyRetract, boolean presenceBasedDelivery, AccessModel accessModel, PublisherModel publisherModel, String language, Node.ItemReplyPolicy replyPolicy, CollectionNode.LeafNodeAssociationPolicy associationPolicy, int maxLeafNodes) CollectionNode
(PubSubService.UniqueIdentifier serviceId, CollectionNode parentNode, String nodeID, org.xmpp.packet.JID creator, DefaultNodeConfiguration defaultConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addFormFields
(org.xmpp.forms.DataForm form, Locale preferredLocale, boolean isEditing) Adds the required form fields to the specified form.protected void
configure
(org.xmpp.forms.FormField field) Configures the node with the completed form field.protected void
Notification message indicating that the node is being deleted.Returns the policy that defines who may associate leaf nodes with a collection.Collection<org.xmpp.packet.JID>
Returns the users that are allowed to associate leaf nodes with this collection node.int
Returns the approximate size of the Object in bytes.protected org.slf4j.Logger
int
Returns the max number of leaf nodes that this collection node might have.getNodes()
Returns the list of nodes contained by this node.boolean
isAssociationAllowed
(org.xmpp.packet.JID user) Returns true if the specified user is allowed to associate a leaf node with this node.boolean
isChildNode
(Node child) Returns true if the specified node is a first-level children of this collection node.boolean
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 collection node or a descendant of the children nodes.boolean
Returns true if the max number of leaf nodes associated with this node has reached to the maximum allowed.void
void
Methods inherited from class org.jivesoftware.openfire.pubsub.Node
addAffiliate, addNoneAffiliation, addOutcast, addOwner, addPublisher, addSubscription, approveSubscription, broadcastNodeEvent, cancelSubscription, cancelSubscription, changeParent, configure, createSubscription, delete, equals, getAccessModel, getAffiliate, getAllAffiliates, getAllSubscriptions, getBodyXSLT, getConfigurationForm, getContacts, getCreationDate, getCreator, getDataformXSLT, getDescription, getLanguage, getLastPublishedItem, getMetadataForm, getModificationDate, getName, getNodeID, getOwners, getParent, getParents, getPayloadType, getPendingSubscriptions, getPublishedItem, getPublishedItems, getPublishedItems, getPublisherModel, getPublishers, getReplyPolicy, getReplyRooms, getReplyTo, getRosterGroupsAllowed, getService, getSubscription, getSubscription, getSubscriptions, getUniqueIdentifier, hashCode, isAdmin, isMultipleSubscriptionsEnabled, isNotifiedOfConfigChanges, isNotifiedOfDelete, isNotifiedOfRetract, isPayloadDelivered, isPresenceBasedDelivery, isPresenceBasedDelivery, isRootCollectionNode, isSendItemSubscribe, isSubscriptionConfigurationRequired, isSubscriptionEnabled, removeOutcast, removeOwner, removePublisher, saveToDB, sendEventNotification, toString
-
Constructor Details
-
CollectionNode
public CollectionNode(PubSubService.UniqueIdentifier serviceId, CollectionNode parentNode, String nodeID, org.xmpp.packet.JID creator, boolean subscriptionEnabled, boolean deliverPayloads, boolean notifyConfigChanges, boolean notifyDelete, boolean notifyRetract, boolean presenceBasedDelivery, AccessModel accessModel, PublisherModel publisherModel, String language, Node.ItemReplyPolicy replyPolicy, CollectionNode.LeafNodeAssociationPolicy associationPolicy, int maxLeafNodes) -
CollectionNode
public CollectionNode(PubSubService.UniqueIdentifier serviceId, CollectionNode parentNode, String nodeID, org.xmpp.packet.JID creator, DefaultNodeConfiguration defaultConfiguration) -
CollectionNode
public CollectionNode()
-
-
Method Details
-
configure
Description copied from class:Node
Configures the node with the completed form field. Fields that are common to leaf and collection nodes are handled inNode.configure(org.xmpp.forms.DataForm)
. Subclasses should implement this method in order to configure the node with form fields specific to the node type.- Specified by:
configure
in classNode
- Parameters:
field
- the form field specific to the node type.- Throws:
NotAcceptableException
- if field cannot be configured because of invalid data.
-
addFormFields
protected void addFormFields(org.xmpp.forms.DataForm form, Locale preferredLocale, boolean isEditing) Description copied from class:Node
Adds the required form fields to the specified form. When editing is true the field type and a label is included in each field. The form being completed will contain the current node configuration. This information can be used for editing the node or for notifying that the node configuration has changed.- Overrides:
addFormFields
in classNode
- Parameters:
form
- the form containing the node configuration.preferredLocale
- the preferred locale to localize the form.isEditing
- true when the form will be used to edit the node configuration.
-
deletingNode
protected void deletingNode()Description copied from class:Node
Notification message indicating that the node is being deleted. Subclasses should implement this method to delete any subclass specific information.- Specified by:
deletingNode
in classNode
-
isCollectionNode
public boolean isCollectionNode()Description copied from class:Node
Returns true if this node is a node container. Node containers may only contain nodes but are not allowed to get items published.- Overrides:
isCollectionNode
in classNode
- Returns:
- true if this node is a node container.
-
isChildNode
Returns true if the specified node is a first-level children of this collection node.- Overrides:
isChildNode
in classNode
- Parameters:
child
- the node to check if it is a direct child of this node.- Returns:
- true if the specified node is a first-level children of this collection node.
-
isDescendantNode
Returns true if the specified node is a direct child node of this collection node or a descendant of the children nodes.- Overrides:
isDescendantNode
in classNode
- Parameters:
child
- the node to check if it is a descendant of this node.- Returns:
- true if the specified node is a direct child node of this collection node or a descendant of the children nodes.
-
getNodes
Description copied from class:Node
Returns the list of nodes contained by this node. OnlyCollectionNode
may contain other nodes. -
getAssociationPolicy
Returns the policy that defines who may associate leaf nodes with a collection.- Returns:
- the policy that defines who may associate leaf nodes with a collection.
-
getAssociationTrusted
Returns the users that are allowed to associate leaf nodes with this collection node. This collection is going to be used only when the associationPolicy iswhitelist
.- Returns:
- the users that are allowed to associate leaf nodes with this collection node.
-
getMaxLeafNodes
public int getMaxLeafNodes()Returns the max number of leaf nodes that this collection node might have. A value of -1 means that there is no limit.- Returns:
- the max number of leaf nodes that this collection node might have.
-
isAssociationAllowed
public boolean isAssociationAllowed(org.xmpp.packet.JID user) Returns true if the specified user is allowed to associate a leaf node with this node. The decision is taken based on the association policy that the node is using.- Parameters:
user
- the user trying to associate a leaf node with this node.- Returns:
- true if the specified user is allowed to associate a leaf node with this node.
-
isMaxLeafNodeReached
public boolean isMaxLeafNodeReached()Returns true if the max number of leaf nodes associated with this node has reached to the maximum allowed.- Returns:
- true if the max number of leaf nodes associated with this node has reached to the maximum allowed.
-
getCachedSize
Description copied from interface:Cacheable
Returns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.- Specified by:
getCachedSize
in interfaceCacheable
- Overrides:
getCachedSize
in classNode
- Returns:
- the size of the Object in bytes.
- Throws:
CannotCalculateSizeException
- if the size cannot be calculated
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classNode
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classNode
- Throws:
IOException
ClassNotFoundException
-
getLogger
protected org.slf4j.Logger getLogger()
-