/*
 * bonobo-moniker.idl: Implements an object naming and resolution interface
 *
 * Copyright (C) 2000  Helix Code, Inc.
 *
 * Authors:
 *	Michael Meeks (michael@helixcode.com)
 *	Ettore Perazzoli (ettore@helixcode.com)
 */

#ifndef BONOBO_MONIKER_IDL
#define BONOBO_MONIKER_IDL

#include <Bonobo_Activation_types.idl>
#include "Bonobo_Unknown.idl"

module Bonobo {

	typedef long ResolveFlag;
	const ResolveFlag MONIKER_ALLOW_USER_INTERACTION = 1;

	struct ResolveOptions {
		ResolveFlag  flags;
		long         timeout; /* in ms */
	};

	interface Moniker : Bonobo::Unknown {
		exception InterfaceNotFound {};
		exception TimeOut           {};
		exception InvalidSyntax     {};
		exception UnknownPrefix     {};

		/**
		 * getParent:
		 *
		 * get the parent moniker.
		 */
		Moniker getParent ();

		/**
		 * setParent:
		 * @parent: parent moniker
		 * 
		 * sets the parent moniker.
		 */
		void setParent (in Moniker parent);

		/**
		 * getName:
		 * 
		 * Returns a human readable representation of the Moniker
		 */
		string  getName ()
			raises (InvalidSyntax);

 		/**
 		 * setName:
 		 * @name: the display name
 		 *
 		 * set the name of the moniker. This method parses the whole
		 * name and constructs the moniker chain.
 		 */
 		void setName (in string name)
			raises (InvalidSyntax, UnknownPrefix);
 		
		/**
		 * resolve:
		 * @options: resolution options
		 * @inferface: what interface we want from the result
		 *
		 * Resolves a moniker; this returns a reference to the
		 * activated object described by the moniker
		 */
		Unknown resolve            (in ResolveOptions options,
					    in string         requestedInterface)
			raises (InterfaceNotFound,
				TimeOut,
				GeneralError);

		/**
		 * equal:
		 * @name: the name of another moniker
		 *
		 *  Compares the full moniker with this @name,
		 * returns 0 if not equal, else the number of chars swallowed
		 * by the compare.
		 */
		long    equal              (in string name);

		void unImplemented1 ();
		void unImplemented2 ();
	};

        interface MonikerExtender : Bonobo::Unknown {
		/**
		 * resolve:
		 * @m: the moniker we are about to extend
		 * @options: resolve options
		 * @name: the name of 'm' by itself eg. 'file:/tmp/a'
		 * @requested_interface: the interface we want to get back
		 *
		 *  The interface for a later extension to a moniker that allows it
		 * to be resolved against new and exotic interfaces.
		 *
		 * Returns: The interface requested, or CORBA_OBJECT_NIL.
		 */
                Unknown resolve (in Moniker        m,
				 in ResolveOptions options,
                                 in string         name,
                                 in string         requestedInterface)
			raises (Moniker::InterfaceNotFound,
				Moniker::TimeOut,
				GeneralError);

		void unImplemented1 ();
		void unImplemented2 ();
		void unImplemented3 ();
		void unImplemented4 ();
        };
};

#endif /* BONOBO_MONIKER_IDL */
