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 ; }
Creates a node with specified configuration .