Search in sources :

Example 1 with XMPPServer

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

the class ArchiveManagerImpl method archiveMessage.

public void archiveMessage(Session session, Message message, boolean incoming) {
    final XMPPServer server = XMPPServer.getInstance();
    final ArchivedMessage.Direction direction;
    final ArchivedMessage archivedMessage;
    final Conversation conversation;
    final JID ownerJid;
    final JID withJid;
    // TODO support groupchat
    if (message.getType() != Message.Type.chat && message.getType() != Message.Type.normal) {
        return;
    }
    if (server.isLocal(message.getFrom()) && incoming) {
        ownerJid = message.getFrom();
        withJid = message.getTo();
        // sent by the owner => to
        direction = ArchivedMessage.Direction.to;
    } else if (server.isLocal(message.getTo()) && !incoming) {
        ownerJid = message.getTo();
        withJid = message.getFrom();
        // received by the owner => from
        direction = ArchivedMessage.Direction.from;
    } else {
        return;
    }
    archivedMessage = ArchiveFactory.createArchivedMessage(session, message, direction, withJid);
    if (archivedMessage.isEmpty()) {
        return;
    }
    conversation = determineConversation(ownerJid, withJid, message.getSubject(), message.getThread(), archivedMessage);
    archivedMessage.setConversation(conversation);
    persistenceManager.createMessage(archivedMessage);
    if (indexManager != null) {
        indexManager.indexObject(archivedMessage);
    }
}
Also used : XMPPServer(org.jivesoftware.openfire.XMPPServer) JID(org.xmpp.packet.JID) ArchivedMessage(com.reucon.openfire.plugin.archive.model.ArchivedMessage) Conversation(com.reucon.openfire.plugin.archive.model.Conversation)

Example 2 with XMPPServer

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

the class RayoComponent method doStop.

public void doStop() {
    Log.info("RayoComponent shutdown ");
    XMPPServer server = XMPPServer.getInstance();
    server.getIQDiscoInfoHandler().removeServerFeature(RAYO_CORE);
    server.getIQDiscoInfoHandler().removeServerFeature(RAYO_RECORD);
    server.getIQDiscoInfoHandler().removeServerFeature(RAYO_SAY);
    server.getIQDiscoInfoHandler().removeServerFeature(RAYO_HANDSET);
    destroyIQHandlers();
    Log.info("jCumulus stopping...");
    channel.close();
    bootstrap.releaseExternalResources();
}
Also used : XMPPServer(org.jivesoftware.openfire.XMPPServer)

Example 3 with XMPPServer

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

the class RayoComponent method destroyIQHandlers.

private void destroyIQHandlers() {
    XMPPServer server = XMPPServer.getInstance();
    if (onHookIQHandler != null) {
        server.getIQRouter().removeHandler(onHookIQHandler);
        onHookIQHandler = null;
    }
    if (offHookIQHandler != null) {
        server.getIQRouter().removeHandler(offHookIQHandler);
        offHookIQHandler = null;
    }
    if (privateIQHandler != null) {
        server.getIQRouter().removeHandler(privateIQHandler);
        privateIQHandler = null;
    }
    if (publicIQHandler != null) {
        server.getIQRouter().removeHandler(publicIQHandler);
        publicIQHandler = null;
    }
    if (muteIQHandler != null) {
        server.getIQRouter().removeHandler(muteIQHandler);
        muteIQHandler = null;
    }
    if (unmuteIQHandler != null) {
        server.getIQRouter().removeHandler(unmuteIQHandler);
        unmuteIQHandler = null;
    }
    if (holdIQHandler != null) {
        server.getIQRouter().removeHandler(holdIQHandler);
        holdIQHandler = null;
    }
    if (sayIQHandler != null) {
        server.getIQRouter().removeHandler(sayIQHandler);
        sayIQHandler = null;
    }
    if (pauseSayIQHandler != null) {
        server.getIQRouter().removeHandler(pauseSayIQHandler);
        pauseSayIQHandler = null;
    }
    if (resumeSayIQHandler != null) {
        server.getIQRouter().removeHandler(resumeSayIQHandler);
        resumeSayIQHandler = null;
    }
    if (acceptIQHandler != null) {
        server.getIQRouter().removeHandler(acceptIQHandler);
        acceptIQHandler = null;
    }
    if (answerIQHandler != null) {
        server.getIQRouter().removeHandler(answerIQHandler);
        answerIQHandler = null;
    }
    if (dialIQHandler != null) {
        server.getIQRouter().removeHandler(dialIQHandler);
        dialIQHandler = null;
    }
    if (hangupIQHandler != null) {
        server.getIQRouter().removeHandler(hangupIQHandler);
        hangupIQHandler = null;
    }
    if (redirectIQHandler != null) {
        server.getIQRouter().removeHandler(redirectIQHandler);
        redirectIQHandler = null;
    }
    if (dtmfIQHandler != null) {
        server.getIQRouter().removeHandler(dtmfIQHandler);
        dtmfIQHandler = null;
    }
}
Also used : XMPPServer(org.jivesoftware.openfire.XMPPServer)

