Search in sources :

Example 1 with ConnectionManager

use of org.jivesoftware.openfire.ConnectionManager in project Openfire by igniterealtime.

the class ExternalComponentManager method setServiceEnabled.

/**
     * @deprecated Obtain and use the corresponding {@link org.jivesoftware.openfire.spi.ConnectionListener} instead.
     */
@Deprecated
public static void setServiceEnabled(boolean enabled) throws ModificationNotAllowedException {
    // Alert listeners about this event
    for (ExternalComponentManagerListener listener : listeners) {
        listener.serviceEnabled(enabled);
    }
    ConnectionManager connectionManager = XMPPServer.getInstance().getConnectionManager();
    connectionManager.enableComponentListener(enabled);
}
Also used : DbConnectionManager(org.jivesoftware.database.DbConnectionManager) ConnectionManager(org.jivesoftware.openfire.ConnectionManager)

Example 2 with ConnectionManager

use of org.jivesoftware.openfire.ConnectionManager in project Openfire by igniterealtime.

the class ExternalComponentManager method setServicePort.

/**
     * @deprecated Obtain and use the corresponding {@link org.jivesoftware.openfire.spi.ConnectionListener} instead.
     */
@Deprecated
public static void setServicePort(int port) throws ModificationNotAllowedException {
    // Alert listeners about this event
    for (ExternalComponentManagerListener listener : listeners) {
        listener.portChanged(port);
    }
    ConnectionManager connectionManager = XMPPServer.getInstance().getConnectionManager();
    connectionManager.setComponentListenerPort(port);
}
Also used : DbConnectionManager(org.jivesoftware.database.DbConnectionManager) ConnectionManager(org.jivesoftware.openfire.ConnectionManager)

Example 3 with ConnectionManager

use of org.jivesoftware.openfire.ConnectionManager in project Openfire by igniterealtime.

the class MulticastDNSService method start.

@Override
public void start() throws IllegalStateException {
    // If the service isn't enabled, return.
    if (!JiveGlobals.getBooleanProperty("multicastDNS.enabled", false)) {
        return;
    }
    TimerTask startService = new TimerTask() {

        @Override
        public void run() {
            int clientPortNum = -1;
            int componentPortNum = -1;
            final ConnectionManager connectionManager = XMPPServer.getInstance().getConnectionManager();
            if (connectionManager != null) {
                clientPortNum = connectionManager.getClientListenerPort();
                componentPortNum = connectionManager.getComponentListenerPort();
            }
            try {
                if (jmdns == null) {
                    jmdns = new JmDNS();
                }
                String serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
                if (clientPortNum != -1) {
                    ServiceInfo clientService = new ServiceInfo("_xmpp-client._tcp.local.", serverName + "._xmpp-client._tcp.local.", clientPortNum, "XMPP Server");
                    jmdns.registerService(clientService);
                }
                if (componentPortNum != -1) {
                    ServiceInfo componentService = new ServiceInfo("_xmpp-component._tcp.local.", serverName + "._xmpp-component._tcp.local.", componentPortNum, "XMPP Component Server");
                    jmdns.registerService(componentService);
                }
            } catch (IOException ioe) {
                Log.error(ioe.getMessage(), ioe);
            }
        }
    };
    // Schedule the task to run in 5 seconds, to give Wildire time to start the ports. 
    TaskEngine.getInstance().schedule(startService, 5000);
}
Also used : ServiceInfo(javax.jmdns.ServiceInfo) ConnectionManager(org.jivesoftware.openfire.ConnectionManager) JmDNS(javax.jmdns.JmDNS) TimerTask(java.util.TimerTask) IOException(java.io.IOException)

Aggregations

ConnectionManager (org.jivesoftware.openfire.ConnectionManager)3 DbConnectionManager (org.jivesoftware.database.DbConnectionManager)2 IOException (java.io.IOException)1 TimerTask (java.util.TimerTask)1 JmDNS (javax.jmdns.JmDNS)1 ServiceInfo (javax.jmdns.ServiceInfo)1