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

#ifndef BOOT_MANAGER_IDL
#define BOOT_MANAGER_IDL

#include <OB/POACommon.idl>
#include <OB/IOP.idl>

#pragma prefix "ooc.com"

module OB
{

/**
 *
 * Interface to manage bootstrapping of objects.
 * 
 **/
local interface BootLocator;
local interface BootManager
{
    /**
     *
     * This exception indicates that a binding has not been found.
     *
     **/
    exception NotFound
    {
    };
 
    /**
     *
     * This exception indicates that a binding already exists.
     *
     **/
    exception AlreadyExists
    {
    };

    /**
     *
     * Add a new binding to the internal table.
     *
     * @param oid The object id to bind.
     *
     * @param obj The object reference.
     *
     * @exception AlreadyExists Thrown if binding already exists.
     *
     **/
    void add_binding(in PortableServer::ObjectId oid, in Object obj)
        raises(AlreadyExists);

    /**
     *
     * Remove a binding from the internal table.
     *
     * @param oid The object id to remove.
     *
     * @exception NotFound Thrown if no binding found.
     *
     **/
    void remove_binding(in PortableServer::ObjectId oid)
        raises(NotFound);

    /**
     *
     * Set the BootLocator. The BootLocator is called when a binding
     * for an object id does not exist in the internal table.
     *
     * @param locator The BootLocator reference.
     *
     * @see BootLocator
     *
     **/
    void set_locator(in BootLocator locator);
};

/**
 *
 * Interface used by BootManager to assist in locating objects.
 *
 * @see BootManager
 * 
 **/
local interface BootLocator
{
    /**
     *
     * Locate the object coresponding to the given object id.
     *
     * @param oid The object id.
     *
     * @param obj The object reference to associate with the id.
     *
     * @param add Whether the binding should be added to the internal
     * table.
     *
     * @exception NotFound Raised if no binding found.
     *
     **/
    void locate(in PortableServer::ObjectId oid, 
    		out Object obj,
		out boolean add)
        raises(BootManager::NotFound);
};

}; // End module OB

#endif
