Search in sources :

Example 1 with ServerFeaturesProvider

use of org.jivesoftware.openfire.disco.ServerFeaturesProvider in project Openfire by igniterealtime.

the class AbstractXepSupport method start.

public void start() {
    for (IQHandler iqHandler : iqHandlers) {
        try {
            iqHandler.initialize(server);
            iqHandler.start();
        } catch (Exception e) {
            Log.error("Unable to initialize and start " + iqHandler.getClass());
            continue;
        }
        element2Handlers.put(iqHandler.getInfo().getName(), iqHandler);
        if (iqHandler instanceof ServerFeaturesProvider) {
            for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler).getFeatures(); i.hasNext(); ) {
                server.getIQDiscoInfoHandler().addServerFeature(i.next());
            }
        }
        if (muc) {
            MultiUserChatManager manager = server.getMultiUserChatManager();
            for (MultiUserChatService mucService : manager.getMultiUserChatServices()) {
                mucService.addIQHandler(iqHandler);
                mucService.addExtraFeature(namespace);
            }
        }
    }
    server.getIQDiscoInfoHandler().addServerFeature(namespace);
    server.getIQRouter().addHandler(iqDispatcher);
}
Also used : IQHandler(org.jivesoftware.openfire.handler.IQHandler) MultiUserChatManager(org.jivesoftware.openfire.muc.MultiUserChatManager) MultiUserChatService(org.jivesoftware.openfire.muc.MultiUserChatService) ServerFeaturesProvider(org.jivesoftware.openfire.disco.ServerFeaturesProvider) UnauthorizedException(org.jivesoftware.openfire.auth.UnauthorizedException)

Example 2 with ServerFeaturesProvider

use of org.jivesoftware.openfire.disco.ServerFeaturesProvider in project Openfire by igniterealtime.

the class AbstractXepSupport method stop.

public void stop() {
    IQRouter iqRouter = server.getIQRouter();
    IQDiscoInfoHandler iqDiscoInfoHandler = server.getIQDiscoInfoHandler();
    for (IQHandler iqHandler : iqHandlers) {
        element2Handlers.remove(iqHandler.getInfo().getName());
        try {
            iqHandler.stop();
            iqHandler.destroy();
        } catch (Exception e) {
            Log.warn("Unable to stop and destroy " + iqHandler.getClass());
        }
        if (iqHandler instanceof ServerFeaturesProvider) {
            for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler).getFeatures(); i.hasNext(); ) {
                if (iqDiscoInfoHandler != null) {
                    iqDiscoInfoHandler.removeServerFeature(i.next());
                }
            }
        }
        if (muc) {
            MultiUserChatManager manager = server.getMultiUserChatManager();
            for (MultiUserChatService mucService : manager.getMultiUserChatServices()) {
                mucService.removeIQHandler(iqHandler);
                mucService.removeExtraFeature(namespace);
            }
        }
    }
    if (iqRouter != null) {
        iqRouter.removeHandler(iqDispatcher);
    }
}
Also used : IQDiscoInfoHandler(org.jivesoftware.openfire.disco.IQDiscoInfoHandler) IQHandler(org.jivesoftware.openfire.handler.IQHandler) MultiUserChatManager(org.jivesoftware.openfire.muc.MultiUserChatManager) MultiUserChatService(org.jivesoftware.openfire.muc.MultiUserChatService) ServerFeaturesProvider(org.jivesoftware.openfire.disco.ServerFeaturesProvider) IQRouter(org.jivesoftware.openfire.IQRouter) UnauthorizedException(org.jivesoftware.openfire.auth.UnauthorizedException)

Aggregations

UnauthorizedException (org.jivesoftware.openfire.auth.UnauthorizedException)2 ServerFeaturesProvider (org.jivesoftware.openfire.disco.ServerFeaturesProvider)2 IQHandler (org.jivesoftware.openfire.handler.IQHandler)2 MultiUserChatManager (org.jivesoftware.openfire.muc.MultiUserChatManager)2 MultiUserChatService (org.jivesoftware.openfire.muc.MultiUserChatService)2 IQRouter (org.jivesoftware.openfire.IQRouter)1 IQDiscoInfoHandler (org.jivesoftware.openfire.disco.IQDiscoInfoHandler)1