Java Code Examples for org.jivesoftware.openfire.XMPPServer#getRoutingTable()

The following examples show how to use org.jivesoftware.openfire.XMPPServer#getRoutingTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PresenceUpdateHandler.java    From Openfire with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    localServer = server;
    rosterManager = server.getRosterManager();
    presenceManager = server.getPresenceManager();
    deliverer = server.getPacketDeliverer();
    messageStore = server.getOfflineMessageStore();
    sessionManager = server.getSessionManager();
    userManager = server.getUserManager();
    routingTable = server.getRoutingTable();
    directedPresencesCache = CacheFactory.createCache(PRESENCE_CACHE_NAME);
    // TODO Add as route listener (to remove direct presences info for removed routes). Mainly for c2s sessions which is uncommon.
    // Listen to cluster events
    ClusterManager.addListener(this);
}
 
Example 2
Source File: MediaProxyService.java    From Openfire with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);

    sessionManager = server.getSessionManager();
    // In some cases, the domain name of the server may not be the actual address of the machine
    // (ie, when using DNS SRV records). In that case, the "mediaproxy.externalip" property should be
    // set to the IP address of the actual server where the media proxy is listening.
    String ipAddress = JiveGlobals.getProperty("mediaproxy.externalip", server.getServerInfo().getXMPPDomain());
    mediaProxy = new MediaProxy(ipAddress);

    String defaultName = "rtpbridge";
    serviceName = JiveGlobals.getProperty("mediaproxy.serviceName", defaultName);
    serviceName = serviceName.equals("") ? defaultName : serviceName;

    echoPort = JiveGlobals.getIntProperty("mediaproxy.echoPort", echoPort);

    routingTable = server.getRoutingTable();
    router = server.getPacketRouter();

    initMediaProxy();
}
 
Example 3
Source File: MultiUserChatServiceImpl.java    From Openfire with Apache License 2.0 5 votes vote down vote up
public void initialize(final XMPPServer server) {
    initializeSettings();

    routingTable = server.getRoutingTable();
    router = server.getPacketRouter();
    // Configure the handler of iq:register packets
    registerHandler = new IQMUCRegisterHandler(this);
    // Configure the handlers of search requests
    searchHandler = new IQMUCSearchHandler(this);
    muclumbusSearchHandler = new IQMuclumbusSearchHandler(this);
    mucVCardHandler = new IQMUCvCardHandler(this);
}
 
Example 4
Source File: PacketCopier.java    From Openfire with Apache License 2.0 5 votes vote down vote up
private PacketCopier() {
    // Add the new instance as a listener of component events. We need to react when
    // a component is no longer valid
    InternalComponentManager.getInstance().addListener(this);
    XMPPServer server = XMPPServer.getInstance();
    serverName = server.getServerInfo().getXMPPDomain();
    routingTable = server.getRoutingTable();

    // Add new instance to the PacketInterceptors list
    InterceptorManager.getInstance().addInterceptor(this);

    // Create a new task and schedule it with the new timeout
    packetsTask = new ProcessPacketsTask();
    TaskEngine.getInstance().schedule(packetsTask, 5000, 5000);
}
 
Example 5
Source File: IQOfflineMessagesHandler.java    From Openfire with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    infoHandler = server.getIQDiscoInfoHandler();
    itemsHandler = server.getIQDiscoItemsHandler();
    messageStore = server.getOfflineMessageStore();
    userManager = server.getUserManager();
    routingTable = server.getRoutingTable();
}
 
Example 6
Source File: PresenceSubscribeHandler.java    From Openfire with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    localServer = server;
    serverName = server.getServerInfo().getXMPPDomain();
    routingTable = server.getRoutingTable();
    deliverer = server.getPacketDeliverer();
    presenceManager = server.getPresenceManager();
    rosterManager = server.getRosterManager();
    userManager = server.getUserManager();
}
 
Example 7
Source File: FileTransferProxy.java    From Openfire with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize( XMPPServer server )
{
    super.initialize(server);

    proxyServiceName = JiveGlobals.getProperty("xmpp.proxy.service", "proxy");
    routingTable = server.getRoutingTable();
    router = server.getPacketRouter();

    connectionManager = new ProxyConnectionManager(getFileTransferManager(server));
}
 
