Class ConfluenceClient
- java.lang.Object
-
- org.apache.manifoldcf.crawler.connectors.confluence.client.ConfluenceClient
-
public class ConfluenceClient extends java.lang.Object
ConfluenceClient class
This class is intended to be used to interact with Confluence REST API
There are some methods that make use of the Confluence JSON-RPC 2.0 API, but until all the methods are ported to the new REST API, we will have to use them to leverage all the features provided by Confluence
- Author:
- Antonio David Perez Morales <adperezmorales@gmail.com>
-
-
Constructor Summary
Constructors Constructor Description ConfluenceClient(java.lang.String protocol, java.lang.String host, java.lang.Integer port, java.lang.String path, java.lang.String username, java.lang.String password)
Creates a new client instance using the given parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
check()
Check method used to test if Confluence instance is up and runningboolean
checkAuth()
Check method used to test if Confluence instance is up and running when using Authority connector (JSON-RPC API)void
close()
Close the client.Attachment
getAttachment(java.lang.String attachmentId)
Gets a specific attachment contained in the specific pagejava.util.List<Label>
getLabels(java.lang.String pageId)
Get the labels of a specific pagePage
getPage(java.lang.String pageId)
Get a Confluence page identified by its idConfluenceResponse<Attachment>
getPageAttachments(java.lang.String pageId)
Get the attachments of the given pageConfluenceResponse<Attachment>
getPageAttachments(java.lang.String pageId, int start, int limit)
Get the attachments of the given page using paginationConfluenceResponse<Page>
getPages()
Get a list of Confluence pagesConfluenceResponse<Page>
getPages(int start, int limit, com.google.common.base.Optional<java.lang.String> space, com.google.common.base.Optional<java.lang.String> pageType)
Get a list of Confluence pages using paginationConfluenceUser
getUserAuthorities(java.lang.String username)
-
-
-
Constructor Detail
-
ConfluenceClient
public ConfluenceClient(java.lang.String protocol, java.lang.String host, java.lang.Integer port, java.lang.String path, java.lang.String username, java.lang.String password) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Creates a new client instance using the given parameters
- Parameters:
protocol
- the protocolhost
- the hostport
- the portpath
- the path to Confluence instanceusername
- the username used to make the requests. Null or empty to use anonymous userpassword
- the password- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
-
Method Detail
-
close
public void close()
Close the client. No further requests can be done
-
check
public boolean check() throws java.lang.Exception
Check method used to test if Confluence instance is up and running
- Returns:
- a
Boolean
indicating whether the Confluence instance is alive or not - Throws:
java.lang.Exception
-
checkAuth
public boolean checkAuth() throws java.lang.Exception
Check method used to test if Confluence instance is up and running when using Authority connector (JSON-RPC API)
This method will be deleted when all JSON-RPC methods are available through the REST API
- Returns:
- a
Boolean
indicating whether the Confluence instance is alive or not - Throws:
java.lang.Exception
-
getPages
public ConfluenceResponse<Page> getPages() throws java.lang.Exception
Get a list of Confluence pages
- Returns:
- a
ConfluenceResponse
containing the result pages and some pagination values - Throws:
java.lang.Exception
-
getPages
public ConfluenceResponse<Page> getPages(int start, int limit, com.google.common.base.Optional<java.lang.String> space, com.google.common.base.Optional<java.lang.String> pageType) throws java.lang.Exception
Get a list of Confluence pages using pagination
- Parameters:
start
- The start value to get pages fromlimit
- The number of pages to get from start- Returns:
- a
ConfluenceResponse
containing the result pages and some pagination values - Throws:
java.lang.Exception
-
getPageAttachments
public ConfluenceResponse<Attachment> getPageAttachments(java.lang.String pageId) throws java.lang.Exception
Get the attachments of the given page
- Parameters:
pageId
- the page id- Returns:
- a
ConfluenceResponse
instance containing the attachment results and some pagination values - Throws:
java.lang.Exception
-
getPageAttachments
public ConfluenceResponse<Attachment> getPageAttachments(java.lang.String pageId, int start, int limit) throws java.lang.Exception
Get the attachments of the given page using pagination
- Parameters:
pageId
- the page idstart
- The start value to get attachments fromlimit
- The number of attachments to get from start- Returns:
- a
ConfluenceResponse
instance containing the attachment results and some pagination values - Throws:
java.lang.Exception
-
getAttachment
public Attachment getAttachment(java.lang.String attachmentId)
Gets a specific attachment contained in the specific page
- Parameters:
attachmentId
-- Returns:
- the
Attachment
instance
-
getPage
public Page getPage(java.lang.String pageId)
Get a Confluence page identified by its id
- Parameters:
pageId
- the page id- Returns:
- the Confluence page
-
getLabels
public java.util.List<Label> getLabels(java.lang.String pageId)
Get the labels of a specific page
- Parameters:
pageId
- The pageId to get the labels- Returns:
- a
List<Label>
of labels
-
getUserAuthorities
public ConfluenceUser getUserAuthorities(java.lang.String username) throws java.lang.Exception
- Parameters:
username
-- Returns:
- Throws:
java.lang.Exception
-
-