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;
}
}
|