View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.model.exception;
21  
22  
23  import java.util.Hashtable;
24  
25  import javax.naming.Context;
26  import javax.naming.NamingException;
27  
28  import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
29  import org.apache.directory.api.ldap.model.name.Dn;
30  import org.apache.directory.api.util.exception.NotImplementedException;
31  
32  
33  /**
34   * A {@link LdapOperationException} which associates a resultCode namely the
35   * {@link org.apache.directory.api.ldap.model.message.ResultCodeEnum#REFERRAL} resultCode with the exception.
36   * 
37   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
38   */
39  public class AbstractLdapReferralException extends LdapOperationException
40  {
41      /** The serial version UUID */
42      static final long serialVersionUID = 1L;
43  
44      /** The remaining Dn */
45      private Dn remainingDn;
46  
47      /** TODO */
48      private Object resolvedObject;
49  
50  
51      /**
52       * 
53       * Creates a new instance of AbstractLdapReferralException.
54       *
55       * @param explanation The associated message
56       */
57      public AbstractLdapReferralException( String explanation )
58      {
59          super( explanation );
60      }
61  
62  
63      /**
64       * Always returns {@link ResultCodeEnum#REFERRAL}
65       * 
66       * @see LdapException#getResultCode()
67       */
68      public ResultCodeEnum getResultCode()
69      {
70          return ResultCodeEnum.REFERRAL;
71      }
72  
73  
74      public Context getReferralContext() throws NamingException
75      {
76          throw new NotImplementedException();
77      }
78  
79  
80      public Context getReferralContext( Hashtable<?, ?> arg ) throws NamingException
81      {
82          throw new NotImplementedException();
83      }
84  
85  
86      public void retryReferral()
87      {
88          throw new NotImplementedException();
89      }
90  
91  
92      /**
93       * @return the remainingDn
94       */
95      public Dn getRemainingDn()
96      {
97          return remainingDn;
98      }
99  
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 }