public class DokuJClient extends Object
Constructor and Description |
---|
DokuJClient(DokuJClientConfig dokuConfig) |
DokuJClient(String url)
Instantiate a client for an anonymous user on the given wiki
Likely to be unsuitable for most wiki since anonymous user are often
not authorized to use the xmlrpc interface
|
DokuJClient(String url,
String user,
String password)
Instantiate a client for the given user on the given wiki
The wiki should be configured in a way to let this user access the
xmlrpc interface
|
Modifier and Type | Method and Description |
---|---|
Integer |
aclCheck(String pageId)
Returns the permission of the given wikipage.
|
boolean |
addAcl(String scope,
String username,
int permission)
Only available for dokuwiki-2013-12-08 (Binky) or newer
|
void |
appendPage(String pageId,
String rawWikiText)
Appends text to a Wiki Page.
|
void |
appendPage(String pageId,
String rawWikiText,
Map<String,Object> options)
Appends text to a Wiki Page.
|
void |
appendPage(String pageId,
String rawWikiText,
String summary,
boolean minor)
Appends text to a Wiki Page.
|
Map<String,String> |
cookies() |
boolean |
delAcl(String scope,
String username)
Only available for dokuwiki-2013-12-08 (Binky) or newer
|
void |
deleteAttachment(String fileId)
Deletes a file.
|
Object |
genericQuery(String action)
Let execute any xmlrpc query without argument
|
Object |
genericQuery(String action,
Object param)
Let execute any xmlrpc query with one argument
|
Object |
genericQuery(String action,
Object[] params)
Let execute any xmlrpc query with an arbitrary number of arguments
|
List<Page> |
getAllPages()
Returns a list of all Wiki pages in the remote Wiki
|
byte[] |
getAttachment(String fileId)
Let download a file from the wiki
|
File |
getAttachment(String fileId,
String localPath)
Let download a file from the wiki
|
AttachmentInfo |
getAttachmentInfo(String fileId)
Returns information about a media file
|
List<AttachmentDetails> |
getAttachments(String namespace)
Returns information about a list of media files in a given namespace
|
List<AttachmentDetails> |
getAttachments(String namespace,
Map<String,Object> additionalParams)
Returns information about a list of media files in a given namespace
|
List<String> |
getBackLinks(String pageId)
Returns a list of backlinks of a Wiki page
|
String |
getPage(String pageId)
Returns the raw Wiki text for a page
|
String |
getPageHTML(String pageId)
Returns the rendered XHTML body of a Wiki page
|
String |
getPageHTMLVersion(String pageId,
Integer timestamp)
Returns the rendered HTML of a specific version of a Wiki page
|
PageInfo |
getPageInfo(String pageId)
Returns information about a Wiki page
|
PageInfo |
getPageInfoVersion(String pageId,
Integer timestamp)
Returns information about a specific version of a Wiki page
|
List<PageDW> |
getPagelist(String namespace)
Lists all pages within a given namespace
|
List<PageDW> |
getPagelist(String namespace,
Map<String,Object> options)
Lists all pages within a given namespace
|
String |
getPageVersion(String pageId,
Integer timestamp)
Returns the raw Wiki text for a specific revision of a Wiki page.
|
List<PageVersion> |
getPageVersions(String pageId)
Returns the available versions of a Wiki page.
|
List<PageVersion> |
getPageVersions(String pageId,
Integer offset)
Returns the available versions of a Wiki page.
|
List<PageChange> |
getRecentChanges(Date date)
Wrapper around
getRecentChanges(Integer) |
List<PageChange> |
getRecentChanges(Integer timestamp)
Returns a list of recent changes since a given timestamp
According to Dokuwiki documentation (https://www.dokuwiki.org/recent_changes):
* Only the most recent change for each page is listed, regardless of how many times that page was changed.
|
List<MediaChange> |
getRecentMediaChanges(Date date)
Wrapper around
getRecentMediaChanges(Integer) |
List<MediaChange> |
getRecentMediaChanges(Integer timestamp)
Returns a list of recent changed media since given timestamp
|
Integer |
getRPCVersionSupported()
Returns the supported RPC API version
cf http://www.jspwiki.org/wiki/WikiRPCInterface2 for more info
|
Integer |
getTime()
Returns the current time at the remote wiki server as Unix timestamp
|
String |
getTitle()
Returns the title of the wiki
|
String |
getVersion()
Returns the DokuWiki version of the remote Wiki
|
Integer |
getXMLRPCAPIVersion()
Returns the XML RPC interface version of the remote Wiki.
|
boolean |
hasDokuwikiCookies() |
List<LinkInfo> |
listLinks(String pageId)
Returns a list of all links contained in a Wiki page
|
boolean |
lock(String pageId)
Lock a page
|
Boolean |
login(String user,
String password) |
void |
logoff()
Tries to logoff by expiring auth cookies and the associated PHP session
|
void |
putAttachment(String attachmentId,
byte[] localFile,
boolean overwrite)
Uploads a file to the wiki
|
void |
putAttachment(String attachmentId,
File localFile,
boolean overwrite)
Uploads a file to the wiki
|
void |
putAttachment(String attachmentId,
String localPath,
boolean overwrite)
Uploads a file to the wiki
|
void |
putPage(String pageId,
String rawWikiText)
Saves a Wiki Page
|
void |
putPage(String pageId,
String rawWikiText,
Map<String,Object> options)
Saves a Wiki Page
|
void |
putPage(String pageId,
String rawWikiText,
String summary,
boolean minor)
Saves a Wiki Page
|
List<SearchResult> |
search(String pattern)
Performs a fulltext search
|
LockResult |
setLocks(List<String> pagesToLock,
List<String> pagesToUnlock)
Allows to lock or unlock a whole bunch of pages at once.
|
void |
setLogger(Logger logger)
Let override the default Logger
|
boolean |
unlock(String pageId)
Unlock a page
|
public DokuJClient(String url, String user, String password) throws MalformedURLException, DokuException
url
- Should looks like http[s]://server/mywiki/lib/exe/xmlrpc.phpuser
- Login of the userpassword
- Password of the userMalformedURLException
DokuException
public DokuJClient(String url) throws MalformedURLException
url
- Should looks like http[s]://server/mywiki/lib/exe/xmlrpc.phpMalformedURLException
public DokuJClient(DokuJClientConfig dokuConfig) throws DokuException
DokuException
public void setLogger(Logger logger)
public boolean hasDokuwikiCookies()
public Boolean login(String user, String password) throws DokuException
DokuException
public void putAttachment(String attachmentId, String localPath, boolean overwrite) throws IOException, DokuException
attachmentId
- Id the file should have once uploaded (eg: ns1:ns2:myfile.gif)localPath
- The path to the file to uploadoverwrite
- TRUE to overwrite if a file with this id already exist on the wikiIOException
DokuException
public void putAttachment(String attachmentId, File localFile, boolean overwrite) throws IOException, DokuException
attachmentId
- Id the file should have once uploaded (eg: ns1:ns2:myfile.gif)localFile
- The file to uploadoverwrite
- TRUE to overwrite if a file with this id already exist on the wikiIOException
DokuException
public void putAttachment(String attachmentId, byte[] localFile, boolean overwrite) throws DokuException
attachmentId
- Id the file should have once uploaded (eg: ns1:ns2:myfile.gif)localFile
- base64 encoded fileoverwrite
- TRUE to overwrite if a file with this id already exist on the wikiIOException
DokuException
public AttachmentInfo getAttachmentInfo(String fileId) throws DokuException
fileId
- Id of the file on the wiki (eg: ns1:ns2:myfile.gif)DokuException
public void deleteAttachment(String fileId) throws DokuException
fileId
- Id of the file on the wiki (eg: ns1:ns2:myfile.gif)DokuException
public File getAttachment(String fileId, String localPath) throws DokuException, IOException
fileId
- Id of the file on the wiki (eg: ns1:ns2:myfile.gif)localPath
- Where to put the fileDokuException
IOException
public byte[] getAttachment(String fileId) throws DokuException
fileId
- Id of the file on the wiki (eg: ns1:ns2:myfile.gif)DokuException
public List<AttachmentDetails> getAttachments(String namespace) throws DokuException
namespace
- Where to look for filesDokuException
public List<AttachmentDetails> getAttachments(String namespace, Map<String,Object> additionalParams) throws DokuException
namespace
- Where to look for filesadditionalParams
- Potential additional parameters directly sent to Dokuwiki.
Available parameters are:
* recursive: TRUE if also files in subnamespaces are to be included, defaults to FALSE
* pattern: an optional PREG compatible regex which has to match the file idDokuException
public List<MediaChange> getRecentMediaChanges(Integer timestamp) throws DokuException
timestamp
- DokuException
public List<MediaChange> getRecentMediaChanges(Date date) throws DokuException
getRecentMediaChanges(Integer)
date
- Do not return changes older than this dateDokuException
public Integer getTime() throws DokuException
DokuException
public Integer getXMLRPCAPIVersion() throws DokuException
DokuException
public String getVersion() throws DokuException
DokuException
public List<PageVersion> getPageVersions(String pageId) throws DokuException
pageId
- Id of the page (eg: ns1:ns2:mypage)DokuException
public List<PageVersion> getPageVersions(String pageId, Integer offset) throws DokuException
pageId
- Id of the page (eg: ns1:ns2:mypage)offset
- Can be used to list earlier versions in the history.DokuException
public String getPageVersion(String pageId, Integer timestamp) throws DokuException
pageId
- Id of the page (eg: ns1:ns2:mypage)timestamp
- Version of the pageDokuException
public List<PageDW> getPagelist(String namespace) throws DokuException
namespace
- Namespace to look for (eg: ns1:ns2)DokuException
public List<PageDW> getPagelist(String namespace, Map<String,Object> options) throws DokuException
namespace
- Namespace to look for (eg: ns1:ns2)options
- Options passed directly to dokuwiki's search_all_pages()DokuException
public Integer aclCheck(String pageId) throws DokuException
pageId
- Id of the page (eg: ns1:ns2:mypage)DokuException
public Integer getRPCVersionSupported() throws DokuException
DokuException
public LockResult setLocks(List<String> pagesToLock, List<String> pagesToUnlock) throws DokuException
pagesToLock
- Ids of pages to lockpagesToUnlock
- Ids of pages to unlockDokuException
public boolean lock(String pageId) throws DokuException
pageId
- Id of the page to lock (eg: ns1:ns2:mypage)DokuException
public boolean unlock(String pageId) throws DokuException
pageId
- Id of the page to unlock (eg: ns1:ns2:mypage)DokuException
public String getTitle() throws DokuException
DokuException
public void appendPage(String pageId, String rawWikiText) throws DokuException
pageId
- Id of the page to edit (eg: ns1:ns2:mypage)rawWikiText
- Text to add to the current page contentDokuException
public void appendPage(String pageId, String rawWikiText, String summary, boolean minor) throws DokuException
pageId
- Id of the page to edit (eg: ns1:ns2:mypage)rawWikiText
- Text to add to the current page contentsummary
- A summary of the modificationminor
- Whether it's a minor modificationDokuException
public void appendPage(String pageId, String rawWikiText, Map<String,Object> options) throws DokuException
pageId
- Id of the page to edit (eg: ns1:ns2:mypage)rawWikiText
- Text to add to the current page contentoptions
- Options passed to Dokuwiki. ie: 'sum' and/or 'minor'DokuException
public String getPage(String pageId) throws DokuException
pageId
- Id of the page to fetch (eg: ns1:ns2:mypage)DokuException
public void putPage(String pageId, String rawWikiText) throws DokuException
pageId
- Id of the page to saverawWikiText
- Text to putDokuException
public void putPage(String pageId, String rawWikiText, String summary, boolean minor) throws DokuException
pageId
- Id of the page to saverawWikiText
- Text to putsummary
- Summary of the editionminor
- Whether it's a minor editionDokuException
public void putPage(String pageId, String rawWikiText, Map<String,Object> options) throws DokuException
pageId
- Id of the page to saverawWikiText
- Text to putoptions
- Options passed to Dokuwiki. ie: 'sum' and/or 'minor' * @throws DokuExceptionDokuException
public List<SearchResult> search(String pattern) throws DokuException
pattern
- A query string as described on https://www.dokuwiki.org/searchDokuException
public PageInfo getPageInfo(String pageId) throws DokuException
pageId
- Id of the page wanted (eg: ns1:ns2:mypage)DokuException
public PageInfo getPageInfoVersion(String pageId, Integer timestamp) throws DokuException
pageId
- Id of the page wanted(eg: ns1:ns2:mypage)timestamp
- version wantedDokuException
public List<Page> getAllPages() throws DokuException
DokuException
public List<String> getBackLinks(String pageId) throws DokuException
pageId
- Id of the page wanted (eg: ns1:ns2:mypage)DokuException
public String getPageHTML(String pageId) throws DokuException
pageId
- Id of the wanted page (eg: ns1:ns2:mypage)DokuException
public String getPageHTMLVersion(String pageId, Integer timestamp) throws DokuException
pageId
- Id of the wanted page (eg: ns1:ns2:mypage)timestamp
- Version wantedDokuException
public List<LinkInfo> listLinks(String pageId) throws DokuException
pageId
- Id of the wanted page (eg: ns1:ns2:mypage)DokuException
public List<PageChange> getRecentChanges(Integer timestamp) throws DokuException
timestamp
- Do not return changes older than this timestampDokuException
public List<PageChange> getRecentChanges(Date date) throws DokuException
getRecentChanges(Integer)
date
- Do not return changes older than this dateDokuException
public void logoff() throws DokuException
DokuException
public boolean addAcl(String scope, String username, int permission) throws DokuException
DokuException
public boolean delAcl(String scope, String username) throws DokuException
DokuException
public Object genericQuery(String action) throws DokuException
action
- The name of the xmlrpc method to invokeDokuException
public Object genericQuery(String action, Object param) throws DokuException
action
- The name of the xmlrpc method to invokeparam
- The unique parameter, as an ObjectDokuException
public Object genericQuery(String action, Object[] params) throws DokuException
action
- The name of the xmlrpc method to invokeparams
- The parameters, as an array of ObjectsDokuException
Copyright © 2018. All rights reserved.