📄 defaultnodeconfiguration.java
字号:
* Sets the maximum payload size in bytes. * * @param maxPayloadSize the maximum payload size in bytes. */ public void setMaxPayloadSize(int maxPayloadSize) { this.maxPayloadSize = maxPayloadSize; } /** * Sets 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. * * @param persistPublishedItems true if items are going to be persisted in a storage. */ public void setPersistPublishedItems(boolean persistPublishedItems) { this.persistPublishedItems = persistPublishedItems; } /** * Sets 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. * * @param maxPublishedItems the maximum number of published items to persist. */ public void setMaxPublishedItems(int maxPublishedItems) { this.maxPublishedItems = maxPublishedItems; } /** * Sets if subscribers are going to be notified when node configuration changes. * * @param notifyConfigChanges true if subscribers are going to be notified when node * configuration changes. */ public void setNotifyConfigChanges(boolean notifyConfigChanges) { this.notifyConfigChanges = notifyConfigChanges; } /** * Sets if subscribers are going to be notified when node is deleted. * * @param notifyDelete true if subscribers are going to be notified when node is deleted. */ public void setNotifyDelete(boolean notifyDelete) { this.notifyDelete = notifyDelete; } /** * Sets if subscribers are going to be notified when items are removed from the node. * * @param notifyRetract true if subscribers are going to be notified when items are removed * from the node. */ public void setNotifyRetract(boolean notifyRetract) { this.notifyRetract = notifyRetract; } /** * Sets if notifications are going to be delivered only to available users. * * @param presenceBasedDelivery true if notifications are going to be delivered only to * available users. */ public void setPresenceBasedDelivery(boolean presenceBasedDelivery) { this.presenceBasedDelivery = presenceBasedDelivery; } /** * Sets if new subscribers are going to receive new items once subscribed. * * @param sendItemSubscribe true if new subscribers are going to receive new items * once subscribed. */ public void setSendItemSubscribe(boolean sendItemSubscribe) { this.sendItemSubscribe = sendItemSubscribe; } /** * Sets the publisher model that specifies who is allowed to publish items to the node. * * @param publisherModel the publisher model that specifies who is allowed to publish * items to the node. */ public void setPublisherModel(PublisherModel publisherModel) { this.publisherModel = publisherModel; } /** * Sets if subscribing and unsubscribing are enabled. * * @param subscriptionEnabled true if subscribing and unsubscribing are enabled. */ public void setSubscriptionEnabled(boolean subscriptionEnabled) { this.subscriptionEnabled = subscriptionEnabled; } /** * Sets the access model that specifies who is allowed to subscribe and retrieve items. * * @param accessModel the access model that specifies who is allowed to subscribe and * retrieve items. */ public void setAccessModel(AccessModel accessModel) { this.accessModel = accessModel; } /** * Sets the default language of the node. * * @param language the default language of the node. */ public void setLanguage(String language) { this.language = language; } /** * Sets the policy that defines whether owners or publisher should receive replies to items. * * @param replyPolicy the policy that defines whether owners or publisher should receive * replies to items. */ public void setReplyPolicy(Node.ItemReplyPolicy replyPolicy) { this.replyPolicy = replyPolicy; } /** * Sets the policy that defines who may associate leaf nodes with a collection. * * @param associationPolicy the policy that defines who may associate leaf nodes * with a collection. */ public void setAssociationPolicy(CollectionNode.LeafNodeAssociationPolicy associationPolicy) { this.associationPolicy = associationPolicy; } /** * Sets the max number of leaf nodes that this collection node might have. A value of * -1 means that there is no limit. * * @param maxLeafNodes the max number of leaf nodes that this collection node might have. */ public void setMaxLeafNodes(int maxLeafNodes) { this.maxLeafNodes = maxLeafNodes; } public DataForm getConfigurationForm() { DataForm form = new DataForm(DataForm.Type.form); form.setTitle(LocaleUtils.getLocalizedString("pubsub.form.default.title")); form.addInstruction(LocaleUtils.getLocalizedString("pubsub.form.default.instruction")); // Add the form fields and configure them for edition FormField formField = form.addField(); formField.setVariable("FORM_TYPE"); formField.setType(FormField.Type.hidden); formField.addValue("http://jabber.org/protocol/pubsub#node_config"); formField = form.addField(); formField.setVariable("pubsub#subscribe"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.subscribe")); formField.addValue(subscriptionEnabled); formField = form.addField(); formField.setVariable("pubsub#deliver_payloads"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.deliver_payloads")); formField.addValue(deliverPayloads); formField = form.addField(); formField.setVariable("pubsub#notify_config"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.notify_config")); formField.addValue(notifyConfigChanges); formField = form.addField(); formField.setVariable("pubsub#notify_delete"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.notify_delete")); formField.addValue(notifyDelete); formField = form.addField(); formField.setVariable("pubsub#notify_retract"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.notify_retract")); formField.addValue(notifyRetract); formField = form.addField(); formField.setVariable("pubsub#presence_based_delivery"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.presence_based")); formField.addValue(presenceBasedDelivery); if (leaf) { formField = form.addField(); formField.setVariable("pubsub#send_item_subscribe"); formField.setType(FormField.Type.boolean_type); formField.setLabel( LocaleUtils.getLocalizedString("pubsub.form.conf.send_item_subscribe")); formField.addValue(sendItemSubscribe); formField = form.addField(); formField.setVariable("pubsub#persist_items"); formField.setType(FormField.Type.boolean_type); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.persist_items")); formField.addValue(persistPublishedItems); formField = form.addField(); formField.setVariable("pubsub#max_items"); formField.setType(FormField.Type.text_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.max_items")); formField.addValue(maxPublishedItems); formField = form.addField(); formField.setVariable("pubsub#max_payload_size"); formField.setType(FormField.Type.text_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.max_payload_size")); formField.addValue(maxPayloadSize); } formField = form.addField(); formField.setVariable("pubsub#access_model"); formField.setType(FormField.Type.list_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.access_model")); formField.addOption(null, AccessModel.authorize.getName()); formField.addOption(null, AccessModel.open.getName()); formField.addOption(null, AccessModel.presence.getName()); formField.addOption(null, AccessModel.roster.getName()); formField.addOption(null, AccessModel.whitelist.getName()); formField.addValue(accessModel.getName()); formField = form.addField(); formField.setVariable("pubsub#publish_model"); formField.setType(FormField.Type.list_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.publish_model")); formField.addOption(null, PublisherModel.publishers.getName()); formField.addOption(null, PublisherModel.subscribers.getName()); formField.addOption(null, PublisherModel.open.getName()); formField.addValue(publisherModel.getName()); formField = form.addField(); formField.setVariable("pubsub#language"); formField.setType(FormField.Type.text_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.language")); formField.addValue(language); formField = form.addField(); formField.setVariable("pubsub#itemreply"); formField.setType(FormField.Type.list_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.itemreply")); if (replyPolicy != null) { formField.addValue(replyPolicy.name()); } if (!leaf) { formField = form.addField(); formField.setVariable("pubsub#leaf_node_association_policy"); formField.setType(FormField.Type.list_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.leaf_node_association")); formField.addOption(null, CollectionNode.LeafNodeAssociationPolicy.all.name()); formField.addOption(null, CollectionNode.LeafNodeAssociationPolicy.owners.name()); formField.addOption(null, CollectionNode.LeafNodeAssociationPolicy.whitelist.name()); formField.addValue(associationPolicy.name()); formField = form.addField(); formField.setVariable("pubsub#leaf_nodes_max"); formField.setType(FormField.Type.text_single); formField.setLabel(LocaleUtils.getLocalizedString("pubsub.form.conf.leaf_nodes_max")); formField.addValue(maxLeafNodes); } return form; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -