//
//   COMPONENT_NAME: somnm
//
//   ORIGINS: 27
//
//
//    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1994,1996 
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//
//#  @(#) 1.18 src/somnm/naming/xnaming.idl, somnm, som3.0 5/30/96 13:36:39 [12/22/96 21:32:13]

#ifndef xnaming_idl
#define xnaming_idl

#include <naming.idl>



module ExtendedNaming {

	//# forward declarations
	interface PropertyBindingIterator;
	interface PropertyIterator;
	interface IndexIterator;


	typedef sequence<CosNaming::Istring> IList;
	typedef struct PropertyBinding_struct {
		CosNaming::Istring property_name;
		boolean sharable;
	} PropertyBinding;
	typedef sequence<PropertyBinding> PropertyBindingList;

	typedef struct Property_struct {
		PropertyBinding binding ;
		any value;
	} Property;
	typedef sequence<Property> PropertyList;

	typedef struct IndexDescriptor_struct {
		CosNaming::Istring property_name;
		TypeCode property_type;
		unsigned long distance;
	} IndexDescriptor;
	typedef sequence<IndexDescriptor> IndexDescriptorList;

		//# support for iterators

	interface PropertyBindingIterator : SOMObject {
		boolean next_one (out PropertyBinding pb);
		// returns the next binding. If there are no more bindings
		// 'false' is returned

		
		boolean next_n (in unsigned long howMany, 
				out PropertyBindingList il);
		// returns at most the requested number of bindings

		void destroy();
		// destroys the iterator

		#ifdef __SOMIDL__
			implementation {
				releaseorder: next_one, next_n,
				destroy;
				
				next_n: caller_owns_parameters = "il";
				functionprefix = PB_;
				dllname = "somnmf.dll";
				majorversion = 3;
				minorversion = 0;
			};
		#endif //# __SOMIDL__ 

	}; 


	interface PropertyIterator : SOMObject {
		boolean next_one (out Property p);
		// returns the next binding. If there are no more bindings
		// 'false' is returned

		boolean next_n (in unsigned long howMany, 
				out PropertyList pl);
		// returns at most the requested number of bindings

		void destroy();
		// destroys the iterator

		#ifdef __SOMIDL__
			implementation {
				releaseorder: next_one, next_n,
				destroy;
				somInit: override;
				functionprefix = P_;
				dllname = "somnmf.dll";
				majorversion = 3;
				minorversion = 0;
			};
		#endif //# __SOMIDL__ 

	};  

	interface IndexIterator : SOMObject {
		boolean next_one (out IndexDescriptor p);
		// returns the next binding. If there are no more bindings
		// 'false' is returned

		boolean next_n (in unsigned long howMany, 
				out IndexDescriptorList il);
		// returns at most the requested number of bindings

		void destroy();
		// destroys the iterator

		#ifdef __SOMIDL__
			implementation {
				releaseorder: next_one, next_n,
				destroy;
				functionprefix = In_;
				dllname = "somnmf.dll";
				majorversion = 3;
				minorversion = 0;
			};

		#endif //# __SOMIDL__ 
	};  


	interface ExtendedNamingContext : CosNaming::NamingContext {

		typedef string Constraint;
		typedef char * Strings;

		exception InvalidPropertyName {};
		exception NotSupported {};
		exception ConflictingPropertyName {};
		exception PropertyNotFound {
		    sequence <CosNaming::Istring> property_name;
		};
		exception NonSharableProperties {};
		exception PropertiesNotShared{};
		exception IllegalConstraintExpression{};
		exception BindingNotFound{};

		readonly attribute sequence<TypeCode> allowed_object_types;
		// A list of types of objects that can be bound
		// into this ENC. Empty implies no restrictions


		readonly attribute sequence<TypeCode> allowed_property_types;
		// a list of the types of the properties that can be
		// added to the entries in this ENC. Empty indicates
		// no restrictions

		readonly attribute sequence<CosNaming::Istring> allowed_property_names;
		// a list of names of properties that can be added 
		// to the entries in this ENC. Empty implies no
		// restrictions

		readonly attribute sequence<TypeCode> shared_property_types;
		// a list of types of properties that can be shared 
		// Empty implies no restrictions

		readonly attribute sequence<CosNaming::Istring> shared_property_names;
		// a list of names of properties that can be shared 
		// Empty implies no restrictions

		unsigned short get_features_supported();
		// Gets a bit vector that this ENC implementation supports
		// 0 properties
		// 1 shared properties
		// 2 searching
		// 3 indexing
		// 4 restrictions on object types
		// 5 restrictions on property types
		// 6 restrictions on property names
		// 7 - 15 not used

		void add_property(in CosNaming::Name n, 
				in ExtendedNaming::Property prop) 
			raises (CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				InvalidPropertyName,
				NotSupported,
				ConflictingPropertyName);
		// adds/sets property prop with name n in target enc.
		// Name n need not be previously bound. If n has no 
		// binding, then it is bound to a null object. If 
		// property already exists, replaces old value

