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

#ifndef OB_IMR_STATE_IDL
#define OB_IMR_STATE_IDL

#include <OB/OADProcessEndpoint.idl>
#include <OB/IMRTypes.idl>
#include <OB/PIORT.idl>

#pragma prefix "ooc.com"

/**
 *
 * The Implementation Repository.
 *
 **/
module IMR
{

interface ActiveState
{
    /**
     *
     * Called to update the server status
     *
     * @param id The server id
     * @param status The new server status
     *
     */
    void set_status(in string id, in ServerStatus status);

    /**
     *
     * Called when a POA is created
     *
     * @param state The POA state
     * @param poa_tmpl The POAs ORT
     * @return The IMRs ORT
     *
     * @exception NoSuchPOA If a record for the POA does not exist
     *
     */
    PortableInterceptor::ObjectReferenceTemplate
    poa_create(in POAStatus state, 
	       in PortableInterceptor::ObjectReferenceTemplate poa_tmpl)
	raises(NoSuchPOA);

    /**
     *
     * Called when POA Manager changes state.
     *
     * @param poas List of affected POAs
     * @param state The POA Manager state
     *
     */
    void poa_status_update(in POANameSeq poas, in POAStatus state);
};

interface Domain
{
    /**
     *
     * Called for automatic server registration
     *
     * @param name The server name
     * @param exec The server executable path
     * @param host The server host name
     *
     * @return Whether an entry already existed
     *
     */
    void registerServer(in string name, in string exec, in string host)
        raises(ServerAlreadyRegistered);

    /**
     *
     * Called to inform the IMR that the server has been started
     *
     * @param serverId The server id
     * @param instance The server instance
     * @param root_tmpl The RootPOA ORT
     * @param endpoint The ProcessControllerRegistrar for the process
     *
     */
    ActiveState
    startup(in string serverId,
            in string instance,
    	    in PortableInterceptor::ObjectReferenceTemplate root_tmpl,
	    out OAD::ProcessEndpointManager endpoint)
	raises(NoSuchServer, NoSuchOAD, OADNotRunning);
};

}; // End module IMR

#endif // OB_IMR_IDL
