<HTML ><HEAD ><TITLE >BonoboMonikerExtender</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Libbonobo Reference Manual" HREF="index.html"><LINK REL="UP" TITLE="Libbonobo API Reference Manual" HREF="c4.html"><LINK REL="PREVIOUS" TITLE="bonobo-listener" HREF="libbonobo-bonobo-listener.html"><LINK REL="NEXT" TITLE="BonoboMonikerSimple" HREF="libbonobo-bonobo-moniker-simple.html"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" BGCOLOR="#000000" CELLPADDING="1" CELLSPACING="0" ><TR ><TH COLSPAN="4" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="5" >Libbonobo Reference Manual</FONT ></TH ></TR ><TR ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="left" ><A HREF="libbonobo-bonobo-listener.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><<< Previous Page</B ></FONT ></A ></TD ><TD WIDTH="25%" BGCOLOR="#0000C0" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="index.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Home</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#00C000" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="c4.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Up</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="right" ><A HREF="libbonobo-bonobo-moniker-simple.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Next Page >>></B ></FONT ></A ></TD ></TR ></TABLE ></DIV ><H1 ><A NAME="LIBBONOBO-BONOBO-MONIKER-EXTENDER" ></A >BonoboMonikerExtender</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN1272" ></A ><H2 >Name</H2 >BonoboMonikerExtender -- A way to extend arbitary monikers</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN1275" ></A ><H2 >Synopsis</H2 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="SYNOPSIS" > #define <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBO-MONIKER-EXTENDER-TYPE-CAPS" >BONOBO_MONIKER_EXTENDER_TYPE</A > struct <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDER" >BonoboMonikerExtender</A >; Bonobo_Unknown (<A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDERFN" >*BonoboMonikerExtenderFn</A >) (<A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDER" >BonoboMonikerExtender</A > *extender, const Bonobo_Moniker parent, const Bonobo_ResolveOptions *options, const CORBA_char *display_name, const CORBA_char *requested_interface, CORBA_Environment *ev); typedef <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDERCLASS" >BonoboMonikerExtenderClass</A >; <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDER" >BonoboMonikerExtender</A >* <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBO-MONIKER-EXTENDER-NEW" >bonobo_moniker_extender_new</A > (<A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDERFN" >BonoboMonikerExtenderFn</A > resolve, gpointer data); Bonobo_MonikerExtender <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBO-MONIKER-FIND-EXTENDER" >bonobo_moniker_find_extender</A > (const gchar *name, const gchar *interface, CORBA_Environment *opt_ev); Bonobo_Unknown <A HREF="libbonobo-bonobo-moniker-extender.html#BONOBO-MONIKER-USE-EXTENDER" >bonobo_moniker_use_extender</A > (const gchar *extender_oafiid, <A HREF="libbonobo-bonobo-moniker.html#BONOBOMONIKER" >BonoboMoniker</A > *moniker, const Bonobo_ResolveOptions *options, const CORBA_char *requested_interface, CORBA_Environment *opt_ev); </PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1305" ></A ><H2 >Description</H2 ><P >A moniker extender is used to extend the functionality of a moniker. There are two standard moniker extenders that cannot be system wide, since they use the oaf database to expand the scope of a moniker to arbitrarily many interfaces. These are invoked explicitely by monikers implementing the stream interface in the following way: <DIV CLASS="EXAMPLE" ><A NAME="AEN1308" ></A ><P ><B >Example 1. Explicit Stream extender usage example</B ></P ><TABLE BORDER="0" BGCOLOR="#D8F8D8" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >Bonobo_Unknown example_moniker_resolve (BonoboMoniker *moniker, const Bonobo_ResolveOptions *options, const CORBA_char *requested_interface, CORBA_Environment *ev) { if (!strcmp (requested_interface, "IDL:Bonobo/Stream:1.0")) return handle_stream (moniker, options, ev); else return bonobo_moniker_use_extender ( "OAFIID:Bonobo_MonikerExtender_stream", moniker, options, requested_interface, ev); } </PRE ></TD ></TR ></TABLE ></DIV > The moniker extender essentialy resolves 'moniker' against stream and my some means ( not known when the moniker was written ) converts this to a new exotic interface - via. the PersistStream interface.</P ><P >All standard moniker extenders are registered by adding a fragment like this: <DIV CLASS="EXAMPLE" ><A NAME="AEN1312" ></A ><P ><B >Example 2. Oaf information for an extender</B ></P ><TABLE BORDER="0" BGCOLOR="#D8F8D8" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" ><oaf_attribute name="bonobo:moniker_extender" type="stringv"> <item value="file:"/> </oaf_attribute> </PRE ></TD ></TR ></TABLE ></DIV > to the .oaf file. This registers the extender with the system, such that when a moniker resolve fails an extender can be found for any of the monikers with prefix specified in the "bonobo:moniker_extender" stringv.</P ><P >Implementing your own extender is extremely simple, much like <A HREF="libbonobo-bonobo-moniker-simple.html#BONOBOMONIKERSIMPLE" >BonoboMonikerSimple</A >. <DIV CLASS="EXAMPLE" ><A NAME="AEN1317" ></A ><P ><B >Example 3. Oaf information for an extender</B ></P ><TABLE BORDER="0" BGCOLOR="#D8F8D8" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >Bonobo_Unknown example_extender_resolve (BonoboMonikerExtender *extender, const Bonobo_Moniker m, const Bonobo_ResolveOptions *options, const CORBA_char *display_name, const CORBA_char *requested_interface, CORBA_Environment *ev) { ... resolve 'm' against an interface we know it supports ... ... then use that interface to provide requested_interface ... } </PRE ></TD ></TR ></TABLE ></DIV > It is registered again in much the same way in your factory: <DIV CLASS="EXAMPLE" ><A NAME="AEN1320" ></A ><P ><B >Example 4. Creating a new simple moniker</B ></P ><TABLE BORDER="0" BGCOLOR="#D8F8D8" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >static BonoboObject * bonobo_std_moniker_factory (BonoboGenericFactory *this, const char *object_id, void *data) { g_return_val_if_fail (object_id != NULL, NULL); if (!strcmp (object_id, "OAFIID:Bonobo_MonikerExtender_file")) return BONOBO_OBJECT (bonobo_moniker_extender_new ( example_extender_resolve, NULL)); else return NULL; } </PRE ></TD ></TR ></TABLE ></DIV ></P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1323" ></A ><H2 >Details</H2 ><DIV CLASS="REFSECT2" ><A NAME="AEN1325" ></A ><H3 ><A NAME="BONOBO-MONIKER-EXTENDER-TYPE-CAPS" ></A >BONOBO_MONIKER_EXTENDER_TYPE</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >#define BONOBO_MONIKER_EXTENDER_TYPE BONOBO_TYPE_MONIKER_EXTENDER /* deprecated, you should use BONOBO_TYPE_MONIKER_EXTENDER */</PRE ></TD ></TR ></TABLE ><P ></P ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1330" ></A ><H3 ><A NAME="BONOBOMONIKEREXTENDER" ></A >struct BonoboMonikerExtender</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >struct BonoboMonikerExtender { BonoboObject object; BonoboMonikerExtenderFn resolve; gpointer data; };</PRE ></TD ></TR ></TABLE ><P ></P ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1335" ></A ><H3 ><A NAME="BONOBOMONIKEREXTENDERFN" ></A >BonoboMonikerExtenderFn ()</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >Bonobo_Unknown (*BonoboMonikerExtenderFn) (<A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDER" >BonoboMonikerExtender</A > *extender, const Bonobo_Moniker parent, const Bonobo_ResolveOptions *options, const CORBA_char *display_name, const CORBA_char *requested_interface, CORBA_Environment *ev);</PRE ></TD ></TR ></TABLE ><P ></P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN1347" ></A ><P ></P ><TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFD0D0" CELLSPACING="0" CELLPADDING="4" CLASS="CALSTABLE" ><TBODY ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >extender</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >parent</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >options</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >display_name</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >requested_interface</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >ev</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > </TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1380" ></A ><H3 ><A NAME="BONOBOMONIKEREXTENDERCLASS" ></A >BonoboMonikerExtenderClass</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >typedef struct { BonoboObjectClass parent_class; POA_Bonobo_MonikerExtender__epv epv; BonoboMonikerExtenderFn resolve; } BonoboMonikerExtenderClass;</PRE ></TD ></TR ></TABLE ><P ></P ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1385" ></A ><H3 ><A NAME="BONOBO-MONIKER-EXTENDER-NEW" ></A >bonobo_moniker_extender_new ()</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" ><A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDER" >BonoboMonikerExtender</A >* bonobo_moniker_extender_new (<A HREF="libbonobo-bonobo-moniker-extender.html#BONOBOMONIKEREXTENDERFN" >BonoboMonikerExtenderFn</A > resolve, gpointer data);</PRE ></TD ></TR ></TABLE ><P >This creates a new moniker extender.</P ><P ></P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN1394" ></A ><P ></P ><TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFD0D0" CELLSPACING="0" CELLPADDING="4" CLASS="CALSTABLE" ><TBODY ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >resolve</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the resolve function that will be used to do the extension</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >data</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > user data to be passed back to the resolve function.</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the extender object</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1411" ></A ><H3 ><A NAME="BONOBO-MONIKER-FIND-EXTENDER" ></A >bonobo_moniker_find_extender ()</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >Bonobo_MonikerExtender bonobo_moniker_find_extender (const gchar *name, const gchar *interface, CORBA_Environment *opt_ev);</PRE ></TD ></TR ></TABLE ><P >This routine tries to locate an extender for our moniker by examining a registry of extenders that map new interfaces to certain moniker names.</P ><P ></P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN1421" ></A ><P ></P ><TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFD0D0" CELLSPACING="0" CELLPADDING="4" CLASS="CALSTABLE" ><TBODY ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >name</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the name of the moniker we want to extend eg. 'file:'</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >interface</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the interface we want to resolve to</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >opt_ev</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > an optional corba exception environment.</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > an appropriate extender or CORBA_OBJECT_NIL.</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1442" ></A ><H3 ><A NAME="BONOBO-MONIKER-USE-EXTENDER" ></A >bonobo_moniker_use_extender ()</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >Bonobo_Unknown bonobo_moniker_use_extender (const gchar *extender_oafiid, <A HREF="libbonobo-bonobo-moniker.html#BONOBOMONIKER" >BonoboMoniker</A > *moniker, const Bonobo_ResolveOptions *options, const CORBA_char *requested_interface, CORBA_Environment *opt_ev);</PRE ></TD ></TR ></TABLE ><P >Locates a known extender via. OAFIID; eg. OAFIID:Bonobo_Moniker_Extender_file</P ><P ></P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN1454" ></A ><P ></P ><TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFD0D0" CELLSPACING="0" CELLPADDING="4" CLASS="CALSTABLE" ><TBODY ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >extender_oafiid</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > The IID of the extender to use</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >moniker</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the moniker to extend</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >options</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > resolve options</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >requested_interface</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the requested interface</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >opt_ev</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > optional corba environment</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > the resolved result or CORBA_OBJECT_NIL.</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><BR CLEAR="all"><BR><TABLE WIDTH="100%" BORDER="0" BGCOLOR="#000000" CELLPADDING="1" CELLSPACING="0" ><TR ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="left" ><A HREF="libbonobo-bonobo-listener.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><<< Previous Page</B ></FONT ></A ></TD ><TD WIDTH="25%" BGCOLOR="#0000C0" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="index.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Home</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#00C000" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="c4.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Up</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="right" ><A HREF="libbonobo-bonobo-moniker-simple.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Next Page >>></B ></FONT ></A ></TD ></TR ><TR ><TD COLSPAN="2" ALIGN="left" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >bonobo-listener</B ></FONT ></TD ><TD COLSPAN="2" ALIGN="right" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >BonoboMonikerSimple</B ></FONT ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >