186 Name nm = (Name)(remain.clone());
187 try {
188 nm.add("");
189 } catch (InvalidNameException e) {
190 // ignore; can't happen for composite name
191 }
192 setErrorAux(resObj, nm);
193 }
194
195 /**
196 * Form that accepts a String name instead of a Name name.
197
198 * @param resObj The possibly null object that was resolved to.
199 * @param remain The possibly String remaining name.
200 *
201 * @see #setErrorNNS(java.lang.Object, javax.naming.Name)
202 */
203 public void setErrorNNS(Object resObj, String remain) {
204 CompositeName rname = new CompositeName();
205 try {
206 if (remain != null && !remain.equals(""))
207 rname.add(remain);
208
209 rname.add("");
210 } catch (InvalidNameException e) {
211 // ignore, can't happen for composite name
212 }
213 setErrorAux(resObj, rname);
214 }
215
216 /**
217 * Sets this Continuation to indicated that an error has occurred
218 * and supply resolved information.
219 *
220 * This method is typically called by methods that have been
221 * given a name to process. It might process part of that name but
222 * encountered some error. Consequently, it would call setError()
223 * with the resolved object and the remaining name.
224 *<p>
225 * After this method is called, isContinuing() returns false.
226 *
230 public void setError(Object resObj, Name remain) {
231 if (remain != null)
232 remainingName = (Name)(remain.clone());
233 else
234 remainingName = null;
235
236 setErrorAux(resObj, remainingName);
237 }
238
239
240 /**
241 * Form that accepts a String name instead of a Name name.
242
243 * @param resObj The possibly null object that was resolved to.
244 * @param remain The possibly String remaining name.
245 *
246 * @see #setError(java.lang.Object, javax.naming.Name)
247 */
248 public void setError(Object resObj, String remain) {
249 CompositeName rname = new CompositeName();
250 if (remain != null && !remain.equals("")) {
251 try {
252 rname.add(remain);
253 } catch (InvalidNameException e) {
254 // ignore; can't happen for composite name
255 }
256 }
257 setErrorAux(resObj, rname);
258 }
259
260 private void setErrorAux(Object resObj, Name rname) {
261 remainingName = rname;
262 resolvedObj = resObj;
263 continuing = false;
264 }
265
266 private void setContinueAux(Object resObj,
267 Name relResName, Context currCtx, Name remain) {
268 if (resObj instanceof LinkRef) {
269 setContinueLink(resObj, relResName, currCtx, remain);
270 } else {
358 if (remain != null)
359 this.remainingName = (Name)(remain.clone());
360 else
361 this.remainingName = new CompositeName();
362
363 setContinueAux(obj, relResName, currCtx, remainingName);
364 }
365
366 /**
367 * String overload.
368 *
369 * @param obj The possibly null resolved object.
370 * @param relResName The non-null resolved name relative to currCtx.
371 * @param currCtx The non-null context from which relResName is to be resolved.
372 * @param remain The non-null remaining name.
373 * @see #setContinue(java.lang.Object, java.lang.String, javax.naming.Context, java.lang.String)
374 */
375 public void setContinue(Object obj, String relResName,
376 Context currCtx, String remain) {
377 CompositeName relname = new CompositeName();
378 if (!relResName.equals("")) {
379 try {
380 relname.add(relResName);
381 } catch (NamingException e){}
382 }
383
384 CompositeName rname = new CompositeName();
385 if (!remain.equals("")) {
386 try {
387 rname.add(remain);
388 } catch (NamingException e) {
389 }
390 }
391
392 setContinueAux(obj, relname, currCtx, rname);
393 }
394
395 /**
396 * %%% This method is kept only for backward compatibility. Delete when
397 * old implementations updated.
398 *
399 * Replaced by setContinue(obj, relResName, (Context)currCtx);
400 *
401 * @deprecated
402 */
403 @Deprecated
404 public void setContinue(Object obj, Object currCtx) {
405 setContinue(obj, null, (Context)currCtx);
|
186 Name nm = (Name)(remain.clone());
187 try {
188 nm.add("");
189 } catch (InvalidNameException e) {
190 // ignore; can't happen for composite name
191 }
192 setErrorAux(resObj, nm);
193 }
194
195 /**
196 * Form that accepts a String name instead of a Name name.
197
198 * @param resObj The possibly null object that was resolved to.
199 * @param remain The possibly String remaining name.
200 *
201 * @see #setErrorNNS(java.lang.Object, javax.naming.Name)
202 */
203 public void setErrorNNS(Object resObj, String remain) {
204 CompositeName rname = new CompositeName();
205 try {
206 if (remain != null && !remain.isEmpty())
207 rname.add(remain);
208
209 rname.add("");
210 } catch (InvalidNameException e) {
211 // ignore, can't happen for composite name
212 }
213 setErrorAux(resObj, rname);
214 }
215
216 /**
217 * Sets this Continuation to indicated that an error has occurred
218 * and supply resolved information.
219 *
220 * This method is typically called by methods that have been
221 * given a name to process. It might process part of that name but
222 * encountered some error. Consequently, it would call setError()
223 * with the resolved object and the remaining name.
224 *<p>
225 * After this method is called, isContinuing() returns false.
226 *
230 public void setError(Object resObj, Name remain) {
231 if (remain != null)
232 remainingName = (Name)(remain.clone());
233 else
234 remainingName = null;
235
236 setErrorAux(resObj, remainingName);
237 }
238
239
240 /**
241 * Form that accepts a String name instead of a Name name.
242
243 * @param resObj The possibly null object that was resolved to.
244 * @param remain The possibly String remaining name.
245 *
246 * @see #setError(java.lang.Object, javax.naming.Name)
247 */
248 public void setError(Object resObj, String remain) {
249 CompositeName rname = new CompositeName();
250 if (remain != null && !remain.isEmpty()) {
251 try {
252 rname.add(remain);
253 } catch (InvalidNameException e) {
254 // ignore; can't happen for composite name
255 }
256 }
257 setErrorAux(resObj, rname);
258 }
259
260 private void setErrorAux(Object resObj, Name rname) {
261 remainingName = rname;
262 resolvedObj = resObj;
263 continuing = false;
264 }
265
266 private void setContinueAux(Object resObj,
267 Name relResName, Context currCtx, Name remain) {
268 if (resObj instanceof LinkRef) {
269 setContinueLink(resObj, relResName, currCtx, remain);
270 } else {
358 if (remain != null)
359 this.remainingName = (Name)(remain.clone());
360 else
361 this.remainingName = new CompositeName();
362
363 setContinueAux(obj, relResName, currCtx, remainingName);
364 }
365
366 /**
367 * String overload.
368 *
369 * @param obj The possibly null resolved object.
370 * @param relResName The non-null resolved name relative to currCtx.
371 * @param currCtx The non-null context from which relResName is to be resolved.
372 * @param remain The non-null remaining name.
373 * @see #setContinue(java.lang.Object, java.lang.String, javax.naming.Context, java.lang.String)
374 */
375 public void setContinue(Object obj, String relResName,
376 Context currCtx, String remain) {
377 CompositeName relname = new CompositeName();
378 if (!relResName.isEmpty()) {
379 try {
380 relname.add(relResName);
381 } catch (NamingException e){}
382 }
383
384 CompositeName rname = new CompositeName();
385 if (!remain.isEmpty()) {
386 try {
387 rname.add(remain);
388 } catch (NamingException e) {
389 }
390 }
391
392 setContinueAux(obj, relname, currCtx, rname);
393 }
394
395 /**
396 * %%% This method is kept only for backward compatibility. Delete when
397 * old implementations updated.
398 *
399 * Replaced by setContinue(obj, relResName, (Context)currCtx);
400 *
401 * @deprecated
402 */
403 @Deprecated
404 public void setContinue(Object obj, Object currCtx) {
405 setContinue(obj, null, (Context)currCtx);
|