當前位置: 首頁>>代碼示例>>Java>>正文


Java SessionManager類代碼示例

本文整理匯總了Java中org.androidpn.server.xmpp.session.SessionManager的典型用法代碼示例。如果您正苦於以下問題:Java SessionManager類的具體用法?Java SessionManager怎麽用?Java SessionManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SessionManager類屬於org.androidpn.server.xmpp.session包,在下文中一共展示了SessionManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deliver

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * 將數據包傳遞給數據包收件人
 * 
 * @param packet
 *            要被投遞的數據包
 * @throws PacketException
 *             如果數據包為空,或收件人未找到
 */
public static void deliver(Packet packet) throws PacketException {
	if (packet == null) {
		throw new PacketException("數據包為null");
	}

	try {
		JID recipient = packet.getTo();
		if (recipient != null) {
			ClientSession clientSession = SessionManager.getInstance()
					.getSession(recipient);
			if (clientSession != null) {
				clientSession.deliver(packet);
			}
		}
	} catch (Exception e) {
		log.error("不能提供數據包: " + packet.toString(), e);
	}
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:27,代碼來源:PacketDeliverer.java

示例2: deliver

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * Delivers the packet to the packet recipient.  
 * 
 * @param packet the packet to deliver
 * @throws PacketException if the packet is null or the recipient was not found.
 */
public static void deliver(Packet packet) throws PacketException {
    if (packet == null) {
        throw new PacketException("Packet was null");
    }

    try {
        JID recipient = packet.getTo();
        if (recipient != null) {
            ClientSession clientSession = SessionManager.getInstance()
                    .getSession(recipient);
            if (clientSession != null) {
                clientSession.deliver(packet);
            }
        }
    } catch (Exception e) {
        log.error("Could not deliver packet: " + packet.toString(), e);
    }
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:25,代碼來源:PacketDeliverer.java

示例3: deliver

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
public static void deliver(Packet packet) throws PacketException {
    if (packet == null) {
        throw new PacketException("Packet was null");
    }

    try {
        JID recipient = packet.getTo();
        if (recipient != null) {
            ClientSession clientSession = SessionManager.getInstance()
                    .getSession(recipient);
            if (clientSession != null) {
                clientSession.deliver(packet);
            }
        }
    } catch (Exception e) {
        log.error("Could not deliver packet\n" + packet.toString(), e);
    }
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:19,代碼來源:PacketDeliverer.java

示例4: shutdownServer

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
* 關閉服務器
*/
  private void shutdownServer() {
      shuttingDown = true;
// 關閉所有連接
      SessionManager.getInstance().closeAllSessions();
      log.info("XmppServer stopped");
  }
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:10,代碼來源:XmppServer.java

示例5: IQRouter

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * IQ路由
 */
public IQRouter() {
	sessionManager = SessionManager.getInstance();
	iqHandlers.add(new IQAuthHandler());
	iqHandlers.add(new IQRegisterHandler());
	iqHandlers.add(new IQRosterHandler());
	iqHandlers.add(new IQDeliverConfirmHandler());
	iqHandlers.add(new IQSetAliasHandler());
	iqHandlers.add(new IQSetTagsHandler());
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:13,代碼來源:IQRouter.java

示例6: IQRouter

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * Constucts a packet router registering new IQ handlers.
 */
public IQRouter() {
    sessionManager = SessionManager.getInstance();
    iqHandlers.add(new IQAuthHandler());
    iqHandlers.add(new IQRegisterHandler());
    iqHandlers.add(new IQRosterHandler());
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:10,代碼來源:IQRouter.java

示例7: shutdownServer

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
private void shutdownServer() {
    shuttingDown = true;
    // Shutdown the task engine
    TaskEngine.getInstance().shutdown();
    // Close all connections
    SessionManager.getInstance().closeAllSessions();
    log.info("XmppServer stopped");
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:9,代碼來源:XmppServer.java

示例8: shutdownServer

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
private void shutdownServer() {
    shuttingDown = true;
    // Shutdown the task engine.
    TaskEngine.getInstance().shutdown();
    // Close all connections
    SessionManager.getInstance().closeAllSessions();
    log.info("XmppServer stopped");
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:9,代碼來源:XmppServer.java

示例9: IQRegisterHandler

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
public IQRegisterHandler() {
    info = new IQHandlerInfo("query", "jabber:iq:register");

    sessionManager = SessionManager.getInstance();
    userService = ServiceManager.getUserService();

    probeResult = DocumentHelper.createElement(QName.get("query",
            "jabber:iq:register"));
    probeResult.addElement("username");
    probeResult.addElement("password");
    probeResult.addElement("email");
    probeResult.addElement("name");

    registrationEnabled = Config.getBoolean("register.inband", true);
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:16,代碼來源:IQRegisterHandler.java

示例10: IQAuthHandler

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
public IQAuthHandler() {
    info = new IQHandlerInfo("query", "jabber:iq:auth");

    sessionManager = SessionManager.getInstance();
    probeResponse = DocumentHelper.createElement(QName.get("query",
            "jabber:iq:auth"));
    probeResponse.addElement("username");
    if (AuthManager.isPlainSupported()) {
        probeResponse.addElement("password");
    }
    if (AuthManager.isDigestSupported()) {
        probeResponse.addElement("digest");
    }
    probeResponse.addElement("resource");
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:16,代碼來源:IQAuthHandler.java

示例11: list

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
public ModelAndView list(HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ClientSession[] sessions = new ClientSession[0];
    sessions = SessionManager.getInstance().getSessions().toArray(sessions);

    List<SessionVO> voList = new ArrayList<SessionVO>();
    for (ClientSession sess : sessions) {
        SessionVO vo = new SessionVO();
        vo.setUsername(sess.getUsername());
        vo.setResource(sess.getAddress().getResource());
        // Status
        if (sess.getStatus() == Session.STATUS_CONNECTED) {
            vo.setStatus("CONNECTED");
        } else if (sess.getStatus() == Session.STATUS_AUTHENTICATED) {
            vo.setStatus("AUTHENTICATED");
        } else if (sess.getStatus() == Session.STATUS_CLOSED) {
            vo.setStatus("CLOSED");
        } else {
            vo.setStatus("UNKNOWN");
        }
        // Presence
        if (!sess.getPresence().isAvailable()) {
            vo.setPresence("Offline");// 離線
        } else {
            Presence.Show show = sess.getPresence().getShow();
            if (show == null) {
                vo.setPresence("Online");// 在線的
            } else if (show == Presence.Show.away) {
                vo.setPresence("Away");// 離開
            } else if (show == Presence.Show.chat) {
                vo.setPresence("Chat");// 聊天
            } else if (show == Presence.Show.dnd) {
                vo.setPresence("Do Not Disturb");// 請勿打擾
            } else if (show == Presence.Show.xa) {
                vo.setPresence("eXtended Away");// 忙碌
            } else {
                vo.setPresence("Unknown");// 未知
            }
        }
        vo.setClientIP(sess.getHostAddress());
        vo.setCreatedDate(sess.getCreationDate());
        voList.add(vo);
    }

    ModelAndView mav = new ModelAndView();
    mav.addObject("sessionList", voList);
    mav.setViewName("session/list");
    return mav;
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:50,代碼來源:SessionController.java

示例12: NotificationManager

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * 推送通知管理器
 */
public NotificationManager() {
	sessionManager = SessionManager.getInstance();
	notificationService = ServiceLocator.getNotificationService();
	userService = ServiceLocator.getUserService();
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:9,代碼來源:NotificationManager.java

示例13: PresenceManager

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * 用戶出席信息管理類
 */
public PresenceManager() {
	sessionManager = SessionManager.getInstance();
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:7,代碼來源:PresenceManager.java

示例14: PresenceUpdateHandler

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
/**
 * 這個類處理出席協議.
 */
public PresenceUpdateHandler() {
	sessionManager = SessionManager.getInstance();
	notificationService = ServiceLocator.getNotificationService();
	notificationManager = new NotificationManager();
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:9,代碼來源:PresenceUpdateHandler.java

示例15: IQSetAliasHandler

import org.androidpn.server.xmpp.session.SessionManager; //導入依賴的package包/類
public IQSetAliasHandler() {
	sessionManager = SessionManager.getInstance();
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:4,代碼來源:IQSetAliasHandler.java


注:本文中的org.androidpn.server.xmpp.session.SessionManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。