//---------------------------------------------------------------------------
// Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 1997, 1998, 1999
// All Rights Reserved.
//
// The software contained on this media is the property of the DSTC Pty
// Ltd.  Use of this software is strictly in accordance with the
// license agreement in the accompanying LICENSE.HTML file.  If your
// distribution of this software does not contain a LICENSE.HTML file
// then you have no rights to use this software in any manner and
// should contact DSTC at the address below to determine an appropriate
// licensing arrangement.
// 
//      DSTC Pty Ltd
//      Level 7, GP South
//      Staff House Road
//      University of Queensland
//      St Lucia, 4072
//      Australia
//      Tel: +61 7 3365 4310
//      Fax: +61 7 3365 4311
//      Email: enquiries@dstc.edu.au
// 
// This software is being provided "AS IS" without warranty of any
// kind.  In no event shall DSTC Pty Ltd be liable for damage of any
// kind arising out of or in connection with the use or performance of
// this software.
//
// Project:      Distributed Environment
// File:         $Source: /projects/fnorb/Fnorb-1.1/cos/naming/RCS/CosNaming.idl,v $
// Version:      @(#)$RCSfile: CosNaming.idl,v $ $Revision: 1.3 $
//
//---------------------------------------------------------------------------

//
// The CosNaming Module.
//
#pragma prefix "omg.org"

module CosNaming
{
	typedef string Istring;
	struct NameComponent {
		Istring id;
		Istring kind;
	};

	typedef sequence<NameComponent> Name;

	enum BindingType {nobject, ncontext};

	struct Binding {
		Name binding_name;
		BindingType binding_type;
	};

	typedef sequence<Binding> BindingList;


	interface BindingIterator;


	interface NamingContext {

		enum NotFoundReason {missing_node, not_context, not_object};

		exception NotFound {
			NotFoundReason why;
			Name rest_of_name;
		};

		exception CannotProceed {
			NamingContext cxt;
			Name rest_of_name;
		};

		exception InvalidName {};
		exception AlreadyBound {};
		exception NotEmpty {};

		void bind(in Name n, in Object obj)
		    raises(NotFound, CannotProceed, InvalidName, AlreadyBound);

		void rebind(in Name n, in Object obj)
		    raises(NotFound, CannotProceed, InvalidName);

		void bind_context(in Name n, in NamingContext nc)
		    raises(NotFound, CannotProceed, InvalidName, AlreadyBound);

		void rebind_context(in Name n, in NamingContext nc)
		    raises(NotFound, CannotProceed, InvalidName);

		Object resolve (in Name n)
		    raises(NotFound, CannotProceed, InvalidName);

		void unbind(in Name n)
		    raises(NotFound, CannotProceed, InvalidName);

		NamingContext new_context();

		NamingContext bind_new_context(in Name n)
		    raises(NotFound, AlreadyBound, CannotProceed, InvalidName);

		void destroy( )
		    raises(NotEmpty);

		void list(in unsigned long how_many,
			  out BindingList bl, out BindingIterator bi);
	};

	interface BindingIterator {
		boolean next_one(out Binding b);
		boolean next_n(in unsigned long how_many,
			       out BindingList bl);
		void destroy();
    	};
};