		void add_properties (in CosNaming::Name n, 
				in ExtendedNaming::PropertyList props)
			raises (CosNaming::NamingContext::InvalidName, 
				CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				InvalidPropertyName,
				NotSupported,
				ConflictingPropertyName);
		// variation of add property. adds/sets more than
		// one property


		void bind_with_properties (in CosNaming::Name n, 
				in SOMObject obj, 
				in ExtendedNaming::PropertyList prop)
			raises (CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::AlreadyBound,
				CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				InvalidPropertyName,
				NotSupported,
				ConflictingPropertyName);
		// combination of add_properties and bind
		// adds/sets property prop with name n in target enc.
		// Name n need not be previously bound. If n has no 
		// binding, then it is bound to a null object. If 
		// property already exists, replaces old value

		void bind_context_with_properties (in CosNaming::Name n, 
				in ExtendedNamingContext obj,
				in ExtendedNaming::PropertyList props)
			raises (CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::CannotProceed,
				CosNaming::NamingContext::AlreadyBound,
				CosNaming::NamingContext::NotFound,
				InvalidPropertyName,
				NotSupported,
				ConflictingPropertyName);
	 	// Names an object that is a naming context. Also 
	 	// associates properties with the name object binding.
	 	// Naming contexts bound using this operation participate
	 	// in name resolution when compound names are resolved.
	 	// Cannot bind a nil naming context.

		void rebind_with_properties (in CosNaming::Name n, 
				in SOMObject obj,
				in ExtendedNaming::PropertyList prop)
			raises (CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::NotFound,
				InvalidPropertyName,
				NotSupported,
				ConflictingPropertyName);
		// combination of rebind and add_properties
		
		void rebind_context_with_properties (in CosNaming::Name n, 
				in ExtendedNamingContext obj,
				in ExtendedNaming::PropertyList props)
			raises (CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::NotFound,
				InvalidPropertyName,
				NotSupported,
				ConflictingPropertyName);
	
		void share_property (in CosNaming::Name target_n, 
				in ExtendedNamingContext source_enc,
				in CosNaming::Name source_n, 
				in CosNaming::Istring pname)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				CosNaming::NamingContext::InvalidName,
				InvalidPropertyName,
				PropertyNotFound,
				ConflictingPropertyName,
				NotSupported);
		// Adds property to the binding indicated by target_n
		// of the target naming context that are shared 
		// with the binding indicated 
		// by source_n in source_enc. Logically, all enc's that share
		// properties are at the same level. 
		// If the property name is already defined as a local property, 
		// then ConflictingPropertyName is raised. If the property 
		// name is already defined as a shared property, then the 
		// property's source_n and source_enc are updated.


