AMClientCapException.java revision 8af80418ba1ec431c8027fa9668e5678658d3611
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: AMClientCapException.java,v 1.3 2008/06/25 05:41:33 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.shared.locale.AMResourceBundleCache;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.shared.locale.L10NMessage;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * AMClientCapException: (critical) Thrown to indicate that the Attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Abstraction layer could not establish a connection with the backend service
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * provider (DSAME) OR the abstraction layer could not instantiate the actual
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * implementation objects.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class AMClientCapException extends Exception implements L10NMessage {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static AMResourceBundleCache amCache = AMResourceBundleCache
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static Debug debug = Debug.getInstance("amClientSchema");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Construct an exception with the specified msg
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param msg
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * message describing the error
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Construct an exception with the specified msg
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param rbName
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is the Resource Bundle name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param eCode
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is the Error Code
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is the message arguments array
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public AMClientCapException(String rbName, String eCode, Object[] a) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster message = getL10NMessage(java.util.Locale.ENGLISH);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the error code
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return a String
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the resource bundle name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return a String
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the message arguments array
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return an Array of message arguments.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the localized message for a given locale
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param locale
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is the Locale
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return a String which is the localized message
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String getL10NMessage(java.util.Locale locale) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ResourceBundle bundle = amCache.getResBundle(bundleName, locale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String mid = Locale.getString(bundle, errorCode, debug);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns a message
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return a String