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.shared.ldap.model.exception;
021
022
023import java.util.Hashtable;
024
025import javax.naming.Context;
026import javax.naming.NamingException;
027
028import org.apache.directory.shared.ldap.model.name.Dn;
029import org.apache.directory.shared.util.exception.NotImplementedException;
030import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
031
032
033/**
034 * A {@link LdapOperationException} which associates a resultCode namely the
035 * {@link org.apache.directory.shared.ldap.model.message.ResultCodeEnum#REFERRAL} resultCode with the exception.
036 * 
037 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
038 */
039public class AbstractLdapReferralException extends LdapOperationException
040{
041    /** The serial version UUID */
042    static final long serialVersionUID = 1L;
043
044    /** The remaining Dn */
045    private Dn remainingDn;
046
047    /** TODO */
048    private Object resolvedObject;
049
050
051    /**
052     * 
053     * Creates a new instance of AbstractLdapReferralException.
054     *
055     * @param explanation The associated message
056     */
057    public AbstractLdapReferralException( String explanation )
058    {
059        super( explanation );
060    }
061
062
063    /**
064     * Always returns {@link ResultCodeEnum#REFERRAL}
065     * 
066     * @see LdapException#getResultCode()
067     */
068    public ResultCodeEnum getResultCode()
069    {
070        return ResultCodeEnum.REFERRAL;
071    }
072
073
074    public Context getReferralContext() throws NamingException
075    {
076        throw new NotImplementedException();
077    }
078
079
080    public Context getReferralContext( Hashtable<?, ?> arg ) throws NamingException
081    {
082        throw new NotImplementedException();
083    }
084
085
086    public void retryReferral()
087    {
088        throw new NotImplementedException();
089    }
090
091
092    /**
093     * @return the remainingDn
094     */
095    public Dn getRemainingDn()
096    {
097        return remainingDn;
098    }
099
100
101    /**
102     * @param remainingDn the remainingName to set
103     */
104    public void setRemainingDn( Dn remainingDn )
105    {
106        this.remainingDn = remainingDn;
107    }
108
109
110    /**
111     * @return the resolvedObject
112     */
113    public Object getResolvedObject()
114    {
115        return resolvedObject;
116    }
117
118
119    /**
120     * @param resolvedObject the resolvedObject to set
121     */
122    public void setResolvedObject( Object resolvedObject )
123    {
124        this.resolvedObject = resolvedObject;
125    }
126}