Bindings¶
The CMIS specification supports multiple bindings. You can think of a binding as a communication protocol. The specification provides for three bindings:
- Atom Pub
- Browser (JSON)
- Web Services (SOAP)
Although the spec supports three, cmislib supports only two of these bindings: Atom Pub and Browser.
When instantiating a CmisClient
, if you do not specify a binding, cmislib
will use the Atom Pub binding, by default.
To use a different binding, such as the Browser binding, import it, then pass it to the CmisClient constructor, like this:
>>> from cmislib.browser.binding import BrowserBinding
>>> client = CmisClient('http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/browser', 'admin', 'admin', binding=BrowserBinding())
Make sure you specify the appropriate service URL for the binding you’ve chosen, otherwise cmislib will be unable to parse the response appropriately.
Each of the two bindings modules contain implementations of the classes defined
in cmislib.domain
. So, for example, if you execute a query that returns
documents and you are using the Atom Pub binding, what you’ll get back are instances
of cmislib.atompub.AtomPubDocument
which implements cmislib.domain.Document
.
The cmislib.atompub
Module¶
-
class
cmislib.atompub.
AtomPubBinding
(**kwargs)¶ The binding responsible for talking to the CMIS server via the AtomPub Publishing Protocol.
-
delete
(url, username, password, **kwargs)¶ Does a delete against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects do it for you.
For example, to delete a folder you’d call
Folder.delete
and to delete a document you’d callDocument.delete
.
-
get
(url, username, password, **kwargs)¶ Does a get against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects do it for you.
For example, if you need to get a specific object by object id, try
Repository.getObject
. If you have a path instead of an object id, useRepository.getObjectByPath
. Or, you could start with the root folder (Repository.getRootFolder
) and drill down from there.
-
post
(url, username, password, payload, contentType, **kwargs)¶ Does a post against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects do it for you.
For example, to update the properties on an object, you’d call
CmisObject.updateProperties
. Or, to check in a document that’s been checked out, you’d callDocument.checkin
on the PWC.
-
put
(url, username, password, payload, contentType, **kwargs)¶ Does a put against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects do it for you.
For example, to update the properties on an object, you’d call
CmisObject.updateProperties
. Or, to check in a document that’s been checked out, you’d callDocument.checkin
on the PWC.
-
-
class
cmislib.atompub.
RepositoryService
¶ The repository service for the AtomPub binding.
-
getDefaultRepository
(client)¶ Returns the default repository for the server via the AtomPub binding.
-
getRepositories
(client)¶ Get all of the repositories provided by the server.
-
getRepository
(client, repositoryId)¶ Get the repository for the specified repositoryId.
-
reload
(obj)¶ Reloads the state of the repository object.
-
The cmislib.browser
Module¶
-
class
cmislib.browser.
BrowserBinding
(**kwargs)¶ Implements the Browser Binding to communicate with the CMIS server. The Browser Binding uses only GET and POST. It sends JSON and HTML forms and gets back JSON.
-
get
(url, username, password, **kwargs)¶ Does a get against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects do it for you.
For example, if you need to get a specific object by object id, try
Repository.getObject
. If you have a path instead of an object id, useRepository.getObjectByPath
. Or, you could start with the root folder (Repository.getRootFolder
) and drill down from there.
-
post
(url, payload, contentType, username, password, **kwargs)¶ Does a post against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects do it for you.
For example, to update the properties on an object, you’d call
CmisObject.updateProperties
. Or, to check in a document that’s been checked out, you’d callDocument.checkin
on the PWC.
-
-
class
cmislib.browser.
RepositoryService
¶ Defines the repository service for the Browser Binding.
-
getDefaultRepository
(client)¶ Gets the default repository for this server. The spec doesn’t include the notion of a default, so this just returns the first one in the list.
-
getRepositories
(client)¶ Gets all of the repositories for this client.
-
getRepository
(client, repositoryId)¶ Gets the repository for the specified repository ID.
-