/* * bonobo-moniker-file.c: Sample file-system based Moniker implementation * * This is the file-system based Moniker implementation. * * Author: * Michael Meeks (michael@helixcode.com) * * Copyright 2000, Helix Code, Inc. */ #include #include #include #include #include #include "gnome-moniker-std.h" #include "bonobo-stream-vfs.h" #include "bonobo-storage-vfs.h" Bonobo_Unknown bonobo_moniker_vfs_resolve (BonoboMoniker *moniker, const Bonobo_ResolveOptions *options, const CORBA_char *requested_interface, CORBA_Environment *ev) { const char *fname = bonobo_moniker_get_name (moniker); if (!strcmp (requested_interface, "IDL:Bonobo/Stream:1.0")) { BonoboObject *stream; stream = BONOBO_OBJECT (bonobo_stream_vfs_open ( fname, Bonobo_Storage_READ, ev)); if (BONOBO_EX (ev)) return CORBA_OBJECT_NIL; if (!stream) { g_warning ("Failed to open stream '%s'", fname); CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Bonobo_Moniker_InterfaceNotFound, NULL); return CORBA_OBJECT_NIL; } return CORBA_Object_duplicate (BONOBO_OBJREF (stream), ev); } else if (!strcmp (requested_interface, "IDL:Bonobo/Storage:1.0")) { BonoboObject *storage; storage = BONOBO_OBJECT (bonobo_storage_vfs_open ( fname, Bonobo_Storage_READ, ev)); if (BONOBO_EX (ev)) return CORBA_OBJECT_NIL; if (!storage) { g_warning ("Failed to open storage '%s'", fname); CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Bonobo_Moniker_InterfaceNotFound, NULL); return CORBA_OBJECT_NIL; } return CORBA_Object_duplicate (BONOBO_OBJREF (storage), ev); } else return bonobo_moniker_use_extender ( "OAFIID:Bonobo_MonikerExtender_stream", moniker, options, requested_interface, ev); }