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 userMalformedURLExceptionDokuExceptionpublic DokuJClient(String url) throws MalformedURLException
url - Should looks like http[s]://server/mywiki/lib/exe/xmlrpc.phpMalformedURLExceptionpublic DokuJClient(DokuJClientConfig dokuConfig) throws DokuException
DokuExceptionpublic void setLogger(Logger logger)
public boolean hasDokuwikiCookies()
public Boolean login(String user, String password) throws DokuException
DokuExceptionpublic 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 wikiIOExceptionDokuExceptionpublic 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 wikiIOExceptionDokuExceptionpublic 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 wikiIOExceptionDokuExceptionpublic AttachmentInfo getAttachmentInfo(String fileId) throws DokuException
fileId - Id of the file on the wiki (eg: ns1:ns2:myfile.gif)DokuExceptionpublic void deleteAttachment(String fileId) throws DokuException
fileId - Id of the file on the wiki (eg: ns1:ns2:myfile.gif)DokuExceptionpublic 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 fileDokuExceptionIOExceptionpublic byte[] getAttachment(String fileId) throws DokuException
fileId - Id of the file on the wiki (eg: ns1:ns2:myfile.gif)DokuExceptionpublic List<AttachmentDetails> getAttachments(String namespace) throws DokuException
namespace - Where to look for filesDokuExceptionpublic 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 idDokuExceptionpublic List<MediaChange> getRecentMediaChanges(Integer timestamp) throws DokuException
timestamp - DokuExceptionpublic List<MediaChange> getRecentMediaChanges(Date date) throws DokuException
getRecentMediaChanges(Integer)date - Do not return chances older than this dateDokuExceptionpublic Integer getTime() throws DokuException
DokuExceptionpublic Integer getXMLRPCAPIVersion() throws DokuException
DokuExceptionpublic String getVersion() throws DokuException
DokuExceptionpublic List<PageVersion> getPageVersions(String pageId) throws DokuException
pageId - Id of the page (eg: ns1:ns2:mypage)DokuExceptionpublic 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.DokuExceptionpublic String getPageVersion(String pageId, Integer timestamp) throws DokuException
pageId - Id of the page (eg: ns1:ns2:mypage)timestamp - Version of the pageDokuExceptionpublic List<PageDW> getPagelist(String namespace) throws DokuException
namespace - Namespace to look for (eg: ns1:ns2)DokuExceptionpublic 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()DokuExceptionpublic Integer aclCheck(String pageId) throws DokuException
pageId - Id of the page (eg: ns1:ns2:mypage)DokuExceptionpublic Integer getRPCVersionSupported() throws DokuException
DokuExceptionpublic LockResult setLocks(List<String> pagesToLock, List<String> pagesToUnlock) throws DokuException
pagesToLock - Ids of pages to lockpagesToUnlock - Ids of pages to unlockDokuExceptionpublic boolean lock(String pageId) throws DokuException
pageId - Id of the page to lock (eg: ns1:ns2:mypage)DokuExceptionpublic boolean unlock(String pageId) throws DokuException
pageId - Id of the page to unlock (eg: ns1:ns2:mypage)DokuExceptionpublic String getTitle() throws DokuException
DokuExceptionpublic 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 contentDokuExceptionpublic 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 modificationDokuExceptionpublic 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'DokuExceptionpublic String getPage(String pageId) throws DokuException
pageId - Id of the page to fetch (eg: ns1:ns2:mypage)DokuExceptionpublic void putPage(String pageId, String rawWikiText) throws DokuException
pageId - Id of the page to saverawWikiText - Text to putDokuExceptionpublic 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 editionDokuExceptionpublic 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 DokuExceptionDokuExceptionpublic List<SearchResult> search(String pattern) throws DokuException
pattern - A query string as described on https://www.dokuwiki.org/searchDokuExceptionpublic PageInfo getPageInfo(String pageId) throws DokuException
pageId - Id of the page wanted (eg: ns1:ns2:mypage)DokuExceptionpublic PageInfo getPageInfoVersion(String pageId, Integer timestamp) throws DokuException
pageId - Id of the page wanted(eg: ns1:ns2:mypage)timestamp - version wantedDokuExceptionpublic List<Page> getAllPages() throws DokuException
DokuExceptionpublic List<String> getBackLinks(String pageId) throws DokuException
pageId - Id of the page wanted (eg: ns1:ns2:mypage)DokuExceptionpublic String getPageHTML(String pageId) throws DokuException
pageId - Id of the wanted page (eg: ns1:ns2:mypage)DokuExceptionpublic String getPageHTMLVersion(String pageId, Integer timestamp) throws DokuException
pageId - Id of the wanted page (eg: ns1:ns2:mypage)timestamp - Version wantedDokuExceptionpublic List<LinkInfo> listLinks(String pageId) throws DokuException
pageId - Id of the wanted page (eg: ns1:ns2:mypage)DokuExceptionpublic List<PageChange> getRecentChanges(Integer timestamp) throws DokuException
timestamp - Do not return changes older than this timestampDokuExceptionpublic List<PageChange> getRecentChanges(Date date) throws DokuException
getRecentChanges(Integer)date - Do not return changes older than this dateDokuExceptionpublic void logoff()
throws DokuException
DokuExceptionpublic boolean addAcl(String scope, String username, int permission) throws DokuException
DokuExceptionpublic boolean delAcl(String scope, String username) throws DokuException
DokuExceptionpublic Object genericQuery(String action) throws DokuException
action - The name of the xmlrpc method to invokeDokuExceptionpublic Object genericQuery(String action, Object param) throws DokuException
action - The name of the xmlrpc method to invokeparam - The unique parameter, as an ObjectDokuExceptionpublic Object genericQuery(String action, Object[] params) throws DokuException
action - The name of the xmlrpc method to invokeparams - The parameters, as an array of ObjectsDokuExceptionCopyright © 2015. All rights reserved.