SessionCount.java revision 95cd88252d8ce7d506cf8b1dccdc4d531de5dab6
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: SessionCount.java,v 1.5 2008/06/25 05:41:31 qcheng Exp $
*
*/
/**
* Portions Copyrighted 2011-2016 ForgeRock AS.
*/
/**
* <code>SessionCount</code> represents the session count for a given user.
* Fetches the sessions for the given user directly from the session repository.
*/
public class SessionCount {
private static Debug debug = InjectorHolder.getInstance(Key.get(Debug.class, Names.named(SESSION_DEBUG)));
private static boolean caseSensitiveUUID =
private static final SessionService sessionService = InjectorHolder.getInstance(SessionService.class);
static {
try {
+ "SSOTokenManager instance.");
}
}
/**
* Returns the expiration information of all sessions belonging to a user
* (uuid). The returned value will be a Map (sid->expiration_time).
*
* @param uuid
* User's universal unique ID.
* @return user Sessions
* @exception SessionException
* if there is any problem with accessing the session
* repository.
*/
if (!caseSensitiveUUID) {
}
try {
} catch (CoreTokenException e) {
throw new SessionException(e);
}
" returning empty map");
}
return sessions;
}
try {
// Filter and Query the CTS
.and()
.build();
if (debug.messageEnabled()) {
"getSessionsFromRepository query success:\n" +
"Query: {0}\n" +
"Count: {1}",
partialTokens.size()));
}
// Populate the return Map from the query results.
// Session ID
// Expiration Date converted to Unix Time
}
if (debug.messageEnabled()) {
"getSessionsFromRepository query results:\n" +
"{0}",
sessions));
}
return sessions;
} catch (CoreTokenException e) {
"Session repository is not available", e);
throw e;
}
}
}