Example 4 with XMPPServer

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

the class RayoComponent method doStart.

public void doStart() {
    Log.info("RayoComponent initialize " + jid);
    XMPPServer server = XMPPServer.getInstance();
    server.getIQDiscoInfoHandler().addServerFeature(RAYO_CORE);
    rayoProvider = new RayoProvider();
    rayoProvider.setValidator(new Validator());
    server.getIQDiscoInfoHandler().addServerFeature(RAYO_RECORD);
    recordProvider = new RecordProvider();
    recordProvider.setValidator(new Validator());
    server.getIQDiscoInfoHandler().addServerFeature(RAYO_SAY);
    sayProvider = new SayProvider();
    sayProvider.setValidator(new Validator());
    server.getIQDiscoInfoHandler().addServerFeature(RAYO_HANDSET);
    handsetProvider = new HandsetProvider();
    handsetProvider.setValidator(new Validator());
    createIQHandlers();
    try {
        Log.info("Starting jCumulus.....");
        sessions = new Sessions();
        ExecutorService executorservice = Executors.newCachedThreadPool();
        NioDatagramChannelFactory niodatagramchannelfactory = new NioDatagramChannelFactory(executorservice);
        bootstrap = new ConnectionlessBootstrap(niodatagramchannelfactory);
        OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = new OrderedMemoryAwareThreadPoolExecutor(10, 0x100000L, 0x40000000L, 100L, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory());
        bootstrap.setPipelineFactory(new ServerPipelineFactory(sessions, orderedmemoryawarethreadpoolexecutor));
        bootstrap.setOption("reuseAddress", Boolean.valueOf(true));
        bootstrap.setOption("sendBufferSize", Integer.valueOf(1215));
        bootstrap.setOption("receiveBufferSize", Integer.valueOf(2048));
        bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(2048));
        InetSocketAddress inetsocketaddress = new InetSocketAddress(JiveGlobals.getIntProperty("voicebridge.rtmfp.port", 1935));
        Log.info("Listening on " + inetsocketaddress.getPort() + " port");
        channel = bootstrap.bind(inetsocketaddress);
    } catch (Exception e) {
        Log.error("jCumulus startup failure");
        e.printStackTrace();
    }
}
Also used : Sessions(com.jcumulus.server.rtmfp.Sessions) ComponentException(org.xmpp.component.ComponentException) UnauthorizedException(org.jivesoftware.openfire.auth.UnauthorizedException) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) ParseException(java.text.ParseException) ServerPipelineFactory(com.jcumulus.server.rtmfp.ServerPipelineFactory) XMPPServer(org.jivesoftware.openfire.XMPPServer) NioDatagramChannelFactory(org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory) OrderedMemoryAwareThreadPoolExecutor(org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor) FixedReceiveBufferSizePredictorFactory(org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory) ConnectionlessBootstrap(org.jboss.netty.bootstrap.ConnectionlessBootstrap)

Example 5 with XMPPServer

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

the class STUNService method stopSTUNService.

private void stopSTUNService() {
    XMPPServer server = XMPPServer.getInstance();
    server.getIQDiscoInfoHandler().removeServerFeature(NAMESPACE);
    if (stunIQHandler != null) {
        server.getIQRouter().removeHandler(stunIQHandler);
        stunIQHandler = null;
    }
}
Also used : XMPPServer(org.jivesoftware.openfire.XMPPServer)

Aggregations

XMPPServer (org.jivesoftware.openfire.XMPPServer)27 JID (org.xmpp.packet.JID)11 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)8 GroupNotFoundException (org.jivesoftware.openfire.group.GroupNotFoundException)5 NamingException (javax.naming.NamingException)3 LdapName (javax.naming.ldap.LdapName)3 Group (org.jivesoftware.openfire.group.Group)3 User (org.jivesoftware.openfire.user.User)3 Presence (org.xmpp.packet.Presence)3 PrintWriter (java.io.PrintWriter)2 Locale (java.util.Locale)2 TreeSet (java.util.TreeSet)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 NamingEnumeration (javax.naming.NamingEnumeration)2 Attribute (javax.naming.directory.Attribute)2 Attributes (javax.naming.directory.Attributes)2 SearchControls (javax.naming.directory.SearchControls)2 SearchResult (javax.naming.directory.SearchResult)2 Plugin (org.jivesoftware.openfire.container.Plugin)2