FSSessionMapStats.java revision a688bcbb4bcff5398fdd29b86f83450257dc0df4
563N/A/**
563N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
563N/A *
563N/A * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
563N/A *
563N/A * The contents of this file are subject to the terms
563N/A * of the Common Development and Distribution License
563N/A * (the License). You may not use this file except in
563N/A * compliance with the License.
563N/A *
563N/A * You can obtain a copy of the License at
563N/A * https://opensso.dev.java.net/public/CDDLv1.0.html or
563N/A * opensso/legal/CDDLv1.0.txt
563N/A * See the License for the specific language governing
563N/A * permission and limitations under the License.
563N/A *
563N/A * When distributing Covered Code, include this CDDL
563N/A * Header Notice in each file and include the License file
873N/A * at opensso/legal/CDDLv1.0.txt.
563N/A * If applicable, add the following below the CDDL Header,
563N/A * with the fields enclosed by brackets [] replaced by
563N/A * your own identifying information:
563N/A * "Portions Copyrighted [year] [name of copyright owner]"
563N/A *
733N/A * $Id: FSSessionMapStats.java,v 1.3 2008/06/25 05:46:56 qcheng Exp $
563N/A *
563N/A */
563N/A
563N/Apackage com.sun.identity.federation.services;
563N/A
563N/Aimport com.sun.identity.shared.stats.StatsListener;
563N/Aimport java.util.Map;
662N/A
662N/A/**
1473N/A * Handles statistics for session maps.
1473N/A */
563N/Apublic class FSSessionMapStats implements StatsListener {
1405N/A
563N/A private Map table;
563N/A private String name;
563N/A private String providerId;
662N/A private String realm;
1042N/A
662N/A /**
1042N/A * Constructs a new <code>FSSessionMapStats</code> object.
2086N/A * @param table a map whose statistics to be run
2086N/A * @param name name of the map
563N/A * @param realm the realm in which the entity resides
563N/A * @param providerId hosted provider ID
1701N/A */
563N/A public FSSessionMapStats(
563N/A Map table, String name, String realm, String providerId)
563N/A {
563N/A this.table = table;
563N/A this.name = name;
563N/A this.providerId = providerId;
563N/A this.realm = realm;
563N/A }
563N/A
563N/A /**
1405N/A * Prints the statistics of the map.
1405N/A */
563N/A public void printStats() {
563N/A if (table.size() != 0 ) {
2086N/A FSSessionManager.sessStats.record("Number of entries in " + name
563N/A + " table for provider " + providerId + " in realm "
1473N/A + realm + " : " + table.size());
1473N/A } else {
563N/A FSSessionManager.sessStats.record("No entry found in " + name
563N/A + " table for provider " + providerId
1126N/A + " in realm " + realm + ".");
563N/A }
1126N/A }
563N/A}
1126N/A