2 * bonobo-moniker-file.c: Sample file-system based Moniker implementation
4 * This is the file-system based Moniker implementation.
7 * Michael Meeks (michael@helixcode.com)
9 * Copyright 2000, Helix Code, Inc.
13 #include <bonobo/bonobo-exception.h>
14 #include <bonobo/bonobo-storage.h>
15 #include <bonobo/bonobo-moniker-util.h>
17 #include "gnome-moniker-std.h"
18 #include "bonobo-stream-vfs.h"
19 #include "bonobo-storage-vfs.h"
22 bonobo_moniker_vfs_resolve (BonoboMoniker *moniker,
23 const Bonobo_ResolveOptions *options,
24 const CORBA_char *requested_interface,
25 CORBA_Environment *ev)
27 const char *fname = bonobo_moniker_get_name (moniker);
29 if (!strcmp (requested_interface, "IDL:Bonobo/Stream:1.0")) {
32 stream = BONOBO_OBJECT (bonobo_stream_vfs_open (
33 fname, Bonobo_Storage_READ, ev));
36 return CORBA_OBJECT_NIL;
39 g_warning ("Failed to open stream '%s'", fname);
40 CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
41 ex_Bonobo_Moniker_InterfaceNotFound, NULL);
42 return CORBA_OBJECT_NIL;
44 return CORBA_Object_duplicate (BONOBO_OBJREF (stream), ev);
47 else if (!strcmp (requested_interface, "IDL:Bonobo/Storage:1.0")) {
48 BonoboObject *storage;
50 storage = BONOBO_OBJECT (bonobo_storage_vfs_open (
51 fname, Bonobo_Storage_READ, ev));
54 return CORBA_OBJECT_NIL;
57 g_warning ("Failed to open storage '%s'", fname);
58 CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
59 ex_Bonobo_Moniker_InterfaceNotFound, NULL);
60 return CORBA_OBJECT_NIL;
63 return CORBA_Object_duplicate (BONOBO_OBJREF (storage), ev);
66 return bonobo_moniker_use_extender (
67 "OAFIID:Bonobo_MonikerExtender_stream",
68 moniker, options, requested_interface, ev);