public abstract class MediaWikiApiImpl extends Object implements MediawikiApi
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOGGER
Logging may be enabled by setting debug to true
|
protected String |
protectionMarker
protection Marker - if this shows in page edits are suppressed and logged with a warning
|
protected boolean |
throwExceptionOnError
set to true if exceptions should be thrown on Error
|
Constructor and Description |
---|
MediaWikiApiImpl() |
Modifier and Type | Method and Description |
---|---|
Edit |
copyToWiki(MediawikiApi targetWiki,
String pageTitle,
String summary)
copy the page for a given title from this wiki to the given target Wiki
uses https://www.mediawiki.org/wiki/API:Edit FIXME - make this an API
interface function FIXME - create a multi title version
|
protected String |
decode(String html)
decode the given html markup
|
protected String |
encode(String param)
request parameter encoding
|
Api |
fromXML(String xml)
return Api from the given xml
|
String |
getProtectionMarker() |
abstract SiteInfo |
getSiteInfo()
get the general siteinfo
|
String |
getVersion()
get the Version of this wiki
|
protected void |
handleError(Api api) |
protected void |
handleError(Error error)
handle the given api error
|
protected void |
handleError(String errMsg)
handle the given error Message according to the exception setting
|
boolean |
isThrowExceptionOnError()
are exceptions thrown when an api error code is received?
|
String |
normalizeTitle(String title)
normalize the given page title
|
void |
setProtectionMarker(String protectionMarker)
set the given protectionMarker for this wiki if a page has this
protectionMarker and edit will not be done
|
void |
setThrowExceptionOnError(boolean throwExceptionOnError)
set to true if exceptions should be thrown when api error codes are
received default is true
|
void |
setVersion(String version)
set the version via API
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
delete, edit, edit, getAllImagesByTimeStamp, getAllPages, getBacklinks, getImageInfo, getImageInfosForPage, getImagesOnPage, getImageUsage, getIsoTimeStamp, getPageContent, getPageHtml, getScriptPath, getSections, getSectionText, getSiteurl, init, isDebug, isLoggedIn, login, logout, setDebug, setScriptPath, setSiteurl, upload, upload
protected static Logger LOGGER
protected boolean throwExceptionOnError
protected String protectionMarker
public boolean isThrowExceptionOnError()
MediawikiApi
isThrowExceptionOnError
in interface MediawikiApi
public void setThrowExceptionOnError(boolean throwExceptionOnError)
MediawikiApi
setThrowExceptionOnError
in interface MediawikiApi
throwExceptionOnError
- the throwExceptionOnError to setpublic String getProtectionMarker()
public void setProtectionMarker(String protectionMarker)
MediawikiApi
setProtectionMarker
in interface MediawikiApi
protectionMarker
- the protectionMarker to setprotected void handleError(String errMsg) throws Exception
errMsg
- Exception
protected void handleError(Error error) throws Exception
error
- Exception
protected void handleError(Api api) throws Exception
api
- Exception
public Api fromXML(String xml) throws Exception
xml
- - the xml go unmarshalException
public abstract SiteInfo getSiteInfo() throws Exception
MediawikiApi
getSiteInfo
in interface MediawikiApi
Exception
public Edit copyToWiki(MediawikiApi targetWiki, String pageTitle, String summary) throws Exception
copyToWiki
in interface MediawikiApi
targetWiki
- - the other wiki (could use a different API implementation ...)pageTitle
- - the title of the page to copysummary
- - the summary to useException
public String getVersion() throws Exception
getVersion
in interface MediawikiApi
Exception
public void setVersion(String version)
version
- protected String encode(String param) throws Exception
param
- Exception
protected String decode(String html) throws Exception
html
- Exception
public String normalizeTitle(String title) throws Exception
normalizeTitle
in interface MediawikiApi
title
- Exception
Copyright © 2018 BITPlan GmbH. All rights reserved.