Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/naming/CannotProceedException.java
38829 views
/*1* Copyright (c) 1999, 2004, 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 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</code>. It is a composite name.96* If null, then no name is specified.97* See the <code>javax.naming.spi.ObjectFactory.getObjectInstance</code>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</code> is specified. If null, then the default initial115* context is implied.116* See the <code>javax.naming.spi.ObjectFactory.getObjectInstance</code>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*/129protected Context altNameCtx = null;130131/**132* Constructs a new instance of CannotProceedException using an133* explanation. All unspecified fields default to null.134*135* @param explanation A possibly null string containing additional136* detail about this exception.137* If null, this exception has no detail message.138* @see java.lang.Throwable#getMessage139*/140public CannotProceedException(String explanation) {141super(explanation);142}143144/**145* Constructs a new instance of CannotProceedException.146* All fields default to null.147*/148public CannotProceedException() {149super();150}151152/**153* Retrieves the environment that was in effect when this exception154* was created.155* @return Possibly null environment property set.156* null means no environment was recorded for this exception.157* @see #setEnvironment158*/159public Hashtable<?,?> getEnvironment() {160return environment;161}162163/**164* Sets the environment that will be returned when getEnvironment()165* is called.166* @param environment A possibly null environment property set.167* null means no environment is being recorded for168* this exception.169* @see #getEnvironment170*/171public void setEnvironment(Hashtable<?,?> environment) {172this.environment = environment; // %%% clone it??173}174175/**176* Retrieves the "remaining new name" field of this exception, which is177* used when this exception is thrown during a rename() operation.178*179* @return The possibly null part of the new name that has not been resolved.180* It is a composite name. It can be null, which means181* the remaining new name field has not been set.182*183* @see #setRemainingNewName184*/185public Name getRemainingNewName() {186return remainingNewName;187}188189/**190* Sets the "remaining new name" field of this exception.191* This is the value returned by <code>getRemainingNewName()</code>.192*<p>193* <tt>newName</tt> is a composite name. If the intent is to set194* this field using a compound name or string, you must195* "stringify" the compound name, and create a composite196* name with a single component using the string. You can then197* invoke this method using the resulting composite name.198*<p>199* A copy of <code>newName</code> is made and stored.200* Subsequent changes to <code>name</code> does not201* affect the copy in this NamingException and vice versa.202*203* @param newName The possibly null name to set the "remaining new name" to.204* If null, it sets the remaining name field to null.205*206* @see #getRemainingNewName207*/208public void setRemainingNewName(Name newName) {209if (newName != null)210this.remainingNewName = (Name)(newName.clone());211else212this.remainingNewName = null;213}214215/**216* Retrieves the <code>altName</code> field of this exception.217* This is the name of the resolved object, relative to the context218* <code>altNameCtx</code>. It will be used during a subsequent call to the219* <code>javax.naming.spi.ObjectFactory.getObjectInstance</code> method.220*221* @return The name of the resolved object, relative to222* <code>altNameCtx</code>.223* It is a composite name. If null, then no name is specified.224*225* @see #setAltName226* @see #getAltNameCtx227* @see javax.naming.spi.ObjectFactory#getObjectInstance228*/229public Name getAltName() {230return altName;231}232233/**234* Sets the <code>altName</code> field of this exception.235*236* @param altName The name of the resolved object, relative to237* <code>altNameCtx</code>.238* It is a composite name.239* If null, then no name is specified.240*241* @see #getAltName242* @see #setAltNameCtx243*/244public void setAltName(Name altName) {245this.altName = altName;246}247248/**249* Retrieves the <code>altNameCtx</code> field of this exception.250* This is the context relative to which <code>altName</code> is named.251* It will be used during a subsequent call to the252* <code>javax.naming.spi.ObjectFactory.getObjectInstance</code> method.253*254* @return The context relative to which <code>altName</code> is named.255* If null, then the default initial context is implied.256*257* @see #setAltNameCtx258* @see #getAltName259* @see javax.naming.spi.ObjectFactory#getObjectInstance260*/261public Context getAltNameCtx() {262return altNameCtx;263}264265/**266* Sets the <code>altNameCtx</code> field of this exception.267*268* @param altNameCtx269* The context relative to which <code>altName</code>270* is named. If null, then the default initial context271* is implied.272*273* @see #getAltNameCtx274* @see #setAltName275*/276public void setAltNameCtx(Context altNameCtx) {277this.altNameCtx = altNameCtx;278}279280281/**282* Use serialVersionUID from JNDI 1.1.1 for interoperability283*/284private static final long serialVersionUID = 1219724816191576813L;285}286287288