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

The following examples show how to use org.jivesoftware.openfire.XMPPServer#getPacketRouter() . 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: 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 2
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 3
Source File: IQRosterHandler.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;
    userManager = server.getUserManager();
    router = server.getPacketRouter();
}
 
Example 4
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 5
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 6
Source File: PEPService.java    From Openfire with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a PEPService.
 * 
 * @param server  the XMPP server.
 * @param bareJID the bare JID (service ID) of the user owning the service.
 */
public PEPService(XMPPServer server, JID bareJID) {
    this.serviceOwner = bareJID.asBareJID();
    router = server.getPacketRouter();

    // Initialize the ad-hoc commands manager to use for this pep service
    adHocCommandManager = new AdHocCommandManager();
    adHocCommandManager.addCommand(new PendingSubscriptionsCommand(this));

    // 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.presence);
        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.presence);
        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);
    }
}