Examples of ServiceDiscoveryManager


Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * to see if the email service has been configured and is available.
     *
     * @return true if the email service is available, otherwise return false.
     */
    public boolean isEmailAvailable() {
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);

        try {
            String workgroupService = StringUtils.parseServer(workgroupJID);
            DiscoverInfo infoResult = discoManager.discoverInfo(workgroupService);
            return infoResult.containsFeature("jive:email:provider");
        }
        catch (XMPPException e) {
            return false;
        }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @return a Collection of search services found on the server.
     * @throws XMPPException thrown if a server error has occurred.
     */
    public Collection getSearchServices() throws XMPPException {
        final List<String> searchServices = new ArrayList<String>();
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con);
        DiscoverItems items = discoManager.discoverItems(con.getServiceName());
        Iterator<DiscoverItems.Item> iter = items.getItems();
        while (iter.hasNext()) {
            DiscoverItems.Item item = iter.next();
            try {
                DiscoverInfo info;
                try {
                    info = discoManager.discoverInfo(item.getEntityID());
                }
                catch (XMPPException e) {
                    // Ignore Case
                    continue;
                }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @param connection The connection on which to enable or disable the services.
     * @param isEnabled  True to enable, false to disable.
     */
    public static void setServiceEnabled(final XMPPConnection connection,
            final boolean isEnabled) {
        ServiceDiscoveryManager manager = ServiceDiscoveryManager
                .getInstanceFor(connection);
        for (String ns : NAMESPACE) {
            if (isEnabled) {
                manager.addFeature(ns);
            }
            else {
                manager.removeFeature(ns);
            }
        }
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

        return null;
    }

    private void initProxies() {
        proxies = new ArrayList<String>();
        ServiceDiscoveryManager manager = ServiceDiscoveryManager
                .getInstanceFor(connection);
        try {
            DiscoverItems discoItems = manager.discoverItems(connection.getServiceName());
            Iterator it = discoItems.getItems();
            while (it.hasNext()) {
                DiscoverItems.Item item = (DiscoverItems.Item) it.next();
                String proxy = checkIsProxy(manager, item);
                if (proxy != null) {
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @return a collection with the XMPP addresses of the Multi-User Chat services.
     * @throws XMPPException if an error occured while trying to discover MUC services.
     */
    public static Collection<String> getServiceNames(XMPPConnection connection) throws XMPPException {
        final List<String> answer = new ArrayList<String>();
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
        DiscoverItems items = discoManager.discoverItems(connection.getServiceName());
        for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
            DiscoverItems.Item item = it.next();
            try {
                DiscoverInfo info = discoManager.discoverInfo(item.getEntityID());
                if (info.containsFeature("http://jabber.org/protocol/muc")) {
                    answer.add(item.getEntityID());
                }
            }
            catch (XMPPException e) {
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @throws XMPPException if an error occured while trying to discover the information.
     */
    public static Collection<HostedRoom> getHostedRooms(XMPPConnection connection, String serviceName)
            throws XMPPException {
        List<HostedRoom> answer = new ArrayList<HostedRoom>();
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
        DiscoverItems items = discoManager.discoverItems(serviceName);
        for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
            answer.add(new HostedRoom(it.next()));
        }
        return answer;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

        return null;
    }

    private void initProxies() {
        proxies = new ArrayList<String>();
        ServiceDiscoveryManager manager = ServiceDiscoveryManager
                .getInstanceFor(connection);
        try {
            DiscoverItems discoItems = manager.discoverItems(connection.getServiceName());
            Iterator it = discoItems.getItems();
            while (it.hasNext()) {
                DiscoverItems.Item item = (Item) it.next();
                String proxy = checkIsProxy(manager, item);
                if(proxy != null) {
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @param connection The connection on which to enable or disable the services.
     * @param isEnabled  True to enable, false to disable.
     */
    public static void setServiceEnabled(final XMPPConnection connection,
            final boolean isEnabled) {
        ServiceDiscoveryManager manager = ServiceDiscoveryManager
                .getInstanceFor(connection);
        for (int i = 0; i < NAMESPACE.length; i++) {
            if (isEnabled) {
                manager.addFeature(NAMESPACE[i]);
            }
            else {
                manager.removeFeature(NAMESPACE[i]);
            }
        }
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @return a collection with the XMPP addresses of the Multi-User Chat services.
     * @throws XMPPException if an error occured while trying to discover MUC services.
     */
    public static Collection<String> getServiceNames(XMPPConnection connection) throws XMPPException {
        final List<String> answer = new ArrayList<String>();
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
        DiscoverItems items = discoManager.discoverItems(connection.getServiceName());
        for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
            DiscoverItems.Item item = it.next();
            try {
                DiscoverInfo info = discoManager.discoverInfo(item.getEntityID());
                if (info.containsFeature("http://jabber.org/protocol/muc")) {
                    answer.add(item.getEntityID());
                }
            }
            catch (XMPPException e) {
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @throws XMPPException if an error occured while trying to discover the information.
     */
    public static Collection<HostedRoom> getHostedRooms(XMPPConnection connection, String serviceName)
            throws XMPPException {
        List<HostedRoom> answer = new ArrayList<HostedRoom>();
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
        DiscoverItems items = discoManager.discoverItems(serviceName);
        for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
            answer.add(new HostedRoom(it.next()));
        }
        return answer;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.