Example 8
Source File: PubSubModule.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
    public void initialize(XMPPServer server) {
        super.initialize(server);
        
        JiveGlobals.migrateProperty("xmpp.pubsub.enabled");
        JiveGlobals.migrateProperty("xmpp.pubsub.service");
        JiveGlobals.migrateProperty("xmpp.pubsub.root.nodeID");
        JiveGlobals.migrateProperty("xmpp.pubsub.root.creator");
        JiveGlobals.migrateProperty("xmpp.pubsub.multiple-subscriptions");

        // Listen to property events so that the template is always up to date
        PropertyEventDispatcher.addListener(this);

        setIQDiscoItemsHandler(XMPPServer.getInstance().getIQDiscoItemsHandler());
        setIQDiscoInfoHandler(XMPPServer.getInstance().getIQDiscoInfoHandler());
        serviceEnabled = JiveGlobals.getBooleanProperty("xmpp.pubsub.enabled", true);
        serviceName = JiveGlobals.getProperty("xmpp.pubsub.service");
        if (serviceName == null) {
            serviceName = "pubsub";
        }
        multipleSubscriptionsEnabled = JiveGlobals.getBooleanProperty("xmpp.pubsub.multiple-subscriptions", true);

        routingTable = server.getRoutingTable();
        router = server.getPacketRouter();

        engine = new PubSubEngine(router);

        // Load default configuration for leaf nodes
        leafDefaultConfiguration = PubSubPersistenceProviderManager.getInstance().getProvider().loadDefaultConfiguration(this.getUniqueIdentifier(), true);
        if (leafDefaultConfiguration == null) {
            // Create and save default configuration for leaf nodes;
            leafDefaultConfiguration = new DefaultNodeConfiguration(true);
            leafDefaultConfiguration.setAccessModel(AccessModel.open);
            leafDefaultConfiguration.setPublisherModel(PublisherModel.publishers);
            leafDefaultConfiguration.setDeliverPayloads(true);
            leafDefaultConfiguration.setLanguage("English");
            leafDefaultConfiguration.setMaxPayloadSize(5120);
            leafDefaultConfiguration.setNotifyConfigChanges(true);
            leafDefaultConfiguration.setNotifyDelete(true);
            leafDefaultConfiguration.setNotifyRetract(true);
            leafDefaultConfiguration.setPersistPublishedItems(false);
            leafDefaultConfiguration.setMaxPublishedItems(1);
            leafDefaultConfiguration.setPresenceBasedDelivery(false);
            leafDefaultConfiguration.setSendItemSubscribe(true);
            leafDefaultConfiguration.setSubscriptionEnabled(true);
            leafDefaultConfiguration.setReplyPolicy(null);
            PubSubPersistenceProviderManager.getInstance().getProvider().createDefaultConfiguration(this.getUniqueIdentifier(), leafDefaultConfiguration);
        }
        // Load default configuration for collection nodes
        collectionDefaultConfiguration =
                PubSubPersistenceProviderManager.getInstance().getProvider().loadDefaultConfiguration(this.getUniqueIdentifier(), false);
        if (collectionDefaultConfiguration == null ) {
            // Create and save default configuration for collection nodes;
            collectionDefaultConfiguration = new DefaultNodeConfiguration(false);
            collectionDefaultConfiguration.setAccessModel(AccessModel.open);
            collectionDefaultConfiguration.setPublisherModel(PublisherModel.publishers);
            collectionDefaultConfiguration.setDeliverPayloads(false);
            collectionDefaultConfiguration.setLanguage("English");
            collectionDefaultConfiguration.setNotifyConfigChanges(true);
            collectionDefaultConfiguration.setNotifyDelete(true);
            collectionDefaultConfiguration.setNotifyRetract(true);
            collectionDefaultConfiguration.setPresenceBasedDelivery(false);
            collectionDefaultConfiguration.setSubscriptionEnabled(true);
            collectionDefaultConfiguration.setReplyPolicy(null);
            collectionDefaultConfiguration
                    .setAssociationPolicy(CollectionNode.LeafNodeAssociationPolicy.all);
            collectionDefaultConfiguration.setMaxLeafNodes(-1);
            PubSubPersistenceProviderManager.getInstance().getProvider().createDefaultConfiguration(this.getUniqueIdentifier(), collectionDefaultConfiguration);
        }

        // Load nodes to memory
        PubSubPersistenceProviderManager.getInstance().getProvider().loadNodes(this);
        // Ensure that we have a root collection node
        String rootNodeID = JiveGlobals.getProperty("xmpp.pubsub.root.nodeID", "");
        if (nodes.isEmpty()) {
            // Create root collection node
            String creator = JiveGlobals.getProperty("xmpp.pubsub.root.creator");
//            JID creatorJID = creator != null ? new JID(creator) : server.getAdmins().iterator().next();
            JID creatorJID = creator != null ? new JID(creator) : new JID(server.getServerInfo().getXMPPDomain());
            rootCollectionNode = new CollectionNode(this.getUniqueIdentifier(), null, rootNodeID, creatorJID, collectionDefaultConfiguration);
            // Add the creator as the node owner
            rootCollectionNode.addOwner(creatorJID);
            // Save new root node
            rootCollectionNode.saveToDB();
        }
        else {
            rootCollectionNode = (CollectionNode) getNode(rootNodeID);
        }
    }
 
Example 9
Source File: IQBindHandler.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    routingTable = server.getRoutingTable();
    serverName = server.getServerInfo().getXMPPDomain();
 }