/* * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * Provides the classes and interfaces for accessing naming services. * *
* This package defines the naming operations of the Java Naming and * Directory Interface (JNDI). * JNDI provides naming and directory functionality to applications * written in the Java programming language. It is designed to be * independent of any specific naming or directory service * implementation. Thus a variety of services--new, emerging, and * already deployed ones--can be accessed in a common way. * * *
* This package defines the notion of a context, represented * by the {@code Context} interface. * A context consists of a set of name-to-object bindings. * {@code Context} is the core interface for looking up, binding, unbinding, * and renaming objects, and for creating and destroying subcontexts. *
* {@code lookup()} is the most commonly used operation. * You supply {@code lookup()} * the name of the object you want * to look up, and it returns the object bound to that name. * For example, the following code fragment looks up * a printer and sends a document to the printer object * to be printed: * * {@snippet : * Printer printer = (Printer)ctx.lookup("treekiller"); * printer.print(report); * } * *
* Every naming method in the {@code Context} * interface has two * overloads: one that accepts a * {@code Name} argument and one that accepts a string name. * {@code Name} is an interface that represents a generic * name--an ordered sequence of zero of more components. * For these methods, {@code Name} can be used to represent a * composite name ({@code CompositeName}) * so that you can name an object using a name which spans multiple namespaces. *
* The overloads that accept {@code Name} * are useful for applications that need to manipulate names: composing * them, comparing components, and so on. * The overloads that accept string names are likely to be more useful * for simple applications, such as those that simply read in a name * and look up the corresponding object. * *
* The {@code Binding} class is actually a subclass of * {@code NameClassPair}, which consists * simply of the object's name and the object's class name. * The {@code NameClassPair} is useful when you only want * information about the object's class and do not want to * pay the extra cost of getting the object. * *