/** * Called by Status implementations to retrieve the pending notifications and send them to the * connected client device */ protected void managePendingNotificationMessage() { try { String username = (String) session.getAttribute(ATTRIBUTE_USERNAME); String deviceId = (String) session.getAttribute(ATTRIBUTE_DEVID); if (logger.isTraceEnabled()) { logger.trace( "Retrieving pending notifications for user '" + username + "', deviceId: '" + deviceId + "'"); } com.funambol.framework.notification.Message message = pendingNotificationManager.getMessageFromPendingNotifications(username, deviceId); if (message == null) { if (logger.isTraceEnabled()) { logger.trace("No pending notification messages present."); } } else { sendSyncMessage(message.getMessageContent()); pendingNotificationManager.deletePendingNotifications( username, deviceId, message.getSyncSources()); if (logger.isTraceEnabled()) { logger.trace("Pending notifications sent to device " + deviceId); } } } catch (PendingNotificationException ex) { logger.error("Error while retrieving pending notification messages", ex); } }
protected void forwardSubscription() { String deviceId = (String) session.getAttribute(ATTRIBUTE_DEVID); if (deviceId == null || "".equals(deviceId)) { logger.error("Unable to retrieve device id from session attributes"); closeSession(); return; } dispatcher.subscribe(deviceId, this); if (logger.isTraceEnabled()) { logger.trace("Subscribed notification for device " + deviceId); } }
private void setSessionState(State sessionState) { if (this.sessionState.deepequals(sessionState)) { return; } if (this.sessionState.deepequals(new StateDiconnected()) && !(sessionState.deepequals(new StateDiconnected()))) { logger.error( "status transition from " + this.sessionState.getName() + " to " + sessionState.getName() + " in not allowed"); return; } if (logger.isTraceEnabled()) { logger.trace( "Changing status from " + this.sessionState.getName() + " to " + sessionState.getName()); } this.sessionState = sessionState; }
/** * Callback called when another <CODE>SessionManager</CODE> subscribes using the same key * (deviceId). If another <CODE>SessionManager</CODE> subscribes using the same key, the * previously subscribed <CODE>SessionManager</CODE> closes the connection. */ public void onUnsubscription() { logger.error("Found previously established connection for the same device id"); closeSession(); }