001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020package org.apache.directory.api.ldap.model.exception;
021
022
023import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
024import org.apache.directory.api.ldap.model.name.Dn;
025
026
027/**
028 * An class for LDAP operation exceptions which add LDAP specific information to
029 * Exceptions.
030 * 
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public class LdapOperationException extends LdapException
034{
035    /** The serial version UUID */
036    private static final long serialVersionUID = 1L;
037
038    /** The operation resultCode */
039    protected ResultCodeEnum resultCode;
040
041    /** The resolved Dn */
042    protected Dn resolvedDn;
043
044
045    /**
046     * @return the resolvedDn
047     */
048    public Dn getResolvedDn()
049    {
050        return resolvedDn;
051    }
052
053
054    /**
055     * @param resolvedDn the resolvedDn to set
056     */
057    public void setResolvedDn( Dn resolvedDn )
058    {
059        this.resolvedDn = resolvedDn;
060    }
061
062
063    /**
064     * Creates a new instance of LdapOperationException.
065     *
066     * @param resultCode The operation resultCode
067     * @param message The exception message
068     */
069    public LdapOperationException( ResultCodeEnum resultCode, String message )
070    {
071        super( message );
072        this.resultCode = resultCode;
073    }
074
075
076    /**
077     * Creates a new instance of LdapOperationException.
078     *
079     * @param resultCode The operation resultCode
080     * @param message The exception message
081     * @param cause The root cause for this exception
082     */
083    public LdapOperationException( ResultCodeEnum resultCode, String message, Throwable cause )
084    {
085        super( message, cause );
086        this.resultCode = resultCode;
087    }
088
089
090    /**
091     * Creates a new instance of LdapOperationException.
092     *
093     * @param message The exception message
094     */
095    public LdapOperationException( String message )
096    {
097        super( message );
098    }
099
100
101    /**
102     * Creates a new instance of LdapOperationException.
103     *
104     * @param message The exception message
105     * @param cause The root cause for this exception
106     */
107    public LdapOperationException( String message, Throwable cause )
108    {
109        super( message, cause );
110    }
111
112
113    /**
114     * Gets the LDAP result code that would be associated with this exception.
115     * 
116     * @return the LDAP result code corresponding to this exception type.
117     */
118    public ResultCodeEnum getResultCode()
119    {
120        return resultCode;
121    }
122}