/** * Sets the node type. * * @param type The node type */ public void setNodeType(NodeType type) { addField(ConfigureNodeFields.node_type, FormField.Type.list_single); setAnswer(ConfigureNodeFields.node_type.getFieldName(), getListSingle(type.toString())); }
/** * Creates a node with specified configuration. * * Note: This is the only way to create a collection node. * * @param nodeId The name of the node, which must be unique within the * pubsub service * @param config The configuration for the node * @return The node that was created * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId)); boolean isLeafNode = true; if (config != null) { request.addExtension(new FormNode(FormNodeType.CONFIGURE, config)); FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName()); if (nodeTypeField != null) isLeafNode = nodeTypeField.getValues().get(0).toString().equals(NodeType.leaf.toString()); } // Errors will cause exceptions in getReply, so it only returns // on success. sendPubsubPacket(request); Node newNode = isLeafNode ? new LeafNode(this, nodeId) : new CollectionNode(this, nodeId); nodeMap.put(newNode.getId(), newNode); return newNode; }
/** * Sets the node type * * @param type The node type */ public void setNodeType(NodeType type) { addField(ConfigureNodeFields.node_type, FormField.TYPE_LIST_SINGLE); setAnswer(ConfigureNodeFields.node_type.getFieldName(), getListSingle(type.toString())); }
/** * Sets the node type * * @param type The node type */ public void setNodeType(NodeType type) { addField(ConfigureNodeFields.node_type, FormField.TYPE_LIST_SINGLE); setAnswer(ConfigureNodeFields.node_type.getFieldName(), getListSingle(type.toString())); }
/** * Sets the node type * * @param type The node type */ public void setNodeType(NodeType type) { addField(ConfigureNodeFields.node_type, FormField.TYPE_LIST_SINGLE); setAnswer(ConfigureNodeFields.node_type.getFieldName(), getListSingle(type.toString())); }
if (infoReply.getIdentities().next().getType().equals(NodeType.leaf.toString())) node = new LeafNode(con, id); else
if (infoReply.getIdentities().next().getType().equals(NodeType.leaf.toString())) node = new LeafNode(con, id); else
if (infoReply.getIdentities().next().getType().equals(NodeType.leaf.toString())) node = new LeafNode(con, id); else
isLeafNode = nodeTypeField.getValues().next().equals(NodeType.leaf.toString());
isLeafNode = nodeTypeField.getValues().next().equals(NodeType.leaf.toString());
isLeafNode = nodeTypeField.getValues().next().equals(NodeType.leaf.toString());