CachedSubEntries.java revision 72a95afc0cb0649e7179191df242a3ee919a33cf
/**
* 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: CachedSubEntries.java,v 1.10 2008/07/11 01:46:21 arviranga Exp $
*
*/
/**
* Portions Copyrighted 2013 ForgeRock AS
*/
public class CachedSubEntries {
// Cache of CachedSubEntries based on lowercased DN to obtain sub entries
new HashMap(100));
// Instance variables
// Cache of SubEntries for the given SSOToken
// Limited cache so that it does not grow in size
private long lastUpdated;
protected CachedSMSEntry cachedEntry;
protected String notificationID;
// Debug & I18n variables
// Private constructor, can be instantiated only via getInstance
try {
// Register for notifications to clear instance cache
.notifyChangesToSubNodes(t, dn, this);
} catch (SSOException ssoe) {
// invalid ssoToken
.getString("sms-INVALID_SSO_TOKEN"),
"sms-INVALID_SSO_TOKEN"));
}
if (debug.messageEnabled()) {
}
}
/**
* Returns one-level sub-entries for the given DN.
* Results are cached.
*
* @param t SSOToken to used for searching
* @return sub entries for the given DN
* @throws com.sun.identity.sm.SMSException
* @throws com.iplanet.sso.SSOException
*/
if (debug.messageEnabled()) {
"cache: " + subEntries);
}
// Check if cached entries can be used
// Clear the cache
} else {
return (new LinkedHashSet(subEntries));
}
}
// Obtain sub-entries and add to cache
if (SMSEntry.cacheSMSEntries) {
// Add to cache
}
if (debug.messageEnabled()) {
"DataStore: " + subEntries);
}
return (subEntries);
}
/**
* Return sub-entries that match the pattern.
* Performs data store operation, the results are not cached
*
* @param token
* @param pattern
* @return subentries that match the pattern
* @throws com.sun.identity.sm.SMSException
* @throws com.iplanet.sso.SSOException
*/
throws SMSException, SSOException {
if (debug.messageEnabled()) {
}
}
/**
* Returns sub-entries that belong to given SubSchema name and
* statisfies the pattern. The results are not cached.
*
* @param token
* @param pattern
* @param serviceidPattern sub-schema name
* @return subentries that belong to given SubSchema name and satisfies
* the pattern
* @throws com.sun.identity.sm.SMSException
* @throws com.iplanet.sso.SSOException
*/
if (debug.messageEnabled()) {
}
}
// Clear the cache, will be updated in the next lookup
}
// Clear the cache, will be updated in the next lookup
}
return (getSubEntries(t).isEmpty());
}
}
protected SMSEntry getSMSEntry() {
if (cachedEntry.isDirty()) {
}
return (cachedEntry.getSMSEntry());
}
protected void update() {
if (debug.messageEnabled()) {
+ cachedEntry.getDN());
}
// Clear the cache, will be updated in the next lookup
}
}
/**
* Returns realm names that matches the given pattern. If <code>
* recursive<code> is set to <code>true</code>, a sub-tree search
* is performed. The results are not cached.
*
* @param token
* @param pattern
* @param recursive
* @return realm names that matches the given pattern
* @throws com.sun.identity.sm.SMSException
* @throws com.iplanet.sso.SSOException
*/
if (debug.messageEnabled()) {
}
}
/**
* Returns realm names that match the attribute-values pair for the
* given service name. The attribute-values pairs is based on organization
* attribute schema. A sub-tree search is performed.
* The results are not cached.
*
* @param token
* @param serviceName
* @param attrName
* @param values
* @return realm names that match the attributevalues pair for the given
* service name
* @throws com.sun.identity.sm.SMSException
* @throws com.iplanet.sso.SSOException
*/
if (debug.messageEnabled()) {
}
}
// Static methods to get object instance and to clear cache
public static CachedSubEntries getInstanceIfCached(
if (debug.messageEnabled()) {
}
return (answer);
}
// Not in cache, synchronize and add to cache
synchronized (smsEntries) {
// Create and add to cache
}
}
return (answer);
}
throws SMSException {
}
static void clearCache() {
synchronized (smsEntries) {
// Clear the individual cached entries
}
}
}
}