AbstractWebWikiRepository.java :  » Wiki-Engine » wikipipes » de » fzi » wikipipes » impl » Java Open Source

Java Open Source » Wiki Engine » wikipipes 
wikipipes » de » fzi » wikipipes » impl » AbstractWebWikiRepository.java
package de.fzi.wikipipes.impl;

import java.io.InputStream;

import de.fzi.wikipipes.ISyntaxConverter;
import de.fzi.wikipipes.IWikiRepository;

/**
 * Common base class for web-based wikis
 * @author voelkel
 *
 */
public abstract class AbstractWebWikiRepository implements IWikiRepository, ISyntaxConverter {

  private String serverURL;

  public AbstractWebWikiRepository( String serverURL ) {
    this.serverURL = serverURL;
  }

  /**
   * @param name
   * @return the URL of the page named 'name'
   */
  public abstract String getPageURL(String name);
  
  /** no slash at the end! */
  public String getServerURL() {
    return this.serverURL;
  }
  
  protected InputStream getPageAsInputStream(String name) {
    return Util.getInputStreamFromUrl(this.getPageURL(name));
  }

  protected org.dom4j.Document getPageAsDocument(String name) {
    return Util.getInputStreamAsDocument(Util
        .getInputStreamFromUrl(this.getPageURL(name)));
  }

  public AbstractWebWikiRepository syntaxConverter() {
    return this;
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.