1 /*** 2 * Objectweb naming framework API 3 * Copyright (C) 2001-2002 France Telecom 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * Contact: architecture@objectweb.org 20 */ 21 22 package org.objectweb.naming; 23 24 /** 25 * A naming context creates and manages names. 26 */ 27 28 public interface NamingContext { 29 30 /** 31 * Creates a name in this naming context to designate the given object. The 32 * {@link Name#getNamingContext getNamingContext} method of the returned name 33 * will return this naming context, i.e., 34 * <tt>nc.export(o, hints).getNamingContext() == nc</tt>. 35 * 36 * @param o the object to be exported. This object may be a name of another 37 * naming context. 38 * @param hints optional additional information. 39 * @return a name that designates the given object in this naming context. 40 * @throws NamingException if the given object cannot be exported. 41 */ 42 43 Name export (Object o, Object hints) throws NamingException; 44 45 /** 46 * Decodes the given encoded name. The {@link Name#getNamingContext 47 * getNamingContext} method of the returned name will return this naming 48 * context, i.e., <tt>nc.decode(b).getNamingContext() == nc</tt>. 49 * 50 * @param b an array of byte containing the encoded form of a name created by 51 * this naming context. 52 * @return the decoded {@link Name} object. 53 * @throws NamingException if the given encoded name cannot be decoded (this 54 * is the case, for example, if the given encoded name was not created by 55 * this naming context). 56 */ 57 58 Name decode (byte[] b) throws NamingException; 59 } 60