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