Package org.jivesoftware.smackx.packet

Examples of org.jivesoftware.smackx.packet.DiscoverInfo$Identity


     * @return the discovered information.
     * @throws XMPPException if the operation failed for some reason.
     */
    public DiscoverInfo discoverInfo(String entityID, String node) throws XMPPException {
        // Discover the entity's info
        DiscoverInfo disco = new DiscoverInfo();
        disco.setType(IQ.Type.GET);
        disco.setTo(entityID);
        disco.setNode(node);

        // Create a packet collector to listen for a response.
        PacketCollector collector =
            connection.createPacketCollector(new PacketIDFilter(disco.getPacketID()));

        connection.sendPacket(disco);

        // Wait up to 5 seconds for a result.
        IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
View Full Code Here


     * @param entityID the address of the XMPP entity.
     * @return true if the server supports publishing of items.
     * @throws XMPPException if the operation failed for some reason.
     */
    public boolean canPublishItems(String entityID) throws XMPPException {
        DiscoverInfo info = discoverInfo(entityID);
        return info.containsFeature("http://jabber.org/protocol/disco#publish");
    }
View Full Code Here

        infoColumn.setResizable( true );

        manager = ServiceDiscoveryManager.getInstanceFor( parent.getJavwerManager().getConnection() );
        TreeItem item = new TreeItem( tree, SWT.NONE );
        try {
        DiscoverInfo info = manager.discoverInfo( entityID );
       
        item.setData( "jabber:iq:register", Boolean.toString( info.containsFeature( "jabber:iq:register" ) ) );
        item.setData( "jabber:iq:search", Boolean.toString( info.containsFeature( "jabber:iq:search" ) ) );
        item.setData( "http://jabber.org/protocol/muc", Boolean.toString( info.containsFeature( "http://jabber.org/protocol/muc" ) ) );
        } catch( Exception e ) {}
        //item.setData( "jabber:iq:register", "true" );
        item.setText( entityID );
        displayEntityTree( item, entityID, null );
       
View Full Code Here

                DiscoverItems.Item item = (DiscoverItems.Item) i.next();
                TreeItem treeItem = new TreeItem( parent, SWT.NONE );
                parent.setExpanded( true );
                String text[] = { item.getEntityID(), item.getName(), item.getNode(), item.getAction() };
                treeItem.setText( text );
                DiscoverInfo info = manager.discoverInfo( item.getEntityID() );
                treeItem.setData( "jabber:iq:register", Boolean.toString( info.containsFeature( "jabber:iq:register" ) ) );
                treeItem.setData( "jabber:iq:search", Boolean.toString( info.containsFeature( "jabber:iq:search" ) ) );
                treeItem.setData( "http://jabber.org/protocol/muc", Boolean.toString( info.containsFeature( "http://jabber.org/protocol/muc" ) ) );
                for( Iterator j = info.getIdentities(); j.hasNext(); ) {
                    DiscoverInfo.Identity ident = (DiscoverInfo.Identity) j.next();
                    treeItem.setText( 3, ident.getType() + " > " + ident.getCategory() + " > " + ident.getName() );
                }
                /*
                for( Iterator j = manager.discoverInfo( item.getEntityID() ).getIdentities(); j.hasNext(); ) {
View Full Code Here

//                if (item.getEntityID().startsWith("rtpbridge.")) {
//                    return true;
//                }
//            }
           
            DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName());
            Iterator<DiscoverInfo.Identity> iter = discoInfo.getIdentities();
            while (iter.hasNext()) {
                DiscoverInfo.Identity identity = iter.next();
                if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {
          return true;
        }
View Full Code Here

            DiscoverItems items = disco.discoverItems(connection.getServiceName());

            Iterator<DiscoverItems.Item> iter = items.getItems();
            while (iter.hasNext()) {
                DiscoverItems.Item item = iter.next();
                DiscoverInfo info = disco.discoverInfo(item.getEntityID());

                Iterator<DiscoverInfo.Identity> iter2 = info.getIdentities();
                while (iter2.hasNext()) {
                    DiscoverInfo.Identity identity = iter2.next();
                    if (identity.getCategory().equals("proxy") && identity.getType().equals("stun"))
                        if (info.containsFeature(NAMESPACE))
                            return true;
                }

                LOGGER.debug(item.getName()+"-"+info.getType());

            }
        }
        catch (XMPPException e) {
            e.printStackTrace();
View Full Code Here

        sdm1 = ServiceDiscoveryManager.getInstanceFor(con1);
        letsAllBeFriends();
    }
   
    public void testLocalEntityCaps() throws InterruptedException {
        DiscoverInfo info = EntityCapsManager.getDiscoveryInfoByNodeVer(ecm1.getLocalNodeVer());
        assertFalse(info.containsFeature(DISCOVER_TEST_FEATURE));

        dropWholeEntityCapsCache();

        // This should cause a new presence stanza from con1 with and updated
        // 'ver' String
        sdm1.addFeature(DISCOVER_TEST_FEATURE);

        // Give the server some time to handle the stanza and send it to con0
        Thread.sleep(2000);

        // The presence stanza should get received by con0 and the data should
        // be recorded in the map
        // Note that while both connections use the same static Entity Caps
        // cache,
        // it's assured that *not* con1 added the data to the Entity Caps cache.
        // Every time the entities features
        // and identities change only a new caps 'ver' is calculated and send
        // with the presence stanza
        // The other connection has to receive this stanza and record the
        // information in order for this test to succeed.
        info = EntityCapsManager.getDiscoveryInfoByNodeVer(ecm1.getLocalNodeVer());
        assertNotNull(info);
        assertTrue(info.containsFeature(DISCOVER_TEST_FEATURE));
    }
View Full Code Here

        // add a bogus feature so that con1 ver won't match con0's
        sdm1.addFeature(DISCOVER_TEST_FEATURE);

        dropCapsCache();
        // discover that
        DiscoverInfo info = sdm0.discoverInfo(con1.getUser());
        // that discovery should cause a disco#info
        assertTrue(discoInfoSend);
        assertTrue(info.containsFeature(DISCOVER_TEST_FEATURE));
        discoInfoSend = false;

        // discover that
        info = sdm0.discoverInfo(con1.getUser());
        // that discovery shouldn't cause a disco#info
        assertFalse(discoInfoSend);
        assertTrue(info.containsFeature(DISCOVER_TEST_FEATURE));
    }
View Full Code Here

        dropWholeEntityCapsCache();
        sdm1.addFeature(DISCOVER_TEST_FEATURE);

        Thread.sleep(3000);

        DiscoverInfo info = sdm0.discoverInfo(con1.getUser());
        assertTrue(info.containsFeature(DISCOVER_TEST_FEATURE));

        String u1ver = EntityCapsManager.getNodeVersionByJid(con1.getUser());
        assertNotNull(u1ver);

        DiscoverInfo entityInfo = EntityCapsManager.caps.get(u1ver);
        assertNotNull(entityInfo);

        assertEquals(info.toXML(), entityInfo.toXML());
    }
View Full Code Here

*/
public class EntityUseCases extends SingleUserTestCase
{
  public void testDiscoverPubsubInfo() throws Exception
  {
    DiscoverInfo supportedFeatures = getManager().getSupportedFeatures();
    assertNotNull(supportedFeatures);
  }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.packet.DiscoverInfo$Identity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.