📄 defaultnodeconfiguration.java
字号:
/** * $RCSfile: $ * $Revision: $ * $Date: $ * * Copyright (C) 2006 Jive Software. All rights reserved. * * This software is published under the terms of the GNU Public License (GPL), * a copy of which is included in this distribution. */package org.jivesoftware.wildfire.pubsub;import org.jivesoftware.util.LocaleUtils;import org.jivesoftware.wildfire.pubsub.models.AccessModel;import org.jivesoftware.wildfire.pubsub.models.PublisherModel;import org.xmpp.forms.DataForm;import org.xmpp.forms.FormField;/** * A DefaultNodeConfiguration keeps the default configuration values for leaf or collection * nodes of a particular publish-subscribe service. New nodes created for the service * will be initialized with the values defined in the default configuration. * * @author Matt Tucker */public class DefaultNodeConfiguration { /** * Flag indicating whether this default configutation belongs to a leaf node or not. */ private boolean leaf; /** * Flag that indicates whether to deliver payloads with event notifications. */ private boolean deliverPayloads; /** * The maximum payload size in bytes. */ private int maxPayloadSize; /** * Flag that indicates whether to persist items to storage. Note that when the * variable is false then the last published item is the only items being saved * to the backend storage. */ private boolean persistPublishedItems; /** * Maximum number of published items to persist. Note that all nodes are going to persist * their published items. The only difference is the number of the last published items * to be persisted. Even nodes that are configured to not use persitent items are going * to save the last published item. */ private int maxPublishedItems; /** * Flag that indicates whether to notify subscribers when the node configuration changes. */ private boolean notifyConfigChanges; /** * Flag that indicates whether to notify subscribers when the node is deleted. */ private boolean notifyDelete; /** * Flag that indicates whether to notify subscribers when items are removed from the node. */ private boolean notifyRetract; /** * Flag that indicates whether to deliver notifications to available users only. */ private boolean presenceBasedDelivery; /** * Flag that indicates whether to send items to new subscribers. */ private boolean sendItemSubscribe = false; /** * Publisher model that specifies who is allowed to publish items to the node. */ private PublisherModel publisherModel = PublisherModel.open; /** * Flag that indicates that subscribing and unsubscribing are enabled. */ private boolean subscriptionEnabled; /** * Access model that specifies who is allowed to subscribe and retrieve items. */ private AccessModel accessModel = AccessModel.open; /** * The default language of the node. */ private String language = ""; /** * Policy that defines whether owners or publisher should receive replies to items. */ private Node.ItemReplyPolicy replyPolicy = Node.ItemReplyPolicy.owner; /** * Policy that defines who may associate leaf nodes with a collection. */ private CollectionNode.LeafNodeAssociationPolicy associationPolicy = CollectionNode.LeafNodeAssociationPolicy.all; /** * Max number of leaf nodes that this collection node might have. A value of -1 means * that there is no limit. */ private int maxLeafNodes = -1; public DefaultNodeConfiguration(boolean isLeafType) { this.leaf = isLeafType; } /** * Returns true if this default configutation belongs to a leaf node. * * @return true if this default configutation belongs to a leaf node. */ public boolean isLeaf() { return leaf; } /** * Returns true if payloads are going to be delivered with event notifications. * * @return true if payloads are going to be delivered with event notifications. */ public boolean isDeliverPayloads() { return deliverPayloads; } /** * Returns the maximum payload size in bytes. * * @return the maximum payload size in bytes. */ public int getMaxPayloadSize() { return maxPayloadSize; } /** * Returns true if items are going to be persisted in a storage. Note that when the * variable is false then the last published item is the only items being saved * to the backend storage. * * @return true if items are going to be persisted in a storage. */ public boolean isPersistPublishedItems() { return persistPublishedItems; } /** * Returns the maximum number of published items to persist. Note that all nodes are going * to persist their published items. The only difference is the number of the last published * items to be persisted. Even nodes that are configured to not use persitent items are going * to save the last published item. * * @return the maximum number of published items to persist. */ public int getMaxPublishedItems() { return maxPublishedItems; } /** * Returns true if subscribers are going to be notified when node configuration changes. * * @return true if subscribers are going to be notified when node configuration changes. */ public boolean isNotifyConfigChanges() { return notifyConfigChanges; } /** * Returns true if subscribers are going to be notified when node is deleted. * * @return true if subscribers are going to be notified when node is deleted. */ public boolean isNotifyDelete() { return notifyDelete; } /** * Returns true if subscribers are going to be notified when items are removed from the node. * * @return true if subscribers are going to be notified when items are removed from the node. */ public boolean isNotifyRetract() { return notifyRetract; } /** * Returns true if notifications are going to be delivered only to available users. * * @return true if notifications are going to be delivered only to available users. */ public boolean isPresenceBasedDelivery() { return presenceBasedDelivery; } /** * Returns true if new subscribers are going to receive new items once subscribed. * * @return true if new subscribers are going to receive new items once subscribed. */ public boolean isSendItemSubscribe() { return sendItemSubscribe; } /** * Returnes the publisher model that specifies who is allowed to publish items to the node. * * @return the publisher model that specifies who is allowed to publish items to the node. */ public PublisherModel getPublisherModel() { return publisherModel; } /** * Returns true if subscribing and unsubscribing are enabled. * * @return true if subscribing and unsubscribing are enabled. */ public boolean isSubscriptionEnabled() { return subscriptionEnabled; } /** * Returns the access model that specifies who is allowed to subscribe and retrieve items. * * @return the access model that specifies who is allowed to subscribe and retrieve items. */ public AccessModel getAccessModel() { return accessModel; } /** * Returns the default language of the node. * * @return the default language of the node. */ public String getLanguage() { return language; } /** * Returns the policy that defines whether owners or publisher should receive * replies to items. * * @return the policy that defines whether owners or publisher should receive * replies to items. */ public Node.ItemReplyPolicy getReplyPolicy() { return replyPolicy; } /** * Returns the policy that defines who may associate leaf nodes with a collection. * * @return the policy that defines who may associate leaf nodes with a collection. */ public CollectionNode.LeafNodeAssociationPolicy getAssociationPolicy() { return associationPolicy; } /** * Returns the max number of leaf nodes that this collection node might have. A value of * -1 means that there is no limit. * * @return the max number of leaf nodes that this collection node might have. */ public int getMaxLeafNodes() { return maxLeafNodes; } /** * Sets if payloads are going to be delivered with event notifications. * * @param deliverPayloads true if payloads are going to be delivered with event notifications. */ public void setDeliverPayloads(boolean deliverPayloads) { this.deliverPayloads = deliverPayloads; } /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -