unpack cmislib-maykin-0.7.4.tar.gz

This commit is contained in:
Frédéric Péters 2020-06-03 15:37:06 +02:00
parent 14c6251a84
commit 2aad16c869
39 changed files with 16673 additions and 7099 deletions

View File

@ -1,12 +1,13 @@
Metadata-Version: 1.1
Name: cmislib
Version: 0.5.1
Name: cmislib-maykin
Version: 0.7.4
Summary: Apache Chemistry CMIS client library for Python
Home-page: http://chemistry.apache.org/
Author: Apache Chemistry Project
Author-email: dev@chemistry.apache.org
License: Apache License (2.0)
Description: ABOUT
-----
Thanks for using cmislib, the CMIS client library for Python.
@ -17,22 +18,32 @@ Description: ABOUT
More info on CMIS can be found at:
http://www.oasis-open.org/committees/cmis
This is a fork from https://github.com/apache/chemistry-cmislib and update to work with
Python 2.7 and 3.5.
SOURCE
------
The source code for this project lives at http://chemistry.apache.org/
TESTS
-----
There are unit tests available in the tests directory. They require access
to a CMIS provider. There are many freely-available CMIS repositories
available to run locally or that are hosted.
DOC
---
Documentation that tells you what this is all about can be found in the doc
directory. Please see the doc for dependencies, required CMIS version level,
required Python version, etc.
NOTES:
------
This is a working version, and has been tested on Python 3.5 and Alfresco Community - 5.1.0 (r127059-b7)
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta

View File

@ -1,4 +1,5 @@
ABOUT
-----
Thanks for using cmislib, the CMIS client library for Python.
@ -9,19 +10,29 @@ EMC Documentum, and any other content repository that is CMIS-compliant.
More info on CMIS can be found at:
http://www.oasis-open.org/committees/cmis
This is a fork from https://github.com/apache/chemistry-cmislib and update to work with
Python 2.7 and 3.5.
SOURCE
------
The source code for this project lives at http://chemistry.apache.org/
TESTS
-----
There are unit tests available in the tests directory. They require access
to a CMIS provider. There are many freely-available CMIS repositories
available to run locally or that are hosted.
DOC
---
Documentation that tells you what this is all about can be found in the doc
directory. Please see the doc for dependencies, required CMIS version level,
required Python version, etc.
NOTES:
------
This is a working version, and has been tested on Python 3.5 and Alfresco Community - 5.1.0 (r127059-b7)

View File

@ -1,5 +1,14 @@
[isort]
combine_as_imports = true
default_section = THIRDPARTY
include_trailing_comma = false
line_length = 79
multi_line_output = 5
not_skip = __init__.py
known_first_party = cmslib
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0

View File

@ -19,33 +19,40 @@
import os
from setuptools import setup, find_packages
version = '0.5.1'
version = '0.7.4'
root_dir = os.path.dirname(os.path.abspath(__file__))
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
with open(os.path.join(root_dir, fname)) as infile:
return infile.read()
setup(
name = "cmislib",
description = 'Apache Chemistry CMIS client library for Python',
version = version,
install_requires = [
'iso8601'
],
author = 'Apache Chemistry Project',
author_email = 'dev@chemistry.apache.org',
license = 'Apache License (2.0)',
url = 'http://chemistry.apache.org/',
package_dir = {'':'src'},
packages = find_packages('src', exclude=['tests']),
#include_package_data = True,
exclude_package_data = {'':['tests']},
long_description = read('README.txt'),
classifiers = [
name="cmislib-maykin",
description='Apache Chemistry CMIS client library for Python',
version=version,
install_requires=[
'iso8601',
'httplib2',
'six'
],
author='Apache Chemistry Project',
author_email='dev@chemistry.apache.org',
license='Apache License (2.0)',
url='http://chemistry.apache.org/',
package_dir={'': 'src'},
packages=find_packages('src', exclude=['tests']),
# include_package_data=True,
exclude_package_data={'': ['tests']},
long_description=read('README.md'),
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries",
],
],
)

View File

@ -20,6 +20,8 @@
Define package contents so that they are easy to import.
"""
from model import CmisClient, Repository, Folder
from cmislib.model import CmisClient
from cmislib.domain import Repository, Folder
from cmislib.cmis_services import Binding, RepositoryServiceIfc
__all__ = ["CmisClient", "Repository", "Folder"]
__all__ = ["Binding", "CmisClient", "RepositoryServiceIfc", "Repository", "Folder"]

View File

@ -0,0 +1 @@
__author__ = 'jpotts'

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__author__ = 'jpotts'

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,93 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
"""
Module containing the base Binding class and other service objects.
"""
import logging
from cmislib.exceptions import CmisException, RuntimeException, \
ObjectNotFoundException, InvalidArgumentException, \
PermissionDeniedException, NotSupportedException, \
UpdateConflictException
logger = logging.getLogger(__name__)
class Binding(object):
"""
Represents the binding used to communicate with the CMIS server.
"""
def getRepositoryService(self):
"""
Returns the repository service specific to this binding.
"""
pass
def _processCommonErrors(self, error, url):
"""
Maps HTTPErrors that are common to all to exceptions. Only errors
that are truly global, like 401 not authorized, should be handled
here. Callers should handle the rest.
"""
if error['status'] == '401':
raise PermissionDeniedException(error['status'], url)
elif error['status'] == '400':
raise InvalidArgumentException(error['status'], url)
elif error['status'] == '404':
raise ObjectNotFoundException(error['status'], url)
elif error['status'] == '403':
raise PermissionDeniedException(error['status'], url)
elif error['status'] == '405':
raise NotSupportedException(error['status'], url)
elif error['status'] == '409':
raise UpdateConflictException(error['status'], url)
elif error['status'] == '500':
raise RuntimeException(error['status'], url)
else:
raise CmisException(error['status'], url)
class RepositoryServiceIfc(object):
"""
Defines the interface for the repository service.
"""
def getRepositories(self, client):
"""
Returns a list of repositories for this server.
"""
pass
def getRepositoryInfo(self):
"""
Returns the repository information for this server.
"""
pass

2210
src/cmislib/domain.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,9 @@
# under the License.
#
"""
Module containing exceptions.
"""
class CmisException(Exception):
"""

View File

@ -17,5 +17,8 @@
# under the License.
#
"""
Common strings.
"""
NO_ACL_SUPPORT = 'This repository does not support ACLs'
NO_CHANGE_LOG_SUPPORT = 'This repository does not support change logs'

File diff suppressed because it is too large Load Diff

View File

@ -16,81 +16,20 @@
# specific language governing permissions and limitations
# under the License.
#
'''
Module that knows how to connect to the AtomPub Binding of a CMIS repo
'''
"""
Module that takes care of network communications for cmislib. It does
not know anything about CMIS or do anything special with regard to the
response it receives.
"""
from urllib import urlencode
from urllib2 import HTTPBasicAuthHandler, \
HTTPPasswordMgrWithDefaultRealm, \
HTTPRedirectHandler, \
HTTPDefaultErrorHandler, \
HTTPError, \
Request, \
build_opener, \
AbstractBasicAuthHandler
import sys
if sys.version_info >= (3,):
from urllib.parse import urlencode
else:
from urllib import urlencode
import logging
class SmartRedirectHandler(HTTPRedirectHandler):
""" Handles 301 and 302 redirects """
def http_error_301(self, req, fp, code, msg, headers):
""" Handle a 301 error """
result = HTTPRedirectHandler.http_error_301(
self, req, fp, code, msg, headers)
result.status = code
return result
def http_error_302(self, req, fp, code, msg, headers):
""" Handle a 302 error """
result = HTTPRedirectHandler.http_error_302(
self, req, fp, code, msg, headers)
result.status = code
return result
class DefaultErrorHandler(HTTPDefaultErrorHandler):
""" Default error handler """
def http_error_default(self, req, fp, code, msg, headers):
"""Provide an implementation for the default handler"""
result = HTTPError(
req.get_full_url(), code, msg, headers, fp)
result.status = code
return result
class ContextualBasicAuthHandler(HTTPBasicAuthHandler):
"""
Handles 401 errors without recursing indefinitely. The recursing
behaviour has been introduced in Python 2.6.5 to handle 401 redirects
used by some architectures of authentication.
"""
def __init__(self, password_mgr):
HTTPBasicAuthHandler.__init__(self, password_mgr)
self.authContext = set([])
def http_error_401(self, req, fp, code, msg, headers):
"""Override the default autoretry behaviour"""
url = req.get_full_url()
hdrs = req.header_items()
hdrs = ', '.join(['%s: %s' % (key, value)
for key, value in sorted(hdrs)])
context = (url, hdrs)
if context in self.authContext:
self.authContext.clear()
result = HTTPError(
req.get_full_url(), code, msg, headers, fp)
result.status = code
return result
self.authContext.add(context)
return self.http_error_auth_reqed('www-authenticate',
url, req, headers)
import httplib2
class RESTService(object):
@ -112,12 +51,12 @@ class RESTService(object):
""" Makes a get request to the URL specified."""
headers = None
headers = {}
if kwargs:
if 'headers' in kwargs:
headers = kwargs['headers']
del(kwargs['headers'])
self.logger.debug('Headers passed in:%s' % headers)
del kwargs['headers']
self.logger.debug('Headers passed in:' + headers)
if url.find('?') >= 0:
url = url + '&' + urlencode(kwargs)
else:
@ -125,35 +64,22 @@ class RESTService(object):
self.logger.debug('About to do a GET on:' + url)
request = RESTRequest(url, method='GET')
h = httplib2.Http()
h.add_credentials(username, password)
headers['User-Agent'] = self.user_agent
# add a user-agent
request.add_header('User-Agent', self.user_agent)
if headers:
for k, v in headers.items():
self.logger.debug('Adding header:%s:%s' % (k, v))
request.add_header(k, v)
# create a password manager
passwordManager = HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None, url, username, password)
opener = build_opener(SmartRedirectHandler(),
DefaultErrorHandler(),
ContextualBasicAuthHandler(passwordManager))
return opener.open(request)
return h.request(url, method='GET', headers=headers)
def delete(self, url, username=None, password=None, **kwargs):
""" Makes a delete request to the URL specified. """
headers = None
headers = {}
if kwargs:
if 'headers' in kwargs:
headers = kwargs['headers']
del(kwargs['headers'])
self.logger.debug('Headers passed in:%s' % headers)
del kwargs['headers']
self.logger.debug('Headers passed in:' + headers)
if url.find('?') >= 0:
url = url + '&' + urlencode(kwargs)
else:
@ -161,30 +87,11 @@ class RESTService(object):
self.logger.debug('About to do a DELETE on:' + url)
request = RESTRequest(url, method='DELETE')
h = httplib2.Http()
h.add_credentials(username, password)
headers['User-Agent'] = self.user_agent
# add a user-agent
request.add_header('User-Agent', self.user_agent)
if headers:
for k, v in headers.items():
self.logger.debug('Adding header:%s:%s' % (k, v))
request.add_header(k, v)
# create a password manager
passwordManager = HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None, url, username, password)
opener = build_opener(SmartRedirectHandler(),
DefaultErrorHandler(),
ContextualBasicAuthHandler(passwordManager))
#try:
# opener.open(request)
#except urllib2.HTTPError, e:
# if e.code is not 204:
# raise e
#return None
return opener.open(request)
return h.request(url, method='DELETE', headers=headers)
def put(self,
url,
@ -200,12 +107,12 @@ class RESTService(object):
specified content type.
"""
headers = None
headers = {}
if kwargs:
if 'headers' in kwargs:
headers = kwargs['headers']
del(kwargs['headers'])
self.logger.debug('Headers passed in:%s' % headers)
del kwargs['headers']
self.logger.debug('Headers passed in:' + headers)
if url.find('?') >= 0:
url = url + '&' + urlencode(kwargs)
else:
@ -213,27 +120,12 @@ class RESTService(object):
self.logger.debug('About to do a PUT on:' + url)
request = RESTRequest(url, payload, method='PUT')
# set the content type header
request.add_header('Content-Type', contentType)
# add a user-agent
request.add_header('User-Agent', self.user_agent)
if headers:
for k, v in headers.items():
self.logger.debug('Adding header:%s:%s' % (k, v))
request.add_header(k, v)
# create a password manager
passwordManager = HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None, url, username, password)
opener = build_opener(SmartRedirectHandler(),
DefaultErrorHandler(),
ContextualBasicAuthHandler(passwordManager))
return opener.open(request)
h = httplib2.Http()
h.add_credentials(username, password)
headers['User-Agent'] = self.user_agent
if contentType is not None:
headers['Content-Type'] = contentType
return h.request(url, body=payload, method='PUT', headers=headers)
def post(self,
url,
@ -249,12 +141,12 @@ class RESTService(object):
specified content type.
"""
headers = None
headers = {}
if kwargs:
if 'headers' in kwargs:
headers = kwargs['headers']
del(kwargs['headers'])
self.logger.debug('Headers passed in:%s' % headers)
del kwargs['headers']
self.logger.debug('Headers passed in:' + headers)
if url.find('?') >= 0:
url = url + '&' + urlencode(kwargs)
else:
@ -262,47 +154,9 @@ class RESTService(object):
self.logger.debug('About to do a POST on:' + url)
request = RESTRequest(url, payload, method='POST')
# set the content type header
request.add_header('Content-Type', contentType)
# add a user-agent
request.add_header('User-Agent', self.user_agent)
if headers:
for k, v in headers.items():
self.logger.debug('Adding header:%s:%s' % (k, v))
request.add_header(k, v)
# create a password manager
passwordManager = HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None, url, username, password)
opener = build_opener(SmartRedirectHandler(),
DefaultErrorHandler(),
ContextualBasicAuthHandler(passwordManager))
try:
return opener.open(request)
except HTTPError, e:
if e.code is not 201:
return e
else:
return e.read()
class RESTRequest(Request):
"""
Overrides urllib's request default behavior
"""
def __init__(self, *args, **kwargs):
""" Constructor """
self._method = kwargs.pop('method', 'GET')
assert self._method in ['GET', 'POST', 'PUT', 'DELETE']
Request.__init__(self, *args, **kwargs)
def get_method(self):
""" Override the get method """
return self._method
h = httplib2.Http()
h.add_credentials(username, password)
headers['User-Agent'] = self.user_agent
if contentType is not None:
headers['Content-Type'] = contentType
return h.request(url, body=payload, method='POST', headers=headers)

164
src/cmislib/util.py Normal file
View File

@ -0,0 +1,164 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
"""
Module containing handy utility functions.
"""
import re
import iso8601
import logging
import datetime
from cmislib.domain import CmisId
moduleLogger = logging.getLogger('cmislib.util')
def multiple_replace(aDict, text):
"""
Replace in 'text' all occurences of any key in the given
dictionary by its corresponding value. Returns the new string.
See http://code.activestate.com/recipes/81330/
"""
# Create a regular expression from the dictionary keys
regex = re.compile("(%s)" % "|".join(map(re.escape, aDict.keys())))
# For each match, look-up corresponding value in dictionary
return regex.sub(lambda mo: aDict[mo.string[mo.start():mo.end()]], text)
def parsePropValue(value, nodeName):
"""
Returns a properly-typed object based on the type as specified in the
node's element name.
"""
moduleLogger.debug('Inside parsePropValue')
if nodeName == 'propertyId':
return CmisId(value)
elif nodeName == 'propertyString':
return value
elif nodeName == 'propertyBoolean':
bDict = {'false': False, 'true': True}
return bDict[value.lower()]
elif nodeName == 'propertyInteger':
return int(value)
elif nodeName == 'propertyDecimal':
return float(value)
elif nodeName == 'propertyDateTime':
# %z doesn't seem to work, so I'm going to trunc the offset
# not all servers return microseconds, so those go too
return parseDateTimeValue(value)
else:
return value
def parsePropValueByType(value, typeName):
"""
Returns a properly-typed object based on the type as specified in the
node's property definition.
"""
moduleLogger.debug('Inside parsePropValueByType: %s: %s', typeName, value)
if typeName == 'id':
if value:
return CmisId(value)
else:
return None
elif typeName == 'string':
return value
elif typeName == 'boolean':
if not value:
return False
if type(value) == bool:
return value
else:
bDict = {'false': False, 'true': True}
return bDict[value.lower()]
elif typeName == 'integer':
if value:
return int(value)
else:
return 0
elif typeName == 'decimal':
if value:
# search result relevance is returning as an arrary of decimals
# in the browser binding for some reason
if isinstance(value, list):
return float(value[0])
else:
return float(value)
else:
return 0.0
elif typeName == 'datetime':
# %z doesn't seem to work, so I'm going to trunc the offset
# not all servers return microseconds, so those go too
return parseDateTimeValue(value)
else:
return value
def parseDateTimeValue(value):
"""
Utility function to return a datetime from a string.
"""
if type(value) == str:
return iso8601.parse_date(value)
elif type(value) == int:
return datetime.datetime.fromtimestamp(value / 1000)
else:
return
def parseBoolValue(value):
"""
Utility function to parse booleans and none from strings
"""
if value == 'false':
return False
elif value == 'true':
return True
elif value == 'none':
return None
else:
return value
def toCMISValue(value):
"""
Utility function to convert Python values to CMIS string values
"""
if value is False:
return 'false'
elif value is True:
return 'true'
elif value is None:
return 'none'
else:
return value

