// -*- IDL -*-

//=============================================================================
/**
 *  @file    PortableGroup.idl
 *
 *  PortableGroup.idl,v 1.6 2002/12/13 21:01:33 ossama Exp
 */
//=============================================================================

#ifndef _PORTABLEGROUP_IDL_
#define _PORTABLEGROUP_IDL_

#include <CosNaming.idl>
#include <tao/IOP.pidl>
#include <tao/GIOP.pidl>
#include <orb.idl>

#pragma prefix "omg.org"

module PortableGroup {

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

  struct TagGroupTaggedComponent { // tag = TAG_GROUP;
    GIOP::Version component_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 Group Management
  interface GenericFactory;

  typedef CORBA::RepositoryId _TypeId;
  typedef Object ObjectGroup;
  typedef sequence<ObjectGroup> ObjectGroups;
  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 FactoryInfos FactoriesValue;
  typedef unsigned short InitialNumberMembersValue;
  typedef unsigned short MinimumNumberMembersValue;

  exception InterfaceNotFound {};
  exception ObjectGroupNotFound {};
  exception MemberNotFound {};
  exception ObjectNotFound {};
  exception MemberAlreadyPresent {};
  exception ObjectNotCreated {};
  exception ObjectNotAdded {};
  exception UnsupportedProperty {
    Name nam;
    Value val;
  };

  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,
              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);

    ObjectGroups groups_at_location (in Location the_location);

    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

}; // end PortableGroup

#endif  /* _PORTABLEGROUP_IDL_ */
