001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: InvalidNameException.java,v 1.2 2008/06/25 05:43:44 qcheng Exp $
026 *
027 */
028
029
030package com.sun.identity.policy;
031
032/**
033 * Exception thrown if a name of an object such as policy, rule or 
034 * referral is invalid 
035 *
036 * @supported.all.api
037 */
038public class InvalidNameException extends PolicyException {
039
040    private String name;
041    private int type;
042
043    /**
044     * Constructor
045     * @param msg exception message
046     * @param name name that is invalid 
047     * @param type type of object that had invalid name 
048     */
049    public InvalidNameException(String msg, String name, int type) {
050        super(msg);
051        fillInStackTrace();
052        this.name = name;
053        this.type = type;
054    }
055
056    /**
057     * Constructor
058     * @param rbName Resource bundle name of exception message
059     * @param errCode id used with resource bundle to get error message
060     * @param args any arguments for message formatting. null if no
061     * additional arguments are necessary
062     * @param name name that is invalid
063     * @param type type of object that had invalid name
064     */
065    public InvalidNameException(String rbName, String errCode,         
066        Object[] args, String name, int type) 
067    {
068        super(rbName, errCode, args,null);
069        fillInStackTrace();
070        this.name = name;
071        this.type = type;
072    }
073
074    /**
075     * Constructor
076     * @param rbName Resource bundle name of exception message
077     * @param errCode id used with resource bundle to get error message
078     * @param args any arguments for message formatting. null if no
079     * additional arguments are necessary
080     * @param t nested root cause exception
081     * @param name name that is invalid
082     * @param type type of object that had invalid name
083     */
084    public InvalidNameException(String rbName, String errCode,         
085        Object[] args, Throwable t, String name, int type) 
086    {
087        super(rbName, errCode, args,t);
088        fillInStackTrace();
089        this.name = name;
090        this.type = type;
091    }
092
093    /**
094     * Constructor
095     * @param t nested root cause exception
096     * @param name name that is invalid 
097     * @param type type of object that had invalid name 
098     */
099    public InvalidNameException(Throwable t, String name, int type) {
100        super(t);
101        fillInStackTrace();
102        this.name = name;
103        this.type = type;
104    }
105
106    /**
107     * Gets the name that is invalid
108     *
109     * @return name that is invalid
110     */
111    public String getName() {
112        return (name);
113    }
114
115    /**
116     * Gets the type of object which encountered
117     * the invalid name. The defined objects are <code>POLICY</code>,
118     * <code>RULE</code>, <code>ORGANIZATION</code>,
119     * <code>USER_COLLECTION</code>
120     * <code>RESPONSE_PROVIDER_COLLECTION</code>
121     * <code>CONDITION_COLLECTION</code>
122     * <code>REFERRAL_COLLECTION</code>
123     * <code>REFERRAL_TYPE</code>
124     * <code>SUBJECT_TYPE</code>
125     * and <code>SERVICE</code>
126     *
127     * @return type of object that had invalid name
128     */
129    public int getObjectType() {
130        return (type);
131    }    
132}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.