// **********************************************************************
// CosLifeCycle
// **********************************************************************

#ifndef CosLifeCycle_IDL
#define CosLifeCycle_IDL

//
// The Compound Life Cycle Service
//


#include <mico/CosNaming.idl>

#pragma prefix "omg.org"

module CosLifeCycle
{
  // = TITLE
  //     CosLifeCycle
  //
  // = DESCRIPTION
  //     This idl file describes the life cycle service.
  //     The purpose of the life cycle service is to 
  
  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 
    {
      // = TITLE
      //   @@ Please fill in.
      // = DESCRIPTION
      //   @@ Please fill in.

      Factories find_factories (in Key factory_key)
        raises (NoFactory);
    };
  
  interface LifeCycleObject 
    {
      // = TITLE
      //   @@ Please fill in.
      // = DESCRIPTION
      //   @@ Please fill in.

      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 
    {
      // = TITLE
      //   @@ Please fill in.
      // = DESCRIPTION
      //   @@ Please fill in.

      boolean support (in Key k);
      Object create_object (in Key k, 
                            in Criteria the_criteria)
        raises (NoFactory, InvalidCriteria, CannotMeetCriteria);
    };
};

// Criteria, page 6-17:
/*
typedef struct NVP 
{
  CosNaming::Istring name;	
  any value;
} NameValuePair;

typedef sequence <NameValuePair> Criteria;
*/

#endif
