• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SessionEventDispatcher类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.jivesoftware.openfire.event.SessionEventDispatcher的典型用法代码示例。如果您正苦于以下问题:Java SessionEventDispatcher类的具体用法?Java SessionEventDispatcher怎么用?Java SessionEventDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SessionEventDispatcher类属于org.jivesoftware.openfire.event包,在下文中一共展示了SessionEventDispatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addSession

点赞 3

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
/**
 * Add a new session to be managed. The session has been authenticated and resource
 * binding has been done.
 *
 * @param session the session that was authenticated.
 */
public void addSession(LocalClientSession session) {
    // Add session to the routing table (routing table will know session is not available yet)
    routingTable.addClientRoute(session.getAddress(), session);
    // Remove the pre-Authenticated session but remember to use the temporary ID as the key
    localSessionManager.getPreAuthenticatedSessions().remove(session.getStreamID().toString());
    SessionEventDispatcher.EventType event = session.getAuthToken().isAnonymous() ?
            SessionEventDispatcher.EventType.anonymous_session_created :
            SessionEventDispatcher.EventType.session_created;
    // Fire session created event.
    SessionEventDispatcher.dispatchEvent(session, event);
    if (ClusterManager.isClusteringStarted()) {
        // Track information about the session and share it with other cluster nodes
        sessionInfoCache.put(session.getAddress().toString(), new ClientSessionInfo(session));
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:22,
代码来源:SessionManager.java

示例2: start

点赞 3

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
/**
 * Handles startup of the transport.
 */
public void start() {
    RosterEventDispatcher.addListener(this);
    UserEventDispatcher.addListener(this);
    SessionEventDispatcher.addListener(this);
    VCardEventDispatcher.addListener(this);
    InterceptorManager.getInstance().addInterceptor(this);
    if (!JiveGlobals.getBooleanProperty("plugin.gateway.tweak.noprobeonstart", false)) {
        // Probe all registered users [if they are logged in] to auto-log them in
        // TODO: Do we need to account for local vs other node sessions?
        for (ClientSession session : SessionManager.getInstance().getSessions()) {
            try {
                JID jid = XMPPServer.getInstance().createJID(session.getUsername(), null);
                if (RegistrationManager.getInstance().isRegistered(jid, getType())) {
                    Presence p = new Presence(Presence.Type.probe);
                    p.setFrom(this.getJID());
                    p.setTo(jid);
                    sendPacket(p);
                }
            }
            catch (UserNotFoundException e) {
                // Not a valid user for the gateway then
            }
        }
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:29,
代码来源:BaseTransport.java

示例3: initializePlugin

点赞 3

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    componentManager = ComponentManagerFactory.getComponentManager();
    component = new RayoComponent(this);
    try {
        componentManager.addComponent(serviceName, component);
        bridge.appStart(pluginDirectory);
        checkNatives(pluginDirectory);
        checkRecordingFolder(pluginDirectory);
        SessionEventDispatcher.addListener(this);
    } catch (ComponentException e) {
        Log.error("Could NOT load " + component.getName());
    }
    setup();

    component.doStart();
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:17,
代码来源:RayoPlugin.java

示例4: addSession

点赞 3

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
/**
 * Add a new session to be managed. The session has been authenticated and resource
 * binding has been done.
 *
 * @param session the session that was authenticated.
 */
public void addSession(LocalClientSession session) {
    // Remove the pre-Authenticated session but remember to use the temporary ID as the key
    localSessionManager.getPreAuthenticatedSessions().remove(session.getStreamID().toString());
    // Add session to the routing table (routing table will know session is not available yet)
    routingTable.addClientRoute(session.getAddress(), session);
    SessionEventDispatcher.EventType event = session.getAuthToken().isAnonymous() ?
            SessionEventDispatcher.EventType.anonymous_session_created :
            SessionEventDispatcher.EventType.session_created;
    // Fire session created event.
    SessionEventDispatcher.dispatchEvent(session, event);
    if (ClusterManager.isClusteringStarted()) {
        // Track information about the session and share it with other cluster nodes
        sessionInfoCache.put(session.getAddress().toString(), new ClientSessionInfo(session));
    }
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:22,
代码来源:SessionManager.java

示例5: initializePlugin

点赞 3

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    componentManager = ComponentManagerFactory.getComponentManager();
    component = new RayoComponent(this);
    try {
        componentManager.addComponent(serviceName, component);
    	bridge.appStart(pluginDirectory);
    	checkNatives(pluginDirectory);
    	checkRecordingFolder(pluginDirectory);
    	SessionEventDispatcher.addListener(this);
    } catch (ComponentException e) {
        Log.error("Could NOT load " + component.getName());
    }
    setup();

    component.doStart();
}
 

开发者ID:idwanglu2010,
项目名称:openfire,
代码行数:17,
代码来源:RayoPlugin.java

示例6: shutdown

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
/**
 * Handles shutdown of the transport.
 *
 * Cleans up all active sessions.
 */
public void shutdown() {
    InterceptorManager.getInstance().removeInterceptor(this);
    VCardEventDispatcher.removeListener(this);
    SessionEventDispatcher.removeListener(this);
    RosterEventDispatcher.removeListener(this);
    UserEventDispatcher.removeListener(this);
    // Disconnect everyone's session
    for (TransportSession<B> session : sessionManager.getSessions()) {
        registrationLoggedOut(session);
        session.removeAllResources();
    }
    sessionManager.shutdown();
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:19,
代码来源:BaseTransport.java

示例7: initializePlugin

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory)
{
    int historyDays = JiveGlobals.getIntProperty(HISTORY_DAYS_PROPERTY, DEFAULT_HISTORY_DAYS);
    PropertyEventDispatcher.addListener(this);

    persistenceManagers = new ArrayList<PersistenceManager>();
    persistenceManagers.add(new DefaultPersistenceManager());

    try
    {
        Class.forName("com.reucon.openfire.phpbb3.PhpBB3AuthProvider");
        persistenceManagers.add(new PhpBB3PersistenceManager());
    }
    catch (ClassNotFoundException e)
    {
        // ignore
    }

    setAllOffline();
    setHistoryDays(historyDays);

    for (ClientSession session : SessionManager.getInstance().getSessions())
    {
        sessionCreated(session);
    }

    SessionEventDispatcher.addListener(this);
    PresenceEventDispatcher.addListener(this);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:30,
代码来源:UserStatusPlugin.java

示例8: shutdown

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
/**
 * Remove any resources SparkManager was using. This will allow
 * for a clean reload.
 */
public void shutdown() {
    // Cleanup
    SessionEventDispatcher.removeListener(sessionEventListener);

    if (statisticsManager != null) {
        statisticsManager.removeStatistic(SPARK_CLIENTS_KEY);
        statisticsManager.removeStatistic(INVALID_DISCONNECTS_KEY);
    }

    componentManager = null;
    sessionManager = null;
    sessionEventListener = null;
    statisticsManager = null;
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:19,
代码来源:SparkManager.java

示例9: destroyPlugin

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void destroyPlugin() {
   SessionEventDispatcher.removeListener(listener);

   listener = null;
   serverAddress = null;
   router = null;
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:8,
代码来源:MotDPlugin.java

示例10: destroyPlugin

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void destroyPlugin() {
    try {
        componentManager.removeComponent(serviceName);
        bridge.appStop();
        SessionEventDispatcher.removeListener(this);
    } catch (ComponentException e) {
        Log.error("Could NOT Remove " + serviceName + " Component");
    }
    closeAllChannels();
    executor.shutdownNow();
    component.doStop();
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:13,
代码来源:RayoPlugin.java

示例11: SipComponent

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public SipComponent() {
    this.componentManager = ComponentManagerFactory.getComponentManager();
    SessionEventDispatcher.addListener(this);
}
 

开发者ID:igniterealtime,
项目名称:ofmeet-openfire-plugin,
代码行数:5,
代码来源:SipComponent.java

示例12: shutdown

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void shutdown() {
    SessionEventDispatcher.removeListener(this);
}
 

开发者ID:igniterealtime,
项目名称:ofmeet-openfire-plugin,
代码行数:4,
代码来源:SipComponent.java

示例13: removeSession

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
/**
 * Removes a session.
 *
 * @param session the session or null when session is derived from fullJID.
 * @param fullJID the address of the session.
 * @param anonymous true if the authenticated user is anonymous.
 * @param forceUnavailable true if an unavailable presence must be created and routed.
 * @return true if the requested session was successfully removed.
 */
public boolean removeSession(ClientSession session, JID fullJID, boolean anonymous, boolean forceUnavailable) {
    // Do nothing if server is shutting down. Note: When the server
    // is shutting down the serverName will be null.
    if (serverName == null) {
        return false;
    }

    if (session == null) {
        session = getSession(fullJID);
    }

    // Remove route to the removed session (anonymous or not)
    boolean removed = routingTable.removeClientRoute(fullJID);

    if (removed) {
        // Fire session event.
        if (anonymous) {
            SessionEventDispatcher
                    .dispatchEvent(session, SessionEventDispatcher.EventType.anonymous_session_destroyed);
        }
        else {
            SessionEventDispatcher.dispatchEvent(session, SessionEventDispatcher.EventType.session_destroyed);

        }
    }

    // Remove the session from the pre-Authenticated sessions list (if present)
    boolean preauth_removed =
            localSessionManager.getPreAuthenticatedSessions().remove(fullJID.getResource()) != null;
    // If the user is still available then send an unavailable presence
    if (forceUnavailable || session.getPresence().isAvailable()) {
        Presence offline = new Presence();
        offline.setFrom(fullJID);
        offline.setTo(new JID(null, serverName, null, true));
        offline.setType(Presence.Type.unavailable);
        router.route(offline);
    }

    // Stop tracking information about the session and share it with other cluster nodes
    sessionInfoCache.remove(fullJID.toString());

    if (removed || preauth_removed) {
        // Decrement the counter of user sessions
        connectionsCounter.decrementAndGet();
        return true;
    }
    return false;
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:58,
代码来源:SessionManager.java

示例14: destroyPlugin

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void destroyPlugin()
{
    PresenceEventDispatcher.removeListener(this);
    SessionEventDispatcher.removeListener(this);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:6,
代码来源:UserStatusPlugin.java

示例15: initializePlugin

点赞 2

import org.jivesoftware.openfire.event.SessionEventDispatcher; //导入依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
   serverAddress = new JID(XMPPServer.getInstance().getServerInfo().getXMPPDomain());
   router = XMPPServer.getInstance().getMessageRouter();

   SessionEventDispatcher.addListener(listener);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:7,
代码来源:MotDPlugin.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)