incubator-jspwiki-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Fischer <fr...@jcpsim.org>
Subject Re: Viewer for generated pages - Lucene refresh
Date Fri, 29 Aug 2008 12:17:58 GMT
weberjn schrieb:
> We'd like to export some information from UML models into Wiki pages and use
> JSPWiki as read-only viewer for it. The result should be similar to Javadoc
> (but it is not about Java).
> It seems to be easier to generate wiki pages than to generate static HTML
> pages, does it?
> 
> I see two problems here:
> 
> o How does JSPWiki know that there are new or changed pages in the
> file-system and especially, how do you make Lucene see the changes? Is there
> an API (e.g. a servlet) that you can call to make JSPWiki reload its page
> cache?

You should not write directly to the file system, but use
the saveText( WikiContext context, String text ) method in
com.ecyrd.jspwiki.WikiEngine:

-----snip--------------------------------------------------

Wiki Context context;   // you need a WikiContext object
String       pageName;  // the wiki name of the page
String       author;    // the author of the page
String       text;      // the wiki markup you want to store

try {
   WikiEngine engine = context.getEngine();
   WikiPage   page   = engine.getPage(pageName);
   if (page == null) page = new WikiPage(engine, pageName);
   WikiContext newContext = (WikiContext)(context.clone());
   newContext.setPage(page);
   page.setAuthor(author);
   engine.saveText(newContext, text);
} catch(WikiException e) {
}

-----snip--------------------------------------------------

This should store a new version of the page and present
the text to Lucene.


> o How do you make the pages read-only? Generate ALLOW tags into the pages?

Yes.

Frank

Mime
View raw message