Search in sources :

Example 11 with SessionResponse

use of com.iplanet.dpro.session.share.SessionResponse in project OpenAM by OpenRock.

the class SessionCount method getSessionsFromPeerServers.

/*
     * Get user sessions from session repository
     */
private static Map getSessionsFromPeerServers(String uuid) {
    Map sessions = getSessionsFromLocalServer(uuid);
    String localServerID = serverConfig.getLocalServerID();
    Set serverIDs = null;
    try {
        serverIDs = WebtopNaming.getSiteNodes(localServerID);
    } catch (Exception e) {
        debug.error("Failed to get the serverIDs from " + "WebtopNaming.", e);
        return sessions;
    }
    for (Iterator m = serverIDs.iterator(); m.hasNext(); ) {
        String serverID = (String) m.next();
        if (serverID.equals(localServerID)) {
            continue;
        }
        try {
            URL svcurl = SESSION_SERVICE_URL_SERVICE.getSessionServiceURL(serverID);
            SessionRequest sreq = new SessionRequest(SessionRequest.GetSessionCount, getAdminToken().getTokenID().toString(), false);
            sreq.setUUID(uuid);
            SessionResponse sres = getSessionResponse(svcurl, sreq);
            sessions.putAll(sres.getSessionsForGivenUUID());
        } catch (SessionException se) {
            if (debug.messageEnabled()) {
                debug.message("SessionConstraint: " + "peer AM server is down...");
            }
        }
    }
    return sessions;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) SessionException(com.iplanet.dpro.session.SessionException) SessionResponse(com.iplanet.dpro.session.share.SessionResponse) HashMap(java.util.HashMap) Map(java.util.Map) SessionException(com.iplanet.dpro.session.SessionException) URL(java.net.URL) SessionRequest(com.iplanet.dpro.session.share.SessionRequest)

Example 12 with SessionResponse

use of com.iplanet.dpro.session.share.SessionResponse in project OpenAM by OpenRock.

the class SessionRequestHandler method forward.

private SessionResponse forward(URL svcurl, SessionRequest sreq) throws SessionException {
    try {
        Object context = RestrictedTokenContext.getCurrent();
        if (context != null) {
            sreq.setRequester(RestrictedTokenContext.marshal(context));
        }
        SessionResponse sres = sessionPLLSender.sendPLLRequest(svcurl, sreq);
        if (sres.getException() != null) {
            throw new SessionException(sres.getException());
        }
        return sres;
    } catch (SessionException se) {
        throw se;
    } catch (Exception ex) {
        throw new SessionException(ex);
    }
}
Also used : SessionException(com.iplanet.dpro.session.SessionException) SessionResponse(com.iplanet.dpro.session.share.SessionResponse) SessionException(com.iplanet.dpro.session.SessionException)

Aggregations

SessionResponse (com.iplanet.dpro.session.share.SessionResponse)12 SessionException (com.iplanet.dpro.session.SessionException)10 SessionRequest (com.iplanet.dpro.session.share.SessionRequest)7 SessionInfo (com.iplanet.dpro.session.share.SessionInfo)5 SessionID (com.iplanet.dpro.session.SessionID)3 SSOToken (com.iplanet.sso.SSOToken)3 URL (java.net.URL)3 Response (com.iplanet.services.comm.share.Response)2 HashMap (java.util.HashMap)2 ThreadPoolException (com.iplanet.am.util.ThreadPoolException)1 Session (com.iplanet.dpro.session.Session)1 Request (com.iplanet.services.comm.share.Request)1 RequestSet (com.iplanet.services.comm.share.RequestSet)1 SSOException (com.iplanet.sso.SSOException)1 SSOTokenManager (com.iplanet.sso.SSOTokenManager)1 SearchResults (com.sun.identity.common.SearchResults)1 RestrictedTokenAction (com.sun.identity.session.util.RestrictedTokenAction)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1