// **********************************************************************
//
// Copyright (c) 2002
// Object-Oriented Concepts, Inc.
// Waltham, MA, USA
//
// Copyright (c) 2002
// Object-Oriented Concepts GmbH
// Ettlingen, Germany
//
// All Rights Reserved
//
// **********************************************************************

#ifndef OB_NAMING_IDL
#define OB_NAMING_IDL

#include <OB/CosNaming.idl>
#include <OB/BindingListener.idl>

//
// The OOC Extended NamingService
//
#pragma prefix "ooc.com"

module CosNaming
{

/**********************************************************************
 *
 * An interface providing extensions to the standard CORBA naming
 * context interface. An extended naming context propagates changes
 * to a list of ContextListeners.
 *
 * @version 1.2
 * @author Uwe Seimet
 *
 **********************************************************************/

interface OBNamingContext : NamingContextExt
{
    union BindingUnion switch(BindingType)
    {
    case ncontext: CosNaming::NamingContext nc;
    case nobject: Object obj;
    };

    /**
     *
     * Extended binding with additional information
     *
     * @member binding_name The standard binding name.
     * @member bound_obj The bound object.
     * @member timestamp Time of last modification in seconds.
     *
     **/
    struct ExtendedBinding
    {
	Name binding_name;
        BindingUnion bound_obj;
	long timestamp;
    };

    /**
     *
     * A sequence of extended bindings.
     *
     **/
    typedef sequence<ExtendedBinding> ExtendedBindingList;

    /**
     *
     * Lists all extended bindings
     *
     * @return The list with all extended bindings for this context.
     *
     **/
    ExtendedBindingList list_extended();

    /**
     *
     * Rename context or objext.
     *
     * @param old_name The object's old name.
     * @param new_name The object's new name.
     * 
     **/
    void rename(in Name old_name, in Name new_name)
        raises(NamingContext::NotFound, NamingContext::AlreadyBound,
	       NamingContext::CannotProceed, NamingContext::InvalidName);

    /**
     *
     * Add listener
     *
     * @param listener A new listener to report changes to.
     *
     **/
    boolean add_listener(in BindingListener listener);

    /**
     *
     * Remove listener
     *
     * @param listener The listener to be removed.
     *
     **/
    boolean remove_listener(in BindingListener listener);

    /**
     *
     * Returns information on the callback mechanism status.
     *
     * @return True, if the callback mechanism is active, i. e.
     * if listeners are actually called back when a change occurs.
     *
     **/
    boolean callbacks_active();

}; // End interface OBNamingContext

}; // End module CosNaming

#endif
