bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington/*
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
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 *
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 * opensso/legal/CDDLv1.0.txt
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at opensso/legal/CDDLv1.0.txt.
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 *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: LDAPServiceException.java,v 1.3 2009/01/28 05:34:49 ww203982 Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington * Portions Copyrighted 2011-2015 ForgeRock AS.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.iplanet.services.ldap;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * This exception class captures exceptions that occur in the com.iplanet.services.ldap package.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class LDAPServiceException extends Exception {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * SERVER_DOWN(4) Indicates that the server was reported down.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int SERVER_DOWN = 4;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INVALID_OPERATION(5) Reported an invalid operation. Doesn't say much.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * does it? Well, it means that something really bad is going on and I for
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * one, do not know what it is.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INVALID_OPERATION = 5;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INCORRECT_SERVER_PARAMS(6) Incorrect server parameters passed in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * configuration file. Typically, each server specified must have a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * server_id, server_name and server_type. If either of these values are
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * null, an instance of LDAPServiceException is thrown with this error code
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * set.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INCORRECT_SERVER_PARAMS = 6;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INCORRECT_LDAP_PARAMS(7) If the server_type is given as LDAP, then one or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * more of the ldap parameters are not correct. The possibilities are: 1.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The sever_port, auth_id or auth_passwd any one of them are null. 2. Port
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * number is not an integer value or it is not in the range of 0 and 65535.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INCORRECT_LDAP_PARAMS = 7;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INCORRECT_CP_PARAMS(8) One or more connection pool parameters incorrect.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The possibilities are: 1. The init_conn_pool_length or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * max_conn_pool_length or conn_pool_load_factor are not integers or are
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * less than or equal to zero. 2. The max_conn_pool_length is less than
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * init_conn_pool_length.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INCORRECT_CP_PARAMS = 8;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INCORRECT_LDAP_REBIND_PARAMS(9) The rebind parameters specified are not
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * correct. That is the rebind_id is specified, but rebind_passwd is not
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * specified. The rebind_passwd, if rebind_id is specified, at the least
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * must be "".
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INCORRECT_LDAP_REBIND_PARAMS = 9;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * MUST_HAVE_SERVICE_NAME(10) Simple, the any ips_core:service specified in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the xml must have a name.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int MUST_HAVE_SERVICE_NAME = 10;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * FILTER_IS_REQUIRED(11) For a search operation, filter is required.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int FILTER_IS_REQD = 11;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INVALID_SEARCH_CONSTRAINTS(12) If the constraints specified are not
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * comprehendable, then this error is returned. I'll try to keep this list
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * updated. The possibilities are: 1. The attribute list is not specified in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * a String[].
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INVALID_SEARCH_CONSTRAINTS = 12;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * SERVICE_NOT_FOUND(13) When called
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DataAccessProvider.getConnection(String), it tries to look for the type
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of service it is given to provide. If no such service exits, the server
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * returns with this exception code.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int SERVICE_NOT_PRESENT = 13;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * NO_DEFAULT_SERVICE_SPECIFIED(14) It could happen if you call
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DataAccessProvider.getConnection() and there was no "common" service
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * defined in the serverconfig.xml. That's when this exception code gets
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * returned.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int NO_COMMON_SERVICE_SPECIFIED = 14;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * SERVER_NOT_PRESENT(15) If you call getConnection, with or without the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * service name and there is no Server specified for that service, this
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * exception gets thrown.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int SERVER_NOT_PRESENT = 15;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INVALID_ENTRY_ID(16) Typically, if an invalid ID is passed to Entry's
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * constructor, this error is thrown.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INVALID_ENTRY_ID = 16;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * INCOMPATIBLE_DB_TYPE(17) E.g. If a function takes Connector as a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * parameter, it may implicitly expect LDAPConnector, if the current scope
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the object is LDAP specific. In such case, if another derivation of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Connector is passed, this exception will be thrown.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int INCOMPATIBLE_DB_TYPE = 17;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CACHE_OP_NOT_PERMITTED(18) If the particular server does not support
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * entry change notifications, the setupCache will return this exception.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int CACHE_OP_NOT_SUPPORTED = 18;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * FILE_NOT_FOUND(19) This exception is thrown if ADAL tries to open a file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and get a java.io.FileNotFoundException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int FILE_NOT_FOUND = 19;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * UNKNOWN_ERROR(20) This error is thrown when ADAL does not know what on
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * earth happened. e.g. WebTopParser throws and Exception object, which is
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * so generic that we don't know what to do with it.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public final static int UNKNOWN_ERROR = 20;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // /////////////////////METHODS////////////////////////////
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Constructor
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param code
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * The error code that represents the error that occurred while
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * performing an operation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public LDAPServiceException(int code) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster super();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster exceptionCode = code;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String getMessage() {
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper return super.getMessage() + "\n LDAPServiceException code=" + exceptionCode;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The constructor.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param code
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * The error code that represents the error that occurred while
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * performing an operation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param errormsg
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * A string description of the error that occurred.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public LDAPServiceException(int code, String errormsg) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster super(errormsg);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster exceptionCode = code;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The constructor.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param errormsg
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * A string description of the error that occurred.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public LDAPServiceException(String errormsg) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster super(errormsg);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper *
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * @param code The type of error that occurred
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * @param t The original exception that triggered the error
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper public LDAPServiceException(int code, Throwable t) {
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper this(code);
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper initCause(t);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * The constructor.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * @param errormsg
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * A string description of the error that occurred.
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * @param t The original exception that triggered the error
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper */
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper public LDAPServiceException(String errormsg, Throwable t) {
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper super(errormsg, t);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
64600f2cc3b3d138e64d25ccc73f93a6bad251b3Mark de Reeper * The variable contains the error that has occurred.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int exceptionCode = -1;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}