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;
    }
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 ( ) ) ; } sendPubsubPacket ( request ) ; Node newNode = isLeafNode ? new LeafNode ( this , nodeId ) : new CollectionNode ( this , nodeId ) ; nodeMap . put ( newNode . getId ( ) , newNode ) ; return newNode ; }
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