Binary file not shown.

Binary file not shown.

View File

@ -1,174 +0,0 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
SOURCEDIR = .
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MyTestProject.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MyTestProject.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/MyTestProject"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MyTestProject"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

View File

@ -1,58 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
About Apache Chemistry cmislib
==============================
The goal of this project is to create a CMIS client for Python that can be used to work with any CMIS-compliant repository.
The library is being developed with the following guidelines:
* Developers using this API should be able to work with CMIS domain objects without having to worry about the underlying implementation details.
* The library will use the Resftul AtomPub Binding.
* The library will conform to the `CMIS spec <http://docs.oasisopen.org/cmis/CMIS/v1.0/cd06/cmis-spec-v1.0.pdf>`_ as closely as possible. Several public CMIS repositories are being used to test the API.
* The library should have no hard-coded URL's. It should be able to get everything it needs regarding how to work with the CMIS service from the CMIS service URL response and subsequent calls.
* There shouldn't have to be a vendor-specific version of this library. The goal is for it to be interoperable with CMIS-compliant providers.
Quick Example
-------------
This should give you an idea of how easy and natural it is to work with the API:
>>> cmisClient = cmislib.CmisClient('http://localhost:8080/alfresco/cmisatom', 'admin', 'admin')
>>> repo = cmisClient.defaultRepository
>>> rootFolder = repo.rootFolder
>>> children = rootFolder.getChildren()
>>> newFolder = rootFolder.createFolder('testDeleteFolder folder')
>>> props = newFolder.properties
>>> newFolder.delete()
To-Do's
-------
Miscellaneous
* createDocumentFromSource
* getProperties filter
* getContentStream stream id
Unfiling/multifiling support
* createDocument without a parent folder (unfiled)
* The spec does not yet support this. Although the spec does say that a folder ID is optional, it does not specify which URL to post the unfiled document to.
Policies
* Policy object
* createPolicy
* applyPolicy
* removePolicy
* getAppliedPolicies

View File

@ -1,62 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Code
====
The :mod:`cmislib.model` Module
-------------------------------
The :mod:`cmislib.model` Module contains all the CMIS domain objects. The ones you will work with are listed as top level package elements. When working with the repository, the first thing you need to do is grab an instance of :class:`cmislib.CmisClient`, passing it the repository endpoint URL, username, and password.
For example, in Alfresco 4 and higher, the repository endpoint is
'http://localhost:8080/alfresco/cmisatom'. In earlier versions of
Alfresco, the endpoint is
'http://localhost:8080/alfresco/s/api/cmis'. In both cases, the
default username and password are 'admin' and 'admin'.
>>> cmisClient = cmislib.CmisClient('http://localhost:8080/alfresco/s/cmis', 'admin', 'admin')
From there you can get the default repository...
>>> repo = cmisClient.defaultRepository
or a specific repository if you know the repository ID.
>>> repo = cmisClient.getRepository('83beb297-a6fa-4ac5-844b-98c871c0eea9')
Once you have that, you're off to the races. Use the :class:`cmislib.Repository` class to create new :class:`cmislib.Folder` and :class:`cmislib.Document` objects, perform searches, etc.
.. automodule:: cmislib.model
:members:
The :mod:`cmislib.net` Module
-----------------------------
The :mod:`cmislib.net` Module contains the classes used by :mod:`cmislib.model.CmisClient` to communicate with the CMIS repository. The most important of which is :class:`cmislib.net.RESTService`.
.. automodule:: cmislib.net
:members: RESTService
The :mod:`tests` Module
-------------------------------
The :mod:`tests` Module contains unit tests for all classes and methods in :mod:`cmislib.model`. See :ref:`tests` for more information on running tests.
.. automodule:: tests
:members:

View File

