blob: b523836e267caa8229124558b02120f5116963fb [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26
27package javax.naming.spi;
28
29import javax.naming.Context;
30import javax.naming.Name;
31import javax.naming.NamingException;
32
33/**
34 * This interface represents an "intermediate context" for name resolution.
35 *<p>
36 * The Resolver interface contains methods that are implemented by contexts
37 * that do not support subtypes of Context, but which can act as
38 * intermediate contexts for resolution purposes.
39 *<p>
40 * A <tt>Name</tt> parameter passed to any method is owned
41 * by the caller. The service provider will not modify the object
42 * or keep a reference to it.
43 * A <tt>ResolveResult</tt> object returned by any
44 * method is owned by the caller. The caller may subsequently modify it;
45 * the service provider may not.
46 *
47 * @author Rosanna Lee
48 * @author Scott Seligman
49 * @since 1.3
50 */
51
52public interface Resolver {
53
54 /**
55 * Partially resolves a name. Stops at the first
56 * context that is an instance of a given subtype of
57 * <code>Context</code>.
58 *
59 * @param name
60 * the name to resolve
61 * @param contextType
62 * the type of object to resolve. This should
63 * be a subtype of <code>Context</code>.
64 * @return the object that was found, along with the unresolved
65 * suffix of <code>name</code>. Cannot be null.
66 *
67 * @throws javax.naming.NotContextException
68 * if no context of the appropriate type is found
69 * @throws NamingException if a naming exception was encountered
70 *
71 * @see #resolveToClass(String, Class)
72 */
73 public ResolveResult resolveToClass(Name name,
74 Class<? extends Context> contextType)
75 throws NamingException;
76
77 /**
78 * Partially resolves a name.
79 * See {@link #resolveToClass(Name, Class)} for details.
80 *
81 * @param name
82 * the name to resolve
83 * @param contextType
84 * the type of object to resolve. This should
85 * be a subtype of <code>Context</code>.
86 * @return the object that was found, along with the unresolved
87 * suffix of <code>name</code>. Cannot be null.
88 *
89 * @throws javax.naming.NotContextException
90 * if no context of the appropriate type is found
91 * @throws NamingException if a naming exception was encountered
92 */
93 public ResolveResult resolveToClass(String name,
94 Class<? extends Context> contextType)
95 throws NamingException;
96};