//File: CosLifeCycle.idl
//Part of the LifeCycle Service
// Note: if your IDL compiler does not yet support the 
//   CORBA 2.3 Feature "Escaped Identifiers" (which provides 
//   for the addition of new keywords to IDL, compile this 
//   module with the preprocessor definition 
//   "NO_ESCAPED_IDENTIFIERS". With many compilers this 
//   would be done a qualifier on the command line, 
//   something like -DNO_ESCAPED_IDENTIFIERS
//OMG File: 98-10-15

#ifndef _COS_LIFE_CYCLE_IDL_
#define _COS_LIFE_CYCLE_IDL_

#ifdef _PRE_3_0_COMPILER_
#include <CosNaming.idl>
#pragma prefix "omg.org"
#else
import ::CosNaming;
#endif // _PRE_3_0_COMPILER_

module CosLifeCycle{

#ifndef _PRE_3_0_COMPILER_
	typeprefix CosLifeCycle "omg.org";
#endif // _PRE_3_0_COMPILER_

	typedef CosNaming::Name Key; 
	typedef Object _Factory;
	typedef sequence <_Factory> Factories;
	typedef struct NVP {	 
		CosNaming::Istring	name; 
		any 				value; 
	} NameValuePair;
	typedef sequence <NameValuePair> Criteria;

	exception NoFactory {
		Key search_key;
	};
	exception NotCopyable { string reason; };
	exception NotMovable { string reason; };
	exception NotRemovable { string reason; };
	exception InvalidCriteria{ Criteria invalid_criteria; };
	exception CannotMeetCriteria { Criteria unmet_criteria;	};

	interface FactoryFinder {
		Factories find_factories(in Key factory_key)
			raises(NoFactory);
	};

	interface LifeCycleObject {
		LifeCycleObject copy(in FactoryFinder there, 
							 in Criteria the_criteria)
			raises(NoFactory, NotCopyable, InvalidCriteria,
				 CannotMeetCriteria);
		void move(in FactoryFinder there, 
				  in Criteria the_criteria)
			raises(NoFactory, NotMovable, InvalidCriteria,
				 CannotMeetCriteria);
		void remove()
			raises(NotRemovable);
	};

	interface GenericFactory {		
#ifdef NO_ESCAPED_IDENTIFIERS
		boolean supports(in Key k);
#else
		boolean _supports(in Key k);
#endif
		Object create_object(			
				in Key 			k, 
				in Criteria		the_criteria) 				
			raises (NoFactory, InvalidCriteria, 										
				CannotMeetCriteria);
	};
};
#endif /* ifndef _COS_LIFE_CYCLE_IDL_ */