@ -1,303 +0,0 @@
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# CMIS Library documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 14 16:13:15 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.abspath('../..'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Apache Chemistry cmislib'
copyright = u'2013, Apache Software Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.5'
# The full version, including alpha/beta/rc tags.
release = '0.5.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'cmislibdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'cmislib.tex', u'Apache Chemistry cmislib Documentation',
u'Jeff Potts', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'cmislib', u'Apache Chemistry cmislib Documentation',
[u'Jeff Potts'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'cmislib', u'Apache Chemistry cmislib Documentation',
u'Jeff Potts', 'cmislib', 'Python client library for CMIS',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'Apache Chemistry cmislib Documentation'
epub_author = u'Jeff Potts'
epub_publisher = u'Jeff Potts'
epub_copyright = u'2013, Apache Software Foundation'
# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
#epub_exclude_files = []
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True

View File

@ -1,81 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
===============
Developer Guide
===============
This page is for people who wish to contribute code to this project.
Developer Setup
---------------
Check out the source from head, switch to the source code's root directory, then run:
python setup.py develop
That will set up this project's src directory in the easy-install.pth file in site-packages.
Release Process
---------------
Checklist:
#. All newly-added code has a unit test
#. All tests pass cleanly (or have good reasons for not passing)
#. Change setup.cfg to have the appropriate tag ('dev', for example, or '' for a stable release)
#. Change setup.py to have the appropriate version number
#. Inline comments updated with changes
#. Sphinx doc updated with changes
#. Docs build cleanly
.. code-block:: bash
cd src/doc/src/
make html
#. pep8 runs without much complaint
.. code-block:: bash
pep8 --ignore=E501,W601 --repeat model.py
#. pylint runs without much complaint
.. code-block:: bash
pylint --disable=C0103,R0904,R0913,C0301,W0511 cmislibtest.py
#. All changes checked in
#. Tag the release using 'cmislib-[release num]-RC[x]'
#. Use the release script to build the release artifacts
.. code-block:: bash
cd dist
./release.sh -u jpotts@apache.org
This will do a 'setup.py bdist sdist' and will then sign all artifacts.
Note that the artifacts will be named without 'RC[x]'. These are the same artifacts that will be distributed if the vote passes.
#. Copy files to the Apache server under ~/public_html/chemistry/cmislib/[release num]
#. Start vote. Send an email to dev@chemistry.apache.org announcing the vote, highlighting the changes, pointing to the tagged source, and referencing the artifacts that have been copied to the Apache server.
#. After 72 hours, if the vote passes, continue, otherwise address issues and start over
#. Copy the files to the appropriate Apache dist directory, which is /www/www.apache.org/dist/chemistry/cmislib/[release num]
#. Rename the RC tag in source code control
#. Update the cmislib home page with download links to the new release
#. Upload files to Pypi
#. Check the `cheesecake <http://pycheesecake.org/>`_ score
.. code-block:: bash
python cheesecake_index --name=cmislib

View File

@ -1,37 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Documentation
=============
This documentation was generated with `Sphinx <http://sphinx.pocoo.org/>`_. To install Sphinx on Mac OS X using Macports:
MAC OS X::
sudo port install py26-sphinx
Once you've got Sphinx installed, if you need to regenerate the documentation::
cd /path/to/cmislib/src/doc/src
Run either:
sphinx-build -b html -d ../build/.doctrees . ../build
make html
The generated HTML will be placed in doc/build::
firefox file:///path/to/cmislib/src/doc/build/index.html

View File

@ -1,137 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
.. _examples:
========
Examples
========
There's nothing in cmislib that is specific to any particular vendor. Once you give it your CMIS provider's service URL and some credentials, it figures out where to go from there.
Let's look at some examples using Alfresco's public CMIS repository.
-----------------------
Get a Repository object
-----------------------
#. From the command-line, start the Python shell by typing `python` then hit enter.
#. Import the CmisClient:
>>> from cmislib import CmisClient
#. Point the CmisClient at the repository's service URL
>>> client = CmisClient('http://cmis.alfresco.com/cmisatom', 'admin', 'admin')
#. Get the default repository for the service
>>> repo = client.defaultRepository
>>> repo.id
u'83beb297-a6fa-4ac5-844b-98c871c0eea9'
#. Get the repository's properties. This for-loop spits out everything cmislib knows about the repo.
>>> repo.name
u'Main Repository'
>>> info = repo.info
>>> for k,v in info.items():
... print "%s:%s" % (k,v)
...
cmisSpecificationTitle:Version 1.0 Committee Draft 04
cmisVersionSupported:1.0
repositoryDescription:None
productVersion:3.2.0 (r2 2440)
rootFolderId:workspace://SpacesStore/aa1ecedf-9551-49c5-831a-0502bb43f348
repositoryId:83beb297-a6fa-4ac5-844b-98c871c0eea9
repositoryName:Main Repository
vendorName:Alfresco
productName:Alfresco Repository (Community)
-------------------
Folders & Documents
-------------------
Once you've got the Repository object you can start working with folders.
#. Create a new folder in the root. You should name yours something unique.
>>> root = repo.rootFolder
>>> someFolder = root.createFolder('someFolder')
>>> someFolder.id
u'workspace://SpacesStore/91f344ef-84e7-43d8-b379-959c0be7e8fc'
#. Then, you can create some content:
>>> someFile = open('test.txt', 'r')
>>> someDoc = someFolder.createDocument('Test Document', contentFile=someFile)
#. And, if you want, you can dump the properties of the newly-created document (this is a partial list):
>>> props = someDoc.properties
>>> for k,v in props.items():
... print '%s:%s' % (k,v)
...
cmis:contentStreamMimeType:text/plain
cmis:creationDate:2009-12-18T10:59:26.667-06:00
cmis:baseTypeId:cmis:document
cmis:isLatestMajorVersion:false
cmis:isImmutable:false
cmis:isMajorVersion:false
cmis:objectId:workspace://SpacesStore/2cf36ad5-92b0-4731-94a4-9f3fef25b479
----------------------------------
Searching For & Retrieving Objects
----------------------------------
There are several different ways to grab an object:
* You can run a CMIS query
* You can ask the repository to give you one for a specific path or object ID
* You can traverse the repository using a folder's children and/or descendants
#. Let's find the doc we just created with a full-text search.
.. note::
Note that I'm currently seeing a problem with Alfresco in which the CMIS service returns one less result than what's really there):
>>> results = repo.query("select * from cmis:document where contains('test')")
>>> for result in results:
... print result.name
...
Test Document2
example test script.js
#. Alternatively, you can also get objects by their path, like this:
>>> someDoc = repo.getObjectByPath('/someFolder/Test Document')
>>> someDoc.id
u'workspace://SpacesStore/2cf36ad5-92b0-4731-94a4-9f3fef25b479'
#. Or their object ID, like this:
>>> someDoc = repo.getObject('workspace://SpacesStore/2cf36ad5-92b0-4731-94a4-9f3fef25b479')
>>> someDoc.name
u'Test Document'
#. Folder objects have getChildren() and getDescendants() methods that will return a list of :class:`CmisObject` objects:
>>> children= someFolder.getChildren()
>>> for child in children:
... print child.name
...
Test Document
Test Document2

