active_cmis 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +0 -1
- data/active_cmis.gemspec +3 -4
- data/lib/active_cmis/internal/connection.rb +46 -20
- data/lib/active_cmis/object.rb +1 -1
- data/lib/active_cmis/repository.rb +47 -0
- data/lib/active_cmis/version.rb +1 -1
- metadata +67 -90
data/Rakefile
CHANGED
data/active_cmis.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{active_cmis}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joeri Samson"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-30}
|
13
13
|
s.description = %q{A CMIS library implementing both reading and updating capabilities through the AtomPub/REST binding to CMIS.}
|
14
14
|
s.email = %q{joeri@xaop.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -52,11 +52,10 @@ Gem::Specification.new do |s|
|
|
52
52
|
s.homepage = %q{http://xaop.com/labs/activecmis/}
|
53
53
|
s.require_paths = ["lib"]
|
54
54
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.6")
|
55
|
-
s.rubygems_version = %q{1.
|
55
|
+
s.rubygems_version = %q{1.6.2}
|
56
56
|
s.summary = %q{A library to interact with CMIS repositories through the AtomPub/REST binding}
|
57
57
|
|
58
58
|
if s.respond_to? :specification_version then
|
59
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
60
59
|
s.specification_version = 3
|
61
60
|
|
62
61
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -171,26 +171,52 @@ module ActiveCMIS
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def handle_request(uri, req)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
#
|
191
|
-
|
192
|
-
|
193
|
-
|
174
|
+
catch(:retry) do
|
175
|
+
logger.debug "#{req.method} #{uri}"
|
176
|
+
http = authenticate_request(uri, req)
|
177
|
+
|
178
|
+
status, body, headers = nil
|
179
|
+
http.request(req) { |resp|
|
180
|
+
status = resp.code.to_i
|
181
|
+
body = resp.body
|
182
|
+
headers = resp.header
|
183
|
+
}
|
184
|
+
|
185
|
+
logger.debug "RECEIVED #{status}"
|
186
|
+
|
187
|
+
if 200 <= status && status < 300
|
188
|
+
return body
|
189
|
+
elsif 300 <= status && status < 400
|
190
|
+
# follow the redirected a limited number of times
|
191
|
+
retry_count = (retry_count || 0) + 1
|
192
|
+
location = headers["location"]
|
193
|
+
logger.debug "REDIRECTING: #{location.inspect}"
|
194
|
+
if retry_count <= 3
|
195
|
+
new_uri = URI.parse(location)
|
196
|
+
if new_uri.relative?
|
197
|
+
uri = uri + location
|
198
|
+
end
|
199
|
+
req = req.class.new(uri.request_uri)
|
200
|
+
throw(:retry)
|
201
|
+
else
|
202
|
+
raise HTTPError.new("Too many redirects")
|
203
|
+
end
|
204
|
+
elsif 400 <= status && status < 500
|
205
|
+
# Problem: some codes 400, 405, 403, 409, 500 have multiple meanings
|
206
|
+
logger.error "Error occurred when handling request:\n#{body}"
|
207
|
+
case status
|
208
|
+
when 400; raise Error::InvalidArgument.new(body)
|
209
|
+
# FIXME: can also be filterNotValid
|
210
|
+
when 401; raise HTTPError::AuthenticationError.new(body)
|
211
|
+
when 404; raise Error::ObjectNotFound.new(body)
|
212
|
+
when 403; raise Error::PermissionDenied.new(body)
|
213
|
+
# FIXME: can also be streamNotSupported (?? shouldn't that be 405??)
|
214
|
+
when 405; raise Error::NotSupported.new(body)
|
215
|
+
else
|
216
|
+
raise HTTPError::ClientError.new("A HTTP #{status} error occured, for more precision update the code:\n" + body)
|
217
|
+
end
|
218
|
+
elsif 400 <= status && status < 500
|
219
|
+
raise HTTPError::ServerError.new("The server encountered an internal error #{status} (this could be a client error though):\n" + body)
|
194
220
|
end
|
195
221
|
end
|
196
222
|
end
|
data/lib/active_cmis/object.rb
CHANGED
@@ -226,7 +226,7 @@ module ActiveCMIS
|
|
226
226
|
unless parent_feed.empty?
|
227
227
|
Collection.new(repository, parent_feed.first)
|
228
228
|
else
|
229
|
-
parent_entry = Internal::Utils.extract_links(data, 'up', 'application/atom+xml','type' => '
|
229
|
+
parent_entry = Internal::Utils.extract_links(data, 'up', 'application/atom+xml','type' => 'entry')
|
230
230
|
unless parent_entry.empty?
|
231
231
|
e = conn.get_atom_entry(parent_entry.first)
|
232
232
|
[ActiveCMIS::Object.from_atom_entry(repository, e)]
|
@@ -40,6 +40,53 @@ module ActiveCMIS
|
|
40
40
|
@cmis_version ||= data.xpath("cra:repositoryInfo/c:cmisVersionSupported", NS::COMBINED).text
|
41
41
|
end
|
42
42
|
|
43
|
+
# The name of the repository, meant for display purposes
|
44
|
+
# @return [String]
|
45
|
+
def name
|
46
|
+
@name ||= data.xpath("cra:repositoryInfo/c:repositoryName", NS::COMBINED).text
|
47
|
+
end
|
48
|
+
|
49
|
+
# A description of the repository
|
50
|
+
# @return [String]
|
51
|
+
def description
|
52
|
+
@name ||= data.xpath("cra:repositoryInfo/c:repositoryDescription", NS::COMBINED).text
|
53
|
+
end
|
54
|
+
|
55
|
+
# The name of the vendor of this Repository
|
56
|
+
# @return [String]
|
57
|
+
def vendor
|
58
|
+
@vendor ||= data.xpath("cra:repositoryInfo/c:vendorName", NS::COMBINED).text
|
59
|
+
end
|
60
|
+
|
61
|
+
# The name of the product behind this Repository
|
62
|
+
# @return [String]
|
63
|
+
def product_name
|
64
|
+
@product_name ||= data.xpath("cra:repositoryInfo/c:productName", NS::COMBINED).text
|
65
|
+
end
|
66
|
+
|
67
|
+
# The version of the product behind this Repository
|
68
|
+
# @return [String]
|
69
|
+
def product_version
|
70
|
+
@product_version ||= data.xpath("cra:repositoryInfo/c:productVersion", NS::COMBINED).text
|
71
|
+
end
|
72
|
+
|
73
|
+
# Changelog token representing the most recent change to this repository (will
|
74
|
+
# represent the most recent change at the time that this ActiveCMIS::Repository
|
75
|
+
# was created
|
76
|
+
# @return [String]
|
77
|
+
def latest_changelog_token
|
78
|
+
@changelog_token ||= data.xpath("cra:repositoryInfo/c:latestChangeLogToken", NS::COMBINED).text
|
79
|
+
end
|
80
|
+
|
81
|
+
# A URI that points to a web service for this repository. May not be present
|
82
|
+
# @return [URI, nil]
|
83
|
+
def thin_client_uri
|
84
|
+
@thin_client_uri ||= begin
|
85
|
+
string = data.xpath("cra:repositoryInfo/c:thinClientURI", NS::COMBINED).text
|
86
|
+
URI.parse(string) if string && string != ""
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
43
90
|
# Finds the object with a given ID in the repository
|
44
91
|
#
|
45
92
|
# @param [String] id
|
data/lib/active_cmis/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_cmis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 3
|
10
|
-
version: 0.2.3
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.4
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
|
-
- Joeri Samson
|
8
|
+
- Joeri Samson
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-09-30 00:00:00 +02:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 25
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 1
|
49
|
-
- 1
|
50
|
-
version: 0.1.1
|
51
|
-
type: :runtime
|
52
|
-
version_requirements: *id002
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: nokogiri
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.4.1
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ntlm-http
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.1.1
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
53
38
|
description: A CMIS library implementing both reading and updating capabilities through the AtomPub/REST binding to CMIS.
|
54
39
|
email: joeri@xaop.com
|
55
40
|
executables: []
|
@@ -57,40 +42,40 @@ executables: []
|
|
57
42
|
extensions: []
|
58
43
|
|
59
44
|
extra_rdoc_files:
|
60
|
-
- LICENSE
|
61
|
-
- README.md
|
62
|
-
- TODO
|
45
|
+
- LICENSE
|
46
|
+
- README.md
|
47
|
+
- TODO
|
63
48
|
files:
|
64
|
-
- LICENSE
|
65
|
-
- README.md
|
66
|
-
- Rakefile
|
67
|
-
- TODO
|
68
|
-
- active_cmis.gemspec
|
69
|
-
- lib/active_cmis.rb
|
70
|
-
- lib/active_cmis/acl.rb
|
71
|
-
- lib/active_cmis/acl_entry.rb
|
72
|
-
- lib/active_cmis/active_cmis.rb
|
73
|
-
- lib/active_cmis/atomic_types.rb
|
74
|
-
- lib/active_cmis/attribute_prefix.rb
|
75
|
-
- lib/active_cmis/collection.rb
|
76
|
-
- lib/active_cmis/document.rb
|
77
|
-
- lib/active_cmis/exceptions.rb
|
78
|
-
- lib/active_cmis/folder.rb
|
79
|
-
- lib/active_cmis/internal/caching.rb
|
80
|
-
- lib/active_cmis/internal/connection.rb
|
81
|
-
- lib/active_cmis/internal/utils.rb
|
82
|
-
- lib/active_cmis/ns.rb
|
83
|
-
- lib/active_cmis/object.rb
|
84
|
-
- lib/active_cmis/policy.rb
|
85
|
-
- lib/active_cmis/property_definition.rb
|
86
|
-
- lib/active_cmis/query_result.rb
|
87
|
-
- lib/active_cmis/rel.rb
|
88
|
-
- lib/active_cmis/relationship.rb
|
89
|
-
- lib/active_cmis/rendition.rb
|
90
|
-
- lib/active_cmis/repository.rb
|
91
|
-
- lib/active_cmis/server.rb
|
92
|
-
- lib/active_cmis/type.rb
|
93
|
-
- lib/active_cmis/version.rb
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- TODO
|
53
|
+
- active_cmis.gemspec
|
54
|
+
- lib/active_cmis.rb
|
55
|
+
- lib/active_cmis/acl.rb
|
56
|
+
- lib/active_cmis/acl_entry.rb
|
57
|
+
- lib/active_cmis/active_cmis.rb
|
58
|
+
- lib/active_cmis/atomic_types.rb
|
59
|
+
- lib/active_cmis/attribute_prefix.rb
|
60
|
+
- lib/active_cmis/collection.rb
|
61
|
+
- lib/active_cmis/document.rb
|
62
|
+
- lib/active_cmis/exceptions.rb
|
63
|
+
- lib/active_cmis/folder.rb
|
64
|
+
- lib/active_cmis/internal/caching.rb
|
65
|
+
- lib/active_cmis/internal/connection.rb
|
66
|
+
- lib/active_cmis/internal/utils.rb
|
67
|
+
- lib/active_cmis/ns.rb
|
68
|
+
- lib/active_cmis/object.rb
|
69
|
+
- lib/active_cmis/policy.rb
|
70
|
+
- lib/active_cmis/property_definition.rb
|
71
|
+
- lib/active_cmis/query_result.rb
|
72
|
+
- lib/active_cmis/rel.rb
|
73
|
+
- lib/active_cmis/relationship.rb
|
74
|
+
- lib/active_cmis/rendition.rb
|
75
|
+
- lib/active_cmis/repository.rb
|
76
|
+
- lib/active_cmis/server.rb
|
77
|
+
- lib/active_cmis/type.rb
|
78
|
+
- lib/active_cmis/version.rb
|
94
79
|
has_rdoc: true
|
95
80
|
homepage: http://xaop.com/labs/activecmis/
|
96
81
|
licenses: []
|
@@ -99,31 +84,23 @@ post_install_message:
|
|
99
84
|
rdoc_options: []
|
100
85
|
|
101
86
|
require_paths:
|
102
|
-
- lib
|
87
|
+
- lib
|
103
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
89
|
none: false
|
105
90
|
requirements:
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
segments:
|
110
|
-
- 1
|
111
|
-
- 8
|
112
|
-
- 6
|
113
|
-
version: 1.8.6
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.8.6
|
114
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
95
|
none: false
|
116
96
|
requirements:
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
segments:
|
121
|
-
- 0
|
122
|
-
version: "0"
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
123
100
|
requirements: []
|
124
101
|
|
125
102
|
rubyforge_project:
|
126
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 1.6.2
|
127
104
|
signing_key:
|
128
105
|
specification_version: 3
|
129
106
|
summary: A library to interact with CMIS repositories through the AtomPub/REST binding
|