/**
 * @file Container_Base.idl
 * @author William R. Otte <wotte@dre.vanderbilt.edu>
 * $Id: Container_Base.idl 95550 2012-02-23 12:30:15Z johnnyw $
 * Container local interface.
 */

#include "tao/PortableServer/PortableServer_include.pidl"
#include "ccm/CCM_Home.idl"
#include "ccm/CCM_Cookie.idl"
#include "ccm/CCM_Base.idl"
#include "ccm/CCM_StandardConfigurator.idl"
#include "ccm/CCM_CCMException.idl"
#include "ciao/Base/CIAO_Exceptions.idl"
#include "ccm/CCM_Exceptions.idl"
#include "ccm/CCM_Navigation.idl"

module Components
{
  typeprefix Components "omg.org";

  module Deployment
  {
    typedef string UUID;
    typedef string Location;

    typedef FailureReason InvalidConfigurationReason;
    const InvalidConfigurationReason UnknownConfigValueName = 0;
    const InvalidConfigurationReason InvalidConfigValueType = 1;
    const InvalidConfigurationReason ConfigValueRequired = 2;
    const InvalidConfigurationReason ConfigValueNotExpected = 3;

    exception UnknownImplId
    {
    };

    exception InvalidLocation
    {
    };

    exception ImplEntryPointNotFound
    {
    };

    exception InstallationFailure
    {
      FailureReason reason;
    };
  };
};

module CIAO
{
  module Container_Types
  {
    enum OA_Type
    {
      COMPONENT_t,
      HOME_t,
      FACET_CONSUMER_t
    };
  };

  /**
   * @interface Container
   * @brief Internal container interfaces.
   *
   * This interface provides interfaces to two portions of the CIAO
   * container architecture:  The generic external container interface
   * created by the component server, and the component specific container
   * portions generated by the TAO_IDL compiler (the component servant)
   */
  local interface Container
  {
    // **** Methods used by external container
    Components::CCMHome install_home (in string primary_artifact,
                                      in string entry_point,
                                      in string servant_artifact,
                                      in string servant_entrypoint,
                                      in string name,
                                      in long open_mode);

    void uninstall_home (in Components::CCMHome homeptr);

    Components::CCMObject install_component (in string primary_artifact,
                                             in string entry_point,
                                             in string servant_artifact,
                                             in string servant_entrypoint,
                                             in string name,
                                             in long open_mode);

    void set_attributes (in Object name,
                         in Components::ConfigValues values);

    void activate_component (in Components::CCMObject name);

    void passivate_component (in Components::CCMObject name);

    void uninstall_component (in Components::CCMObject compptr);

    Components::Cookie connect_local_facet (
                              in ::Components::CCMObject provider_ref,
                              in string provider_port,
                              in ::Components::CCMObject user_ref,
                              in string user_port)
      raises (::Components::InvalidConnection,
              ::Components::AlreadyConnected);

    void disconnect_local_facet (
                              in Components::Cookie cookie,
                              in ::Components::CCMObject provider_ref,
                              in string provider_port,
                              in ::Components::CCMObject user_ref,
                              in string user_port)
      raises (::Components::InvalidConnection);

    // *** Methods used by component specific container portions
    Object install_servant (in PortableServer::Servant svnt,
                            in Container_Types::OA_Type type,
                            out PortableServer::ObjectId oid);

    void uninstall_servant (in PortableServer::Servant compptr,
                            in Container_Types::OA_Type type,
                            out PortableServer::ObjectId oid);

    Object generate_reference (in string obj_id,
                               in string repo_id,
                               in Container_Types::OA_Type type);

    Object get_objref (in PortableServer::Servant p);

    PortableServer::POA the_POA ();

    PortableServer::POA the_port_POA ();

    Object resolve_service_reference(in string service_id)
      raises (::Components::CCMException);

    void init (in string name);

    void fini ();
  };
};
