so what if we had some configuration file that looked like this:

<xmlrpc>
        <handler name="ListCollection"
class="org.apache.xindice.server.rpc.messages.ListCollection" />
        <handler name="CreateCollection"
class="org.apache.xindice.server.rpc.messages.CreateCollection" />
        <handler name="ListDocuments"
class="org.apache.xindice.server.rpc.messages.ListDocuments" />
        <handler name="MyAppSpecificThing" class="com.example.mylittle.thingy" 
/>
</xmlrpc>

Then the RPCMessageInterface class would parse this config file on startup.
When a request comes in, it would invoke the run method as it does
currently.  But this method would look something like:

   public Hashtable run(Hashtable message) throws Exception {
      // The method determines what class we load to handle the message.
      RPCMessage handler = null;
        String handlerName = message.get(MESSAGE_PARAM);

        // configuredHash would be something like a HashMap that was configured
        // on startup with name => class from the config file.
        String className = (String)configuredHash.get(handlerName);

      handler = (RPCMessage) Class.forName(className).newInstance();

      return handler.execute(message);
   }

This would allow Xindice to ship with the default handlers, but any
administrator could override the default handlers or install new handlers
simply by adding lines to this configuration file.

What do you think about this kind of a design?

thanks
dave


-----Original Message-----
From: Kurt Ward [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 12:37 PM
To: [EMAIL PROTECTED]
Subject: Re: xml-rpc messages


> "It would be nice to have the xmlrpc endpoint configurable also."
> What do you mean?  Currently, an xmlrpc user invokes the 'run' method with
a
> message parameter with the details of which class to use and the
parameters
> to pass.  By xmlrpc endpoint, do you mean 'run'?

The url endpoint, such as http://localhost:8080/Xindice.  I am not terribly
familiar with
servlets, but say I wanted both xmlrpc and soap API's available.  The both
run off of an HTTP POST operation, so an easy way provide each with it's own
mapping would be nice.

> As a second question, in Xindice 1.0, we had the 'db' name as the
> handlerName (to use the terminology from
> http://xml.apache.org/xmlrpc/server.html).  Why did we abandon that in
favor
> of this RPCMessageInterface being registered as the '$default'?  I'm not
> particularly opposed to this change, but I can't seem to find where this
was
> discussed, and I don't intuitively understand why we redesigned the XMLRPC
> interfaces in this way.

Good question, but I don't know the answer.

Kurt


Reply via email to