public boolean deletePageVersion(String name, int version)
     throws PageNotFoundException, PageVersionNotFoundException, PermissionDeniedException {
   PageVersion cachedVersion = diskCache.load(server.getId(), name);
   if (cachedVersion != null && cachedVersion.getVersion() == version) {
     diskCache.remove(server.getId(), name);
   }
   return wikiClient.deletePageVersion(name, version);
 }
 /**
  * @param pageVersion
  * @return
  * @throws ConcurrentEditException
  */
 public PageVersion commit(PageVersion pageVersion, boolean isMinorEdit)
     throws ConcurrentEditException, PageNotModifiedException {
   wikiClient.savePageVersion(
       pageVersion.getName(),
       pageVersion.getContent(),
       pageVersion.getComment(),
       pageVersion.getVersion(),
       isMinorEdit);
   diskCache.remove(pageVersion.getServerId(), pageVersion.getName());
   return wikiClient.getPageVersion(pageVersion.getName());
 }
  public String[] getPageNames() {
    String[] wikiPages = wikiClient.getPageNames();
    String[] cachedNames = diskCache.getCachedPageNames(server.getId());

    Set<String> pageNamesList = new HashSet<String>();
    pageNamesList.addAll(Arrays.asList(wikiPages));
    pageNamesList.addAll(Arrays.asList(cachedNames));
    String[] pageNames = pageNamesList.toArray(new String[pageNamesList.size()]);
    Arrays.sort(pageNames);

    return pageNames;
  }
 /**
  * @param pageName
  * @return
  * @throws PageNotFoundException
  */
 public PageVersion loadPageVersion(String pageName) {
   // try cachewikiClient.getPageNames();
   PageVersion pageVersion = diskCache.load(server.getId(), pageName);
   if (pageVersion == null) {
     try {
       // try wiki
       pageVersion = wikiClient.getPageVersion(pageName);
     } catch (PageNotFoundException e) {
       // create new page
       pageVersion = new PageVersion();
       pageVersion.setName(pageName);
       pageVersion.setServerId(server.getId());
       pageVersion.setAuthor(server.getUsername());
     }
     pageVersion.setServerId(server.getId());
   }
   return pageVersion;
 }
 public boolean isLocallyEdited(String pageName) {
   return diskCache.load(server.getId(), pageName) != null;
 }
 public boolean deletePage(String name) throws PageNotFoundException, PermissionDeniedException {
   diskCache.remove(server.getId(), name);
   return wikiClient.deletePage(name);
 }
 /**
  * @param pageVersion
  * @return
  */
 public PageVersion forceCommit(PageVersion pageVersion) throws PageNotModifiedException {
   wikiClient.savePageVersion(
       pageVersion.getName(), pageVersion.getContent(), pageVersion.getComment());
   diskCache.remove(pageVersion.getServerId(), pageVersion.getName());
   return wikiClient.getPageVersion(pageVersion.getName());
 }
 /**
  * @param pageVersion
  * @return
  */
 public PageVersion unedit(PageVersion pageVersion) {
   diskCache.remove(pageVersion.getServerId(), pageVersion.getName());
   return wikiClient.getPageVersion(pageVersion.getName());
 }
 /**
  * @param pageVersion
  * @return
  */
 public PageVersion edit(PageVersion pageVersion) {
   pageVersion.setEdited(true);
   diskCache.save(pageVersion);
   return pageVersion;
 }