This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Here's an idea: Let's define an XML-RPC or SOAP interface to Wiki. I don't exactly know what we could do with it, but at least we could do things like:

  • Automatical notification of page changes (someone would need to write a script that would check the RecentChanges, then email anyone.
  • Combining Wikis in a manner more efficient than InterWiki.

This would save us from actually requiring to implement all sorts of features into JSPWiki itself, and allow people to make their own modular thingies.

Interface#

I'm thinking of the following interfaces:

  • getRecentChanges( long timestamp ): Get list of changed pages since timestamp.
  • getPage( String pagename, int version ): Get the raw Wiki text of page.
  • getPageText( String pagename, int version ): Get page data rendered as plain text, with most of formatting removed (this should be really good for when you actually send wiki pages via email or something).
  • getPageHTML( String pagename, int version ): Return page in rendered HTML. This is of course required because you can never know how the WikiText should be applied, since it varies from Wiki to Wiki.

I don't know whether writing would be such a good idea. But with these you could get somewhere anyway.

--JanneJalkanen


That's a very interesting thought. It allows any outside process to monitor and perform actions based on the current state of the Wiki, but without actually affecting the Wiki.

As specified above, the only way to get a list of pages is getRecentChanges(). It seems a bit limiting to think that all the other process would care about is recently changed files. What about:

  • getAllPages(): Get list of all Wiki pages.
  • getMatchingPages(String query): Get list of all Wiki pages that match the query. Of course, this then begs the question of what matching means. That's kind of annoying.

getMatchingPages() may be overkill. Perhaps these queries would be better implemented with a SOAPProvider, a WikiPageProvider based on SOAP. Then the matching SOAP service can store the files anyway it likes, be notified the instant that a page is stored, and query the page text any silly way it feels like. A SOAPProvider would also get around the limitation that the API specified above requires the interested party to "poll" the WikiEngine periodically. With a SOAPProvider, if you care about every save or read, you can track them yourself.

--MahlenMorris


This was almost too easy. JSPWiki 1.6.6-cvs now supports an XML-RPC interface at URL http://www.ecyrd.com/JSPWiki/RPC2/ (note the trailing slash).

The available methods are currently:

  • getRecentChanges( Date timestamp ): Get list of changed pages since timestamp. The result is an array, where each element is a struct:
    • name (string) : Name of the page.
    • date (date) : Date of last modification.
  • getPage( String pagename ): Get the raw Wiki text of page, latest version.
  • getPage( String pagename, int version ): Get the raw Wiki text of page.
  • getPageHTML( String pagename ): Return page in rendered HTML.
  • getPageHTML( String pagename, int version ): Return page in rendered HTML.
  • getAllPages(): Returns a list of all pages. The result is an array of strings.

To try this one out, go download the Apache XML-RPC package from http://xml.apache.org/dist/xmlrpc/, then type in the following command:

java -cp xmlrpc.jar org.apache.xmlrpc.XmlRpcClient http://www.ecyrd.com/JSPWiki/RPC2/ jspwiki.getPage Main

(NB: You can't use the command line to get RecentChanges, you'll have to write a script of your own.)

Please test this and see how it works out.

--JanneJalkanen


Nifty! Works really well.

My only quibble is that you allow me to ask by specific version, but i have no idea what versions are acually available. It's current behavior is nice in that if I use a non-existant version number it just uses the most recent, but wouldn't a call like:

  • int getLatestVersion(String pagename)
help? Just so my program don't have to guess at version numbers.

I agree on using XML-RPC. Much nicer. -- MahlenMorris

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 28-Jan-2002 02:41 by 64.164.20.130.