Path: blob/master/src/java.naming/share/classes/javax/naming/CannotProceedException.java
41152 views
/*1* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.naming;2627import java.util.Hashtable;2829/**30* This exception is thrown to indicate that the operation reached31* a point in the name where the operation cannot proceed any further.32* When performing an operation on a composite name, a naming service33* provider may reach a part of the name that does not belong to its34* namespace. At that point, it can construct a35* CannotProceedException and then invoke methods provided by36* javax.naming.spi.NamingManager (such as getContinuationContext())37* to locate another provider to continue the operation. If this is38* not possible, this exception is raised to the caller of the39* context operation.40*<p>41* If the program wants to handle this exception in particular, it42* should catch CannotProceedException explicitly before attempting to43* catch NamingException.44*<p>45* A CannotProceedException instance is not synchronized against concurrent46* multithreaded access. Multiple threads trying to access and modify47* CannotProceedException should lock the object.48*49* @author Rosanna Lee50* @author Scott Seligman51* @since 1.352*/5354/*55* The serialized form of a CannotProceedException object consists of56* the serialized fields of its NamingException superclass, the remaining new57* name (a Name object), the environment (a Hashtable), the altName field58* (a Name object), and the serialized form of the altNameCtx field.59*/606162public class CannotProceedException extends NamingException {63/**64* Contains the remaining unresolved part of the second65* "name" argument to Context.rename().66* This information is necessary for67* continuing the Context.rename() operation.68* <p>69* This field is initialized to null.70* It should not be manipulated directly: it should71* be accessed and updated using getRemainingName() and setRemainingName().72* @serial73*74* @see #getRemainingNewName75* @see #setRemainingNewName76*/77protected Name remainingNewName = null;7879/**80* Contains the environment81* relevant for the Context or DirContext method that cannot proceed.82* <p>83* This field is initialized to null.84* It should not be manipulated directly: it should be accessed85* and updated using getEnvironment() and setEnvironment().86* @serial87*88* @see #getEnvironment89* @see #setEnvironment90*/91protected Hashtable<?,?> environment = null;9293/**94* Contains the name of the resolved object, relative95* to the context {@code altNameCtx}. It is a composite name.96* If null, then no name is specified.97* See the {@code javax.naming.spi.ObjectFactory.getObjectInstance}98* method for details on how this is used.99* <p>100* This field is initialized to null.101* It should not be manipulated directly: it should102* be accessed and updated using getAltName() and setAltName().103* @serial104*105* @see #getAltName106* @see #setAltName107* @see #altNameCtx108* @see javax.naming.spi.ObjectFactory#getObjectInstance109*/110protected Name altName = null;111112/**113* Contains the context relative to which114* {@code altName} is specified. If null, then the default initial115* context is implied.116* See the {@code javax.naming.spi.ObjectFactory.getObjectInstance}117* method for details on how this is used.118* <p>119* This field is initialized to null.120* It should not be manipulated directly: it should121* be accessed and updated using getAltNameCtx() and setAltNameCtx().122* @serial123*124* @see #getAltNameCtx125* @see #setAltNameCtx126* @see #altName127* @see javax.naming.spi.ObjectFactory#getObjectInstance128*/129@SuppressWarnings("serial") // Not statically typed as Serializable130protected Context altNameCtx = null;131132/**133* Constructs a new instance of CannotProceedException using an134* explanation. All unspecified fields default to null.135*136* @param explanation A possibly null string containing additional137* detail about this exception.138* If null, this exception has no detail message.139* @see java.lang.Throwable#getMessage140*/141public CannotProceedException(String explanation) {142super(explanation);143}144145/**146* Constructs a new instance of CannotProceedException.147* All fields default to null.148*/149public CannotProceedException() {150super();151}152153/**154* Retrieves the environment that was in effect when this exception155* was created.156* @return Possibly null environment property set.157* null means no environment was recorded for this exception.158* @see #setEnvironment159*/160public Hashtable<?,?> getEnvironment() {161return environment;162}163164/**165* Sets the environment that will be returned when getEnvironment()166* is called.167* @param environment A possibly null environment property set.168* null means no environment is being recorded for169* this exception.170* @see #getEnvironment171*/172public void setEnvironment(Hashtable<?,?> environment) {173this.environment = environment; // %%% clone it??174}175176/**177* Retrieves the "remaining new name" field of this exception, which is178* used when this exception is thrown during a rename() operation.179*180* @return The possibly null part of the new name that has not been resolved.181* It is a composite name. It can be null, which means182* the remaining new name field has not been set.183*184* @see #setRemainingNewName185*/186public Name getRemainingNewName() {187return remainingNewName;188}189190/**191* Sets the "remaining new name" field of this exception.192* This is the value returned by {@code getRemainingNewName()}.193*<p>194* {@code newName} is a composite name. If the intent is to set195* this field using a compound name or string, you must196* "stringify" the compound name, and create a composite197* name with a single component using the string. You can then198* invoke this method using the resulting composite name.199*<p>200* A copy of {@code newName} is made and stored.201* Subsequent changes to {@code name} does not202* affect the copy in this NamingException and vice versa.203*204* @param newName The possibly null name to set the "remaining new name" to.205* If null, it sets the remaining name field to null.206*207* @see #getRemainingNewName208*/209public void setRemainingNewName(Name newName) {210if (newName != null)211this.remainingNewName = (Name)(newName.clone());212else213this.remainingNewName = null;214}215216/**217* Retrieves the {@code altName} field of this exception.218* This is the name of the resolved object, relative to the context219* {@code altNameCtx}. It will be used during a subsequent call to the220* {@code javax.naming.spi.ObjectFactory.getObjectInstance} method.221*222* @return The name of the resolved object, relative to223* {@code altNameCtx}.224* It is a composite name. If null, then no name is specified.225*226* @see #setAltName227* @see #getAltNameCtx228* @see javax.naming.spi.ObjectFactory#getObjectInstance229*/230public Name getAltName() {231return altName;232}233234/**235* Sets the {@code altName} field of this exception.236*237* @param altName The name of the resolved object, relative to238* {@code altNameCtx}.239* It is a composite name.240* If null, then no name is specified.241*242* @see #getAltName243* @see #setAltNameCtx244*/245public void setAltName(Name altName) {246this.altName = altName;247}248249/**250* Retrieves the {@code altNameCtx} field of this exception.251* This is the context relative to which {@code altName} is named.252* It will be used during a subsequent call to the253* {@code javax.naming.spi.ObjectFactory.getObjectInstance} method.254*255* @return The context relative to which {@code altName} is named.256* If null, then the default initial context is implied.257*258* @see #setAltNameCtx259* @see #getAltName260* @see javax.naming.spi.ObjectFactory#getObjectInstance261*/262public Context getAltNameCtx() {263return altNameCtx;264}265266/**267* Sets the {@code altNameCtx} field of this exception.268*269* @param altNameCtx270* The context relative to which {@code altName}271* is named. If null, then the default initial context272* is implied.273*274* @see #getAltNameCtx275* @see #setAltName276*/277public void setAltNameCtx(Context altNameCtx) {278this.altNameCtx = altNameCtx;279}280281282/**283* Use serialVersionUID from JNDI 1.1.1 for interoperability284*/285private static final long serialVersionUID = 1219724816191576813L;286}287288289