View File

@ -1,47 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
.. cmislib documentation master file, created by
sphinx-quickstart on Thu Dec 10 10:12:43 2009.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to the Apache Chemistry cmislib documentation!
==================================================================
Contents:
.. toctree::
:maxdepth: 2
about.rst
install.rst
examples.rst
code.rst
devguide.rst
tests.rst
docs.rst
sample-data.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,39 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Installation
============
Requirements
------------
These requirements must be met:
- Python 2.6.x
- CMIS provider compliant with CMIS 1.0
Steps
-----
#. If you don't have `Python <http://www.python.org>`_ installed already, do so.
#. If you don't have `setuptools <http://pypi.python.org/pypi/setuptools>`_ installed already, do so.
#. Once setuptools is installed, type `easy_install cmislib`
#. That's it!
Once you do that, you should be able to fire up Python on the command-line and import cmislib successfully.
>>> from cmislib import CmisClient, Repository, Folder
To validate everything is working, run some :ref:`tests` or walk through some :ref:`examples`.

View File

@ -1,132 +0,0 @@
@ECHO OFF
REM
REM Licensed to the Apache Software Foundation (ASF) under one
REM or more contributor license agreements. See the NOTICE file
REM distributed with this work for additional information
REM regarding copyright ownership. The ASF licenses this file
REM to you under the Apache License, Version 2.0 (the
REM "License"); you may not use this file except in compliance
REM with the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing,
REM software distributed under the License is distributed on an
REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM KIND, either express or implied. See the License for the
REM specific language governing permissions and limitations
REM under the License.
REM
REM Command file for Sphinx documentation
set SPHINXBUILD=sphinx-build
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\CMISLibrary.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\CMISLibrary.ghc
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end

