本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例4: shutdownServer
import org.androidpn.server.xmpp.session.SessionManager; //导入依赖的package包/类
/**
* 关闭服务器
*/
private void shutdownServer() {
shuttingDown = true;
// 关闭所有连接
SessionManager.getInstance().closeAllSessions();
log.info("XmppServer stopped");
}
示例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());
}
示例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());
}
示例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");
}
示例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");
}
示例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);
}
示例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");
}
示例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;
}
示例12: NotificationManager
import org.androidpn.server.xmpp.session.SessionManager; //导入依赖的package包/类
/**
* 推送通知管理器
*/
public NotificationManager() {
sessionManager = SessionManager.getInstance();
notificationService = ServiceLocator.getNotificationService();
userService = ServiceLocator.getUserService();
}
示例13: PresenceManager
import org.androidpn.server.xmpp.session.SessionManager; //导入依赖的package包/类
/**
* 用户出席信息管理类
*/
public PresenceManager() {
sessionManager = SessionManager.getInstance();
}
示例14: PresenceUpdateHandler
import org.androidpn.server.xmpp.session.SessionManager; //导入依赖的package包/类
/**
* 这个类处理出席协议.
*/
public PresenceUpdateHandler() {
sessionManager = SessionManager.getInstance();
notificationService = ServiceLocator.getNotificationService();
notificationManager = new NotificationManager();
}
示例15: IQSetAliasHandler
import org.androidpn.server.xmpp.session.SessionManager; //导入依赖的package包/类
public IQSetAliasHandler() {
sessionManager = SessionManager.getInstance();
}