// **********************************************************************
//
// Copyright (c) 2002
// IONA Technologies, Inc.
// Waltham, MA, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef OBEventChannelFactory_idl
#define OBEventChannelFactory_idl

#include <OB/CosEventChannelAdmin.idl>
#include <OB/OBEventReceiver.idl>

#pragma prefix "ooc.com"

/**
  *
  * This module contains the interface for an event channel factory
  * object as well as the common data types used by all
  * event channel factories.
  *
  **/
module OBEventChannelFactory
{

/**
  * 
  * Alias for a channel identifier.  The identified event channel is a
  * persistent object reference.
  *
  **/
typedef string ChannelId;

/**
  *
  * Alias for a sequence of channel identifiers.
  *
  **/
typedef sequence<ChannelId> ChannelIdSeq;

/**
  *
  * An event channel already exists.
  *
  **/
exception ChannelAlreadyExists
{
};

/**
  *
  * The requested event channel does not exist.
  *
  **/
exception ChannelNotAvailable
{
};

/**
  *
  * The interface for an event channel factory object, which provides
  * operations for the creation and retrieval of event channels.
  *
  **/
interface EventChannelFactory
{ 
    /**
      *
      * Creates and returns an event channel, which is a persistent
      * object reference.
      *
      * @param id The channel identifier identifying the new event channel.
      *
      * @return The event channel.
      *
      * @exception ChannelAlreadyExists An event channel identified by
      * <code>id</code> already exists.
      *
      **/
    CosEventChannelAdmin::EventChannel create_channel(in ChannelId id)
	raises(ChannelAlreadyExists);

    /**
      *
      * Creates and returns an event channel, which is a persistent
      * object reference.
      *
      * @param id The channel identifier identifying the new event channel.
      *
      * @param receiver The event receiver associated with the new event
      * channel.
      *
      * @return The event channel.
      *
      * @exception ChannelAlreadyExists An event channel identified by
      * <code>id</code> already exists.
      *
      **/
    CosEventChannelAdmin::EventChannel create_channel_with_receiver(
	    in ChannelId id,
	    in OB::EventReceiver receiver)
	raises(ChannelAlreadyExists);

    /**
      *
      * Retrieves an event channel object, which is a persistent
      * object reference.
      *
      * @param id The channel identifier of the event channel to retrieve.
      *
      * @return The event channel.
      *
      * @exception ChannelNotAvailable The requested event channel
      * identified by the <code>id</code> doesn't exist.
      *
      **/
    CosEventChannelAdmin::EventChannel get_channel_by_id(in ChannelId id)
        raises(ChannelNotAvailable);

    /**
      *
      * Returns a sequence of channel identifiers identifying available
      * event channels.
      *
      * @return The sequence of channel identifiers.
      *
      **/
    ChannelIdSeq get_channels();

    /**
      *
      * Shutdown the event service.
      *
      **/
    void shutdown();
};

};

#endif
