View Javadoc
1   package net.sf.maia.core;
2   
3   import net.sf.maia.Page;
4   import net.sf.maia.Wiki;
5   import net.sf.maia.core.storage.PageStore;
6   import net.sf.maia.core.view.ViewManager;
7   
8   /***
9    *
10   *
11   * @author Magnus Grimsell
12   */
13  public class WikiImpl implements Wiki
14  {
15      private ViewManager mViewManager;
16      private PageStore mPageStore;
17      
18      /***
19       * Sets the PageStore to use for this Wiki instance.
20       * @param pageStore pageStore to use
21       */
22      public void setPageStore(PageStore pageStore)
23      {
24          mPageStore = pageStore;
25      }
26      
27      /***
28       * Sets the TemplateEngine to use for this Wiki instance.
29       * @param viewManager TemplateEngine to use
30       */
31      public void setViewManager(ViewManager viewManager)
32      {
33          mViewManager = viewManager;
34      }
35      
36      /***
37       * @see net.sf.maia.Wiki#getPage(java.lang.String)
38       */
39      public String getPage(String path)
40      {
41          Page p = mPageStore.getPage(path);
42          String result = null;
43          if(p != null)
44          {
45              result = mViewManager.renderContent(p);
46          }
47          return result;
48      }
49  
50  }