/*
 * bonobo-context.idl: Exposes global bonobo functionality
 *
 * Author:
 *    Michael Meeks (michael@helixcode.com)
 *
 * Copyright (C) 1999, 2000  Helix Code, Inc.
 */

#ifndef BONOBO_CONTEXT_IDL
#define BONOBO_CONTEXT_IDL

#include "Bonobo_Storage.idl"
#include "Bonobo_Moniker.idl"

module Bonobo {

	interface MonikerContext : Unknown {
		/**
		 * getObject:
		 * @name:
		 * @repoId:
		 *
		 * Create and resolve a moniker
		 */
		Unknown getObject        (in string name,
					  in string repoId);

		/**
		 * createFromName:
		 * @name: parsed name of moniker
		 *
		 * creates a moniker from a display name
		 */
		Moniker createFromName   (in string name);

		/**
		 * getExtender:
		 * @monikerName: the name of the moniker to extend eg. 'file'
		 * @interface: the interface we want to resolve against
		 *
		 *  Finds an extender that can be plugged into the object
		 * namespace later to allow new interfaces to be exported.
		 * Used in implementing new monikers.
		 */
		MonikerExtender getExtender (in string monikerPrefix,
					     in string interfaceId);

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

	/*
	 * RunningContext: a live object tracker.
	 *
	 *  This interface is aggregated with an EventSource that
	 * fires: 'bonobo:last_unref' when all objects are released.
	 */
	interface RunningContext : Unknown {
		/**
		 * addObject:
		 * @object: a newly created object
		 *
		 * Adds an object to be tracked.
		 */
		void addObject    (in Object obj);

		/**
		 * removeObject:
		 * @object: an object about to be destroyed
		 *
		 * Removes an object from tracking.
		 */
		void removeObject (in Object obj);

		/**
		 * addKey:
		 * @key: a unique key
		 *
		 * Adds a stringified reference to be tracked.
		 */
		void addKey      (in string key);

		/**
		 * removeKey:
		 * @key: a unique key
		 *
		 * Removes a stringified reference from tracking
		 */
		void removeKey   (in string key);

		void atExitUnref (in Object obj);

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

#if 0
	interface ExceptionContext : Unknown {
		/**
		 * getText:
		 * @ex: an exception
		 *
		 *   translates the exception into a human
		 * readable string translated into the current
		 * locale.
		 */
		string getText (in exception ex);
	};

	interface StreamContext : Unknown {
		exception NotSeekable {};

		/**
		 * getTemp:
		 * 
		 * creates a temporary stream
		 */
		Stream getTemp ();

		/**
		 * sniffStream:
		 * @stream: a seekable stream
		 *
		 *  If the stream is not seekable, we return
		 * an exception without seeking, otherwise
		 * we sniff the stream, to see if it smells
		 * approximately like the suggested mime type.
		 */
		boolean sniffStream (in Stream stream,
				     in string mimeType)
			raises (NotSeekable);
	};
#endif
};

#endif /* BONOBO_CONTEXT_IDL */
