#ifndef _PortableGroup_IDL_
#define _PortableGroup_IDL_

#ifdef _PRE_3_0_COMPILER_
#pragma prefix "omg.org"
#include <PortableServer.idl>// CORBA 3.0, Chapter 11
#include <CosNaming.idl>// 98-10-19.idl
#include <IOP.idl>// from 98-03-01.idl
#include "GIOP.idl"// from 98-03-01.idl
#include <orb.idl>
#else
import ::IOP;
import ::GIOP;
import ::CORBA;
import ::PortableServer::POA;
#endif //_PRE_3_0_COMPILER_



module PortableGroup
{
#ifndef _PRE_3_0_COMPILER_
   typeprefix PortableGroup "omg.org";
#endif // _PRE_3_0_COMPILER_

// Was GroupInfo in spec but TagGroupTaggedComponent in Consolidated IDL.
// TAO also uses the latter form.
//    struct GroupInfo //tag=TAG_GROUP
//    {
//       Version group_version;
//       GroupDomainId group_domain_id;
//       ObjectGroupId object_group_id;
//       ObjectGroupRefVersion object_group_ref_version;
//    };

//    typedef sequence<octet> GroupIIOPProfile; //tag=TAG_GROUP_IIOP

   // Specification for Interoperable Object Group References
   typedef GIOP::Version Version;
   typedef string GroupDomainId;
   typedef unsigned long long ObjectGroupId;
   typedef unsigned long ObjectGroupRefVersion;

   struct TagGroupTaggedComponent { // tag = TAG_GROUP;
      GIOP::Version group_version;
      GroupDomainId group_domain_id;
      ObjectGroupId object_group_id;
      ObjectGroupRefVersion object_group_ref_version;
   };

    typedef sequence <octet> GroupIIOPProfile; // tag = TAG_GROUP_IIOP

   // Specification of Common Types and Exceptions
   // for GroupManagement
   interface GenericFactory;
   typedef CORBA::RepositoryId TypeId;
   typedef Object ObjectGroup;
   typedef CosNaming::Name Name;
   typedef any Value;

   struct Property {
      Name nam;
      Value val;
   };

   typedef sequence<Property> Properties;
   typedef Name Location;
   typedef sequence<Location> Locations;
   typedef Properties Criteria;

   struct FactoryInfo {
      GenericFactory the_factory;
      Location the_location;
      Criteria the_criteria;
   };
   typedef sequence<FactoryInfo> FactoryInfos;
   typedef long MembershipStyleValue;

   const MembershipStyleValue MEMB_APP_CTRL = 0;
   const MembershipStyleValue MEMB_INF_CTRL = 1;

   typedef unsigned short InitialNumberReplicasValue;
   typedef unsigned short MinimumNumberReplicasValue;

   exception InterfaceNotFound {};
   exception ObjectGroupNotFound {};
   exception MemberNotFound {};
   exception ObjectNotFound {};
   exception MemberAlreadyPresent {};
   exception BadReplicationStyle {};
   exception ObjectNotCreated {};
   exception ObjectNotAdded {};
   exception UnsupportedProperty {
      Name nam;
   };
   exception InvalidProperty {
      Name nam;
      Value val;
   };
   exception NoFactory {
      Location the_location;
      TypeId type_id;
   };
   exception InvalidCriteria {
      Criteria invalid_criteria;
   };
   exception CannotMeetCriteria {
      Criteria unmet_criteria;
   };

   // Specification of PropertyManager Interface
   interface PropertyManager {
      void set_default_properties
         (in Properties props)
         raises (InvalidProperty, UnsupportedProperty);
      Properties get_default_properties();
      void remove_default_properties
         (in Properties props)
         raises (InvalidProperty, UnsupportedProperty);
      void set_type_properties
         (in TypeId type_id, in Properties overrides)
         raises (InvalidProperty, UnsupportedProperty);
      Properties get_type_properties(in TypeId type_id);
      void remove_type_properties
         (in TypeId type_id, in Properties props)
         raises (InvalidProperty, UnsupportedProperty);
      void set_properties_dynamically
         (in ObjectGroup object_group, in Properties overrides)
         raises
         (ObjectGroupNotFound,
          InvalidProperty,
          UnsupportedProperty);
      Properties get_properties
         (in ObjectGroup object_group)
         raises(ObjectGroupNotFound);
   }; // endPropertyManager

   // Specification of ObjectGroupManager Interface
   interface ObjectGroupManager {
      ObjectGroup create_member
      (in ObjectGroup object_group,
       in Location the_location,
       in TypeId type_id,
       in Criteria the_criteria)
         raises
         (ObjectGroupNotFound,
          MemberAlreadyPresent,
          NoFactory,
          ObjectNotCreated,
          InvalidCriteria,
          CannotMeetCriteria);
      ObjectGroup add_member
      (in ObjectGroup object_group,
       in Location the_location,
       in Object member)
         raises

         (ObjectGroupNotFound,
          CORBA::INV_OBJREF,
          MemberAlreadyPresent,
          ObjectNotAdded);
      ObjectGroup remove_member
      (in ObjectGroup object_group,
       in Location the_location)
         raises
         (ObjectGroupNotFound, MemberNotFound);
      Locations locations_of_members
         (in ObjectGroup object_group) raises(ObjectGroupNotFound);
      ObjectGroupId get_object_group_id
         (in ObjectGroup object_group) raises(ObjectGroupNotFound);
      ObjectGroup get_object_group_ref
         (in ObjectGroup object_group) raises(ObjectGroupNotFound);
      Object get_member_ref
      (in ObjectGroup object_group,
       in Location loc)
         raises(ObjectGroupNotFound, MemberNotFound);
   }; // end ObjectGroupManager

   // Specification of GenericFactory Interface
   interface GenericFactory {
      typedef any FactoryCreationId;
      Object create_object
      (in TypeId type_id,
       in Criteria the_criteria,
       out FactoryCreationId factory_creation_id)
         raises
         (NoFactory,
          ObjectNotCreated,
          InvalidCriteria,
          InvalidProperty,
          CannotMeetCriteria);
      void delete_object
         (in FactoryCreationId factory_creation_id)
         raises (ObjectNotFound);
   }; // end GenericFactory



   exception NotAGroupObject {};

   typedef sequence <PortableServer::ObjectId> IDs;

   local interface GOA : PortableServer::POA {
      PortableServer::ObjectId
      create_id_for_reference(in Object the_ref)
         raises (NotAGroupObject);
      IDs
      reference_to_ids (in Object the_ref)
         raises (NotAGroupObject);
      void
      associate_reference_with_id
         (in Object ref, in PortableServer::ObjectId oid)
         raises(NotAGroupObject);
      void
      disassociate_reference_with_id
         (in Object ref, in PortableServer::ObjectId oid)
         raises(NotAGroupObject);
   }; // end interface GOA
}; // end PortableGroup
#endif // for #ifndef _PortableGroup_IDL_