		void share_properties (in CosNaming::Name target_n, 
				in ExtendedNamingContext source_enc,
				in CosNaming::Name source_n, 
				in ExtendedNaming::IList pnames)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				InvalidPropertyName,
				ConflictingPropertyName,
				NotSupported);


		void unshare_property (in CosNaming::Name n, 
				in CosNaming::Istring property_name)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				InvalidPropertyName,
				PropertiesNotShared,
				NotSupported,
				ConflictingPropertyName);

		void unshare_properties (in CosNaming::Name n, 
				in ExtendedNaming::IList pnames)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::CannotProceed,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				InvalidPropertyName,
				PropertiesNotShared,
				NotSupported,
				ConflictingPropertyName);

		void list_properties (in CosNaming::Name n, 
				in unsigned long howMany,
				out PropertyBindingList pbl,
				out ExtendedNaming::PropertyBindingIterator rest)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::CannotProceed);
		// resolves name n in target enc and returns atmost
		// howMany property bindings. If more exist, an iterator
		// is returned that holds the remaining names

		void get_property (in CosNaming::Name n, 
				in CosNaming::Istring pn, 
				   out ExtendedNaming::Property prop)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				InvalidPropertyName,
				CosNaming::NamingContext::CannotProceed);
		// resolves the name n in target enc and returns the value 
		// associated with property pn


		void get_properties (in CosNaming::Name n,
				in unsigned long howMany,
				in ExtendedNaming::IList inames,
				out ExtendedNaming::PropertyList props,
				out ExtendedNaming::PropertyIterator rest)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				InvalidPropertyName,
				PropertyNotFound,
				CosNaming::NamingContext::CannotProceed);

		void get_all_properties (in CosNaming::Name n, 
				in unsigned long howMany,
				out ExtendedNaming::PropertyList props,
				out ExtendedNaming::PropertyIterator rest)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				CosNaming::NamingContext::CannotProceed);

		SOMObject resolve_with_property(
				in CosNaming::Name n, 
				in CosNaming::Istring prop,
				out any v)
			raises  (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				InvalidPropertyName,
				CosNaming::NamingContext::CannotProceed,
				PropertyNotFound);
		// combination of resolve and get_property


		SOMObject resolve_with_properties (in CosNaming::Name n, 
				in unsigned long howMany, 
				in ExtendedNaming::IList inames,
				out ExtendedNaming::PropertyList props,
				out ExtendedNaming::PropertyIterator rest)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				CosNaming::NamingContext::CannotProceed,
				InvalidPropertyName);

		SOMObject resolve_with_all_properties (in CosNaming::Name n, 
				in unsigned long howMany, 
				out ExtendedNaming::PropertyList props,
				out ExtendedNaming::PropertyIterator rest)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::CannotProceed
				);

		void remove_property (in CosNaming::Name n, 
				in CosNaming::Istring prop)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				InvalidPropertyName,
				CosNaming::NamingContext::CannotProceed,
				NotSupported);
		// resolves name n in target and removes property prop
		// If the property is a shared property, then the sharing
		// relationship between the physical enc and the property 
		// in severed. If the target enc happens to be the physical
		// owner of the property (if it is a shared property), 
		// then the property is moved to someother enc 
		// (logical owner) and the sharing relationship 
		// between the property and the physical enc is severed.


		void remove_properties (in CosNaming::Name n, 
				in ExtendedNaming::IList plist)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				PropertyNotFound,
				InvalidPropertyName,
				CosNaming::NamingContext::CannotProceed,
				NotSupported);
		// resolves name n in target and removes properties plist.
		// If a property is a shared property, then the sharing 
		// relationship between the physical enc and the property 
		// in severed. If the target enc happens to be the physical
		// owner of a shared property, then the property is moved to
		// someother enc (logical owner) and the 
		// sharing relationship  between the property 
		// and the physical enc is severed.


		void remove_all_properties (in CosNaming::Name n)
			raises (CosNaming::NamingContext::NotFound,
				CosNaming::NamingContext::InvalidName,
				CosNaming::NamingContext::CannotProceed,
				NotSupported);
		// resolves name n in target and removes all properties.
		// If a property is a shared property, then the sharing 
		// relationship between the physical enc and the property 
		// in severed. If the target enc happens to be the physical
		// owner of a shared property, then the property is moved to
		// someother enc (logical owner) and the sharing relationshi
		// between the property and the physical enc is severed.

		SOMObject find_any (in Constraint c, 
				in unsigned long distance)
			raises (IllegalConstraintExpression,
				CosNaming::NamingContext::CannotProceed,
				BindingNotFound,
				NotSupported);

		void find_all (in Constraint c,
			       in unsigned long distance ,
			       in unsigned long howMany,
			       out CosNaming::BindingList bl,
			       out CosNaming::BindingIterator bi)
			raises (IllegalConstraintExpression,
				CosNaming::NamingContext::CannotProceed,
				BindingNotFound,
				NotSupported);
		// Returns all binding names whose
		// properties satisfy Constraint "c".
		// It will search up to a depth of "distance"
		// for all bindings that satisfy the
		// given constraint. if distance is set to 0
                // this operation will only search the
                // targeted context. Up to how_many
                // name-object-bindings will be put into
                // the BindingList "bl". If more than how_many
                // objects are found to satifsy the
                // constraint, then the remaining
                // name-object-bindings are put into the
                // BindingIterator, "bi".

		void find_any_name_binding(in Constraint c,
				in unsigned long distance,
				out CosNaming::Binding bi)
			raises (NotSupported,
				CosNaming::NamingContext::CannotProceed,
				BindingNotFound,
				IllegalConstraintExpression);

		void add_index (in ExtendedNaming::IndexDescriptor i)
			raises (NotSupported);
		
		void list_indexes(in unsigned long howMany, 
				out ExtendedNaming::IndexDescriptorList il,
				out ExtendedNaming::IndexIterator rest)
			raises (NotSupported);

		void remove_index(in ExtendedNaming::IndexDescriptor i)
		  raises (CosNaming::NamingContext::NotFound,
			CosNaming::NamingContext::CannotProceed,
			 InvalidPropertyName,
			 ConflictingPropertyName);


	#ifdef __SOMIDL__
		implementation {
		   releaseorder: get_features_supported, 
			add_property, add_properties,
			bind_with_properties, bind_context_with_properties,
			rebind_with_properties, 
			rebind_context_with_properties,
			share_property, share_properties, unshare_property,
			unshare_properties, list_properties, get_property,
			get_properties, get_all_properties, 
			resolve_with_property, resolve_with_properties,
			resolve_with_all_properties, remove_property,
			remove_properties, remove_all_properties,
			find_any, find_all, add_index, list_indexes,
			remove_index, _get_allowed_object_types, 
			find_any_name_binding,
			_set_allowed_object_types, 
			_get_allowed_property_types,
			_set_allowed_property_types, 
			_get_allowed_property_names, 
			_set_allowed_property_names,
			_get_shared_property_names,
			_set_shared_property_names,
			_get_shared_property_types,
			_set_shared_property_types
			;

		functionprefix = ENC_;
		allowed_object_types: nodata;
		allowed_property_types: nodata;
		allowed_property_names: nodata;
		shared_property_names: nodata;
		shared_property_types: nodata;

		somDestruct :override;
		somDefaultInit: override, init;

		dllname = "somnmf.dll";
		majorversion = 3;
		minorversion = 0;

		};

	#endif //# __SOMIDL__ 

	}; 








};  

#endif 
