public Node getNode ( String id ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException , NotAPubSubNodeException { Node node = nodeMap . get ( id ) ; if ( node == null ) { DiscoverInfo info = new DiscoverInfo ( ) ; info . setTo ( pubSubService ) ; info . setNode ( id ) ; DiscoverInfo infoReply = connection ( ) . createStanzaCollectorAndSend ( info ) . nextResultOrThrow ( ) ; if ( infoReply . hasIdentity ( PubSub . ELEMENT , "leaf" ) ) { node = new LeafNode ( this , id ) ; } else if ( infoReply . hasIdentity ( PubSub . ELEMENT , "collection" ) ) { node = new CollectionNode ( this , id ) ; } else { throw new PubSubException . NotAPubSubNodeException ( id , infoReply ) ; } nodeMap . put ( id , node ) ; } return node ; }
Retrieves the requested node if it exists . It will throw an exception if it does not .