View File

@ -1,33 +0,0 @@
#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import os
import sys
os.environ['SPHINXBUILD']="sphinx-build"
build_dir = sys.path[0] + "/../build"
os.environ['BUILDDIR']=build_dir
os.environ['SOURCEDIR']=sys.path[0]
# force a clean every time
print "Removing build dir: %s" % build_dir
os.system("rm -rf " + build_dir)
os.system("make -e --makefile=" + sys.path[0] + "/Makefile html")
zip_file = sys.path[0] + "/../docs.zip"
os.system("rm " + zip_file)
os.chdir(build_dir)
os.system("zip -r " + zip_file + " *")

View File

@ -1,24 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Sample Data
===========
The /path/to/cmislib/src/data directory contains some sample XML responses from a CMIS service. These are for sample and development purposes and can safely be ignored if you are an end-user of the library.
In some cases there are two files for the same response. For example, 'types.xml' came from Alfresco while 'types.chemistry.xml' came from the simple Apache Chemistry test server.

View File

@ -1,43 +0,0 @@
..
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
.. _tests:
=====
Tests
=====
This code includes unit tests. To run the tests::
cd /path/to/cmislib/tests
Edit settings.py
Set REPOSITORY_URL, USERNAME, PASSWORD
Optionally, set TEST_ROOT_PATH and other settings to meet your needs
python cmislibtest.py
.. note::
http://cmis.alfresco.com is a freely-available, hosted CMIS service. If you want to use that for testing, the URL is http://cmis.alfresco.com/s/cmis and the username and password are admin/admin. See the wiki for other known CMIS test servers.
If everything goes well, you should see::
Ran X tests in 3.607s
OK
.. note::
Depending on the implementation of the CMIS provider, you may see errors or failures instead of 'OK'.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -1,19 +0,0 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
from cmislibtest import *

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,56 +0,0 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
# Override these settings with values to match your environment.
#
# CMIS repository's service URL
#REPOSITORY_URL = 'http://cmis.alfresco.com/s/cmis' # Alfresco demo
#REPOSITORY_URL = 'http://localhost:8080/chemistry/atom' # Apache Chemistry
REPOSITORY_URL = 'http://localhost:8080/alfresco/cmisatom' # Alfresco 4.0
#REPOSITORY_URL = 'http://localhost:8080/alfresco/s/api/cmis' # Alfresco
#REPOSITORY_URL = 'http://cmis.demo.nuxeo.org/nuxeo/atom/cmis' # Nuxeo demo
#REPOSITORY_URL = 'http://localhost:8080/nuxeo/atom/cmis' # Nuxeo local
# CMIS repository credentials
USERNAME = 'admin' # Alfresco
PASSWORD = 'admin' # Alfresco
#USERNAME = ''
#PASSWORD = ''
#USERNAME = 'Administrator' # Nuxeo
#PASSWORD = 'Administrator' # Nuxeo
EXT_ARGS = {}
#EXT_ARGS = {'alf_ticket': 'TICKET_cef29079d8d5341338bf372b08278bc30ec89380'}
# Absolute path to a directory where test folders can be created, including
# the trailing slash.
#TEST_ROOT_PATH = '/default-domain/workspaces/cmislib' # No trailing slash
TEST_ROOT_PATH = '/cmislib' # No trailing slash
#TEST_ROOT_PATH = '/'
# Binary test files. Assumed to exist in the same dir as this python script
TEST_BINARY_1 = '250px-Cmis_logo.png'
TEST_BINARY_2 = 'sample-a.pdf'
# For repositories that support setting an ACL, the name of an existing
# principal ID to add to the ACL of a test object. Some repositories care
# if this ID doesn't exist. Some repositories don't.
TEST_PRINCIPAL_ID = 'tuser1'
# For repositories that may index test content asynchronously, the number of
# times a query is retried before giving up.
MAX_FULL_TEXT_TRIES = 10
# The number of seconds the test should sleep between tries.
FULL_TEXT_WAIT = 10