cmis 0.2.2-java → 0.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -11
- data/lib/cmis/content_helpers.rb +10 -0
- data/lib/cmis/enums.rb +26 -0
- data/lib/cmis/imports.rb +12 -0
- data/lib/cmis/object_impl.rb +42 -0
- data/lib/cmis/session_helpers.rb +29 -0
- data/lib/cmis/version.rb +2 -2
- data/lib/cmis.rb +6 -135
- data/pom.xml +1 -1
- data/spec/cmis_spec.rb +2 -22
- data/target/dependency/chemistry-opencmis-client-api-0.9.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-client-bindings-0.9.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-client-impl-0.9.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-commons-api-0.9.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-commons-impl-0.9.0.jar +0 -0
- data/target/dependency/slf4j-api-1.7.5.jar +0 -0
- data/target/dependency/stax2-api-3.1.1.jar +0 -0
- data/target/dependency/woodstox-core-asl-4.2.0.jar +0 -0
- metadata +23 -21
- data/target/dependency/chemistry-opencmis-client-api-0.8.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-client-bindings-0.8.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-client-impl-0.8.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-commons-api-0.8.0.jar +0 -0
- data/target/dependency/chemistry-opencmis-commons-impl-0.8.0.jar +0 -0
- data/target/dependency/slf4j-api-1.6.6.jar +0 -0
- data/target/dependency/wstx-asl-3.2.3.jar +0 -0
data/README.md
CHANGED
@@ -4,7 +4,9 @@ CMIS client for JRuby. This gem uses the Apache Chemistry OpenCMIS Java librarie
|
|
4
4
|
|
5
5
|
More information about Apache Chemistry can be found here: http://chemistry.apache.org/
|
6
6
|
|
7
|
-
|
7
|
+
[![Code Climate](https://codeclimate.com/github/ricn/cmis.png)](https://codeclimate.com/github/ricn/cmis)
|
8
|
+
|
9
|
+
## What is CMIS?
|
8
10
|
|
9
11
|
Content Management Interoperability Services (CMIS) is an open standard that defines an abstraction layer for controlling diverse document management systems and repositories using web protocols. CMIS defines a domain model plus Web Services and Restful AtomPub (RFC5023) bindings that can be used by applications.
|
10
12
|
|
@@ -35,7 +37,7 @@ Or install it yourself as:
|
|
35
37
|
## Notes about JRuby and OpenCMIS
|
36
38
|
Every call you do in this library that returns an object actually returns a real Java object from OpenCMIS so you have access to all the functionality that OpenCMIS provides.
|
37
39
|
|
38
|
-
If you want to do something that is not described in the documentation below you can read the [OpenCMIS JavaDoc](http://chemistry.apache.org/java/0.
|
40
|
+
If you want to do something that is not described in the documentation below you can read the [OpenCMIS JavaDoc](http://chemistry.apache.org/java/0.9.0/maven/apidocs/) and you should figure out how to do it.
|
39
41
|
|
40
42
|
## Usage
|
41
43
|
|
@@ -72,7 +74,7 @@ puts "Trying to connect to a repository with id #{available_repos[0].id}"
|
|
72
74
|
|
73
75
|
```
|
74
76
|
|
75
|
-
Note: The create_session method returns a real [Session](http://chemistry.apache.org/java/0.
|
77
|
+
Note: The create_session method returns a real [Session](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Session.html) object that is used in OpenCMIS so you have access to every functionality that the Session object provides.
|
76
78
|
|
77
79
|
## Working with folders and documents
|
78
80
|
|
@@ -104,7 +106,7 @@ root.create_folder(folder_props)
|
|
104
106
|
puts folder.name
|
105
107
|
```
|
106
108
|
|
107
|
-
Note: When you create a folder it will return an actual Java OpenCMIS Folder object. That means you have access to everything it provides. [More information can be found in the JavaDoc for the Folder interface](http://chemistry.apache.org/java/0.
|
109
|
+
Note: When you create a folder it will return an actual Java OpenCMIS Folder object. That means you have access to everything it provides. [More information can be found in the JavaDoc for the Folder interface](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Folder.html)
|
108
110
|
|
109
111
|
### Creating/Uploading documents
|
110
112
|
|
@@ -127,7 +129,7 @@ doc = @session.get_object(id)
|
|
127
129
|
puts doc.name
|
128
130
|
```
|
129
131
|
|
130
|
-
Note: When you create a document it will return an actual Java OpenCMIS Document object. That means you have access to everything it provides. [More information can be found in the JavaDoc for the Document interface](http://chemistry.apache.org/java/0.
|
132
|
+
Note: When you create a document it will return an actual Java OpenCMIS Document object. That means you have access to everything it provides. [More information can be found in the JavaDoc for the Document interface](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Document.html)
|
131
133
|
|
132
134
|
#### Download a document to your local disc
|
133
135
|
|
@@ -207,7 +209,7 @@ end
|
|
207
209
|
|
208
210
|
### Getting a property explicitly
|
209
211
|
|
210
|
-
Each object type has a known set of properties, and you can retrieve these explicitly. For example, the document type has a set of properties described by the [DocumentProperties](http://chemistry.apache.org/java/0.
|
212
|
+
Each object type has a known set of properties, and you can retrieve these explicitly. For example, the document type has a set of properties described by the [DocumentProperties](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/DocumentProperties.html) interface, and you can use the methods on this interface to retrieve the value a property.
|
211
213
|
|
212
214
|
```ruby
|
213
215
|
# For root folder
|
@@ -234,7 +236,7 @@ allowed_actions.each do |a|
|
|
234
236
|
end
|
235
237
|
```
|
236
238
|
|
237
|
-
A complete list of actions can be found here: http://chemistry.apache.org/java/0.
|
239
|
+
A complete list of actions can be found here: http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/commons/enums/Action.html
|
238
240
|
|
239
241
|
## Working with CMIS Queries
|
240
242
|
|
@@ -289,7 +291,7 @@ puts "ACL: " + cap.acl_capability.value
|
|
289
291
|
|
290
292
|
## Paging
|
291
293
|
When you retrieve the children of a CMIS object, the result set returned is of an arbitrary size. Retrieving a large result set synchronously could increase response times. To improve performance, you can use OpenCMIS's paging support to control the size of the result set retrieved from the repository. To use paging,
|
292
|
-
you must specify an [OperationContext](http://chemistry.apache.org/java/0.
|
294
|
+
you must specify an [OperationContext](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/OperationContext.html) when invoking children method call on the parent object. The OperationContext specifies the maximum number of items to retrieve in a page.
|
293
295
|
|
294
296
|
```ruby
|
295
297
|
root = @session.root_folder
|
@@ -323,7 +325,7 @@ puts "Rendition support: " + @session.repository_info.capabilities.renditions_ca
|
|
323
325
|
|
324
326
|
id = @session.root_folder.create_text_doc("simple file.txt", "My content")
|
325
327
|
context = @session.create_operation_context
|
326
|
-
context.rendition_filter_string = "
|
328
|
+
context.rendition_filter_string = "*"
|
327
329
|
doc = @session.get_object(id, context)
|
328
330
|
|
329
331
|
renditions = doc.renditions
|
@@ -453,9 +455,9 @@ puts rel.target.id
|
|
453
455
|
```
|
454
456
|
|
455
457
|
## Exceptions
|
456
|
-
If something goes wrong in an OpenCMIS method, an exception will be thrown. All OpenCMIS exceptions extend [CmisBaseException](http://chemistry.apache.org/java/0.
|
458
|
+
If something goes wrong in an OpenCMIS method, an exception will be thrown. All OpenCMIS exceptions extend [CmisBaseException](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/commons/exceptions/package-tree.html) which is a Java runtime exception. Because all exceptions are runtime, you do not have to catch or specify the exceptions in your own code.
|
457
459
|
|
458
|
-
When you are using the ATOMPUB binding, [CmisBaseException](http://chemistry.apache.org/java/0.
|
460
|
+
When you are using the ATOMPUB binding, [CmisBaseException](http://chemistry.apache.org/java/0.9.0/maven/apidocs/org/apache/chemistry/opencmis/commons/exceptions/package-tree.html) provides a error_content method which returns the content of the error page returned from the server, if there is one. This can be very useful when debugging, as the server side is normally able to provide far more information that the client.
|
459
461
|
In the following example, a CMISInvalidArgumentException exception is forced by trying to create a folder with an invalid type. The rescue block prints the server's error page:
|
460
462
|
|
461
463
|
```ruby
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module CMIS
|
2
|
+
def self.create_content_stream(filename, session)
|
3
|
+
file = java.io.File.new(filename)
|
4
|
+
file_input_stream = java.io.FileInputStream.new(file)
|
5
|
+
stream = java.io.BufferedInputStream.new(file_input_stream)
|
6
|
+
content = session.object_factory.create_content_stream(file.name, file.length, MimeTypes.getMIMEType(file), stream)
|
7
|
+
|
8
|
+
content
|
9
|
+
end
|
10
|
+
end
|
data/lib/cmis/enums.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module CMIS
|
2
|
+
import org.apache.chemistry.opencmis.commons.enums.Action
|
3
|
+
import org.apache.chemistry.opencmis.commons.enums.AclPropagation
|
4
|
+
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId
|
5
|
+
import org.apache.chemistry.opencmis.commons.enums.CapabilityAcl
|
6
|
+
import org.apache.chemistry.opencmis.commons.enums.VersioningState
|
7
|
+
import org.apache.chemistry.opencmis.commons.enums.UnfileObject
|
8
|
+
import org.apache.chemistry.opencmis.commons.enums.BindingType
|
9
|
+
import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges
|
10
|
+
import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates
|
11
|
+
import org.apache.chemistry.opencmis.commons.enums.CapabilityJoin
|
12
|
+
import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery
|
13
|
+
import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions
|
14
|
+
import org.apache.chemistry.opencmis.commons.enums.Cardinality
|
15
|
+
import org.apache.chemistry.opencmis.commons.enums.ChangeType
|
16
|
+
import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed
|
17
|
+
import org.apache.chemistry.opencmis.commons.enums.DateTimeResolution
|
18
|
+
import org.apache.chemistry.opencmis.commons.enums.DecimalPrecision
|
19
|
+
import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel
|
20
|
+
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships
|
21
|
+
import org.apache.chemistry.opencmis.commons.enums.PropertyType
|
22
|
+
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection
|
23
|
+
import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions
|
24
|
+
import org.apache.chemistry.opencmis.commons.enums.UnfileObject
|
25
|
+
import org.apache.chemistry.opencmis.commons.enums.Updatability
|
26
|
+
end
|
data/lib/cmis/imports.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module CMIS
|
2
|
+
import org.apache.chemistry.opencmis.client.api.Session
|
3
|
+
import org.apache.chemistry.opencmis.client.api.SessionFactory
|
4
|
+
import org.apache.chemistry.opencmis.client.api.OperationContext
|
5
|
+
import org.apache.chemistry.opencmis.client.util.FileUtils
|
6
|
+
import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl
|
7
|
+
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl
|
8
|
+
import org.apache.chemistry.opencmis.commons.SessionParameter
|
9
|
+
import org.apache.chemistry.opencmis.commons.PropertyIds
|
10
|
+
import org.apache.chemistry.opencmis.commons.impl.MimeTypes
|
11
|
+
import org.apache.chemistry.opencmis.commons.data.AclCapabilities
|
12
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module CMIS
|
2
|
+
FolderImpl = org.apache.chemistry.opencmis.client.runtime.FolderImpl
|
3
|
+
DocumentImpl = org.apache.chemistry.opencmis.client.runtime.DocumentImpl
|
4
|
+
|
5
|
+
# Explanation: https://github.com/jruby/jruby/wiki/Persistence
|
6
|
+
DocumentImpl.__persistent__ = true
|
7
|
+
FolderImpl.__persistent__ = true
|
8
|
+
|
9
|
+
class DocumentImpl
|
10
|
+
def download(destination_path)
|
11
|
+
FileUtils.download(self, destination_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def allowed_actions
|
15
|
+
self.allowable_actions.allowable_actions.to_a
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class FolderImpl
|
20
|
+
def create_cmis_folder(name, props = nil)
|
21
|
+
folder_props = { PropertyIds::OBJECT_TYPE_ID => "cmis:folder", PropertyIds::NAME => name }
|
22
|
+
folder_props.merge!(props) if props != nil && props.is_a?(Hash)
|
23
|
+
self.create_folder(java.util.HashMap.new(folder_props))
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_cmis_document(name, filename, props = nil)
|
27
|
+
content = CMIS::create_content_stream(filename, session)
|
28
|
+
doc_props = { PropertyIds::OBJECT_TYPE_ID => "cmis:document", PropertyIds::NAME => name }
|
29
|
+
doc_props.merge!(props) if props != nil && props.is_a?(Hash)
|
30
|
+
self.create_document(java.util.HashMap.new(doc_props), content, VersioningState::MAJOR)
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_text_doc(name, content)
|
34
|
+
FileUtils.create_text_document(self.id, name, content, "cmis:document", VersioningState::MAJOR, session)
|
35
|
+
end
|
36
|
+
|
37
|
+
def allowed_actions
|
38
|
+
self.allowable_actions.allowable_actions.to_a
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CMIS
|
2
|
+
def self.create_session(url, user, password, repo_id = nil)
|
3
|
+
session_factory = SessionFactoryImpl.new_instance
|
4
|
+
params = session_params(url, user, password)
|
5
|
+
repo_id = self.repositories(url, user, password)[0].id if repo_id == nil
|
6
|
+
params[SessionParameter::REPOSITORY_ID] = repo_id
|
7
|
+
session_factory.create_session(java.util.HashMap.new(params))
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.repositories(url, user, password)
|
11
|
+
session_factory = SessionFactoryImpl.new_instance
|
12
|
+
params = session_params(url, user, password)
|
13
|
+
session_factory.get_repositories(java.util.HashMap.new(params))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def self.session_params(url, user, password)
|
19
|
+
params = {
|
20
|
+
SessionParameter::ATOMPUB_URL => url,
|
21
|
+
SessionParameter::BINDING_TYPE => BindingType::ATOMPUB.value,
|
22
|
+
SessionParameter::USER => user,
|
23
|
+
SessionParameter::PASSWORD => password
|
24
|
+
}
|
25
|
+
|
26
|
+
params
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/lib/cmis/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module CMIS
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "0.3.0"
|
3
|
+
end
|
data/lib/cmis.rb
CHANGED
@@ -1,143 +1,14 @@
|
|
1
1
|
raise "You need to run JRuby to use CMIS" unless RUBY_PLATFORM =~ /java/
|
2
2
|
|
3
|
-
require "cmis/version"
|
4
3
|
require 'java'
|
5
4
|
|
6
5
|
Dir[File.join(File.dirname(__FILE__), "../target/dependency/*.jar")].each do |jar|
|
7
6
|
require jar
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl
|
17
|
-
import org.apache.chemistry.opencmis.commons.SessionParameter
|
18
|
-
import org.apache.chemistry.opencmis.commons.PropertyIds
|
19
|
-
import org.apache.chemistry.opencmis.commons.impl.MimeTypes
|
20
|
-
import org.apache.chemistry.opencmis.commons.data.AclCapabilities
|
21
|
-
|
22
|
-
import org.apache.chemistry.opencmis.commons.enums.Action
|
23
|
-
import org.apache.chemistry.opencmis.commons.enums.AclPropagation
|
24
|
-
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId
|
25
|
-
import org.apache.chemistry.opencmis.commons.enums.CapabilityAcl
|
26
|
-
import org.apache.chemistry.opencmis.commons.enums.VersioningState
|
27
|
-
import org.apache.chemistry.opencmis.commons.enums.UnfileObject
|
28
|
-
import org.apache.chemistry.opencmis.commons.enums.BindingType
|
29
|
-
import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges
|
30
|
-
import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates
|
31
|
-
import org.apache.chemistry.opencmis.commons.enums.CapabilityJoin
|
32
|
-
import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery
|
33
|
-
import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions
|
34
|
-
import org.apache.chemistry.opencmis.commons.enums.Cardinality
|
35
|
-
import org.apache.chemistry.opencmis.commons.enums.ChangeType
|
36
|
-
import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed
|
37
|
-
import org.apache.chemistry.opencmis.commons.enums.DateTimeResolution
|
38
|
-
import org.apache.chemistry.opencmis.commons.enums.DecimalPrecision
|
39
|
-
import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel
|
40
|
-
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships
|
41
|
-
import org.apache.chemistry.opencmis.commons.enums.PropertyType
|
42
|
-
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection
|
43
|
-
import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions
|
44
|
-
import org.apache.chemistry.opencmis.commons.enums.UnfileObject
|
45
|
-
import org.apache.chemistry.opencmis.commons.enums.Updatability
|
46
|
-
|
47
|
-
FolderImpl = org.apache.chemistry.opencmis.client.runtime.FolderImpl
|
48
|
-
DocumentImpl = org.apache.chemistry.opencmis.client.runtime.DocumentImpl
|
49
|
-
|
50
|
-
# Explanation: https://github.com/jruby/jruby/wiki/Persistence
|
51
|
-
DocumentImpl.__persistent__ = true
|
52
|
-
FolderImpl.__persistent__ = true
|
53
|
-
|
54
|
-
class DocumentImpl
|
55
|
-
def download(destination_path)
|
56
|
-
FileUtils.download(self, destination_path)
|
57
|
-
end
|
58
|
-
|
59
|
-
def allowed_actions
|
60
|
-
self.allowable_actions.allowable_actions.to_a
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
class FolderImpl
|
65
|
-
def create_cmis_folder(name, props = nil)
|
66
|
-
folder_props = { PropertyIds::OBJECT_TYPE_ID => "cmis:folder", PropertyIds::NAME => name }
|
67
|
-
folder_props.merge!(props) if props != nil && props.is_a?(Hash)
|
68
|
-
self.create_folder(java.util.HashMap.new(folder_props))
|
69
|
-
end
|
70
|
-
|
71
|
-
def create_cmis_document(name, filename, props = nil)
|
72
|
-
if filename != nil && filename.length > 0
|
73
|
-
file = java.io.File.new(filename)
|
74
|
-
stream = java.io.BufferedInputStream.new(java.io.FileInputStream.new(file))
|
75
|
-
content = session.object_factory.create_content_stream(file.name, file.length, CMIS::MimeTypes.getMIMEType(file), stream)
|
76
|
-
doc_props = { CMIS::PropertyIds::OBJECT_TYPE_ID => "cmis:document", CMIS::PropertyIds::NAME => name }
|
77
|
-
doc_props.merge!(props) if props != nil && props.is_a?(Hash)
|
78
|
-
self.create_document(java.util.HashMap.new(doc_props), content, CMIS::VersioningState::MAJOR)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def create_text_doc(name, content)
|
83
|
-
FileUtils.create_text_document(self.id, name, content, "cmis:document", CMIS::VersioningState::MAJOR, session)
|
84
|
-
end
|
85
|
-
|
86
|
-
def allowed_actions
|
87
|
-
self.allowable_actions.allowable_actions.to_a
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.create_session(url, user, password, repo_id = nil)
|
92
|
-
session_factory = SessionFactoryImpl.new_instance
|
93
|
-
repo_id = self.repositories(url, user, password)[0].id if repo_id == nil
|
94
|
-
|
95
|
-
params = {
|
96
|
-
SessionParameter::ATOMPUB_URL => url,
|
97
|
-
SessionParameter::BINDING_TYPE => BindingType::ATOMPUB.value,
|
98
|
-
SessionParameter::USER => user,
|
99
|
-
SessionParameter::PASSWORD => password,
|
100
|
-
SessionParameter::REPOSITORY_ID => repo_id
|
101
|
-
}
|
102
|
-
|
103
|
-
session_factory.create_session(java.util.HashMap.new(params))
|
104
|
-
end
|
105
|
-
|
106
|
-
def self.create_session_with_soap(user, password, web_services, repo_id = nil)
|
107
|
-
session_factory = SessionFactoryImpl.new_instance
|
108
|
-
repo_id = self.repositories(url, user, password)[0].id if repo_id == nil
|
109
|
-
|
110
|
-
params = {
|
111
|
-
SessionParameter::BINDING_TYPE => BindingType::WEBSERVICES.value,
|
112
|
-
SessionParameter::USER => user,
|
113
|
-
SessionParameter::PASSWORD => password,
|
114
|
-
SessionParameter::REPOSITORY_ID => repo_id
|
115
|
-
}.merge!(web_services)
|
116
|
-
|
117
|
-
session_factory.create_session(java.util.HashMap.new(params))
|
118
|
-
end
|
119
|
-
|
120
|
-
def self.repositories(url, user, password)
|
121
|
-
session_factory = SessionFactoryImpl.new_instance
|
122
|
-
params = {
|
123
|
-
SessionParameter::ATOMPUB_URL => url,
|
124
|
-
SessionParameter::BINDING_TYPE => BindingType::ATOMPUB.value,
|
125
|
-
SessionParameter::USER => user,
|
126
|
-
SessionParameter::PASSWORD => password
|
127
|
-
}
|
128
|
-
|
129
|
-
session_factory.get_repositories(java.util.HashMap.new(params))
|
130
|
-
end
|
131
|
-
|
132
|
-
def self.create_content_stream(filename, session)
|
133
|
-
content = nil
|
134
|
-
|
135
|
-
if filename != nil && filename.length > 0
|
136
|
-
file = java.io.File.new(filename)
|
137
|
-
stream = java.io.BufferedInputStream.new(java.io.FileInputStream.new(file))
|
138
|
-
content = session.object_factory.create_content_stream(file.name, file.length, CMIS::MimeTypes.getMIMEType(file), stream)
|
139
|
-
end
|
140
|
-
|
141
|
-
content
|
142
|
-
end
|
143
|
-
end
|
9
|
+
require 'cmis/version'
|
10
|
+
require 'cmis/enums'
|
11
|
+
require 'cmis/imports'
|
12
|
+
require 'cmis/object_impl'
|
13
|
+
require 'cmis/content_helpers'
|
14
|
+
require 'cmis/session_helpers'
|
data/pom.xml
CHANGED
data/spec/cmis_spec.rb
CHANGED
@@ -100,7 +100,7 @@ describe "CMIS" do
|
|
100
100
|
file_name = random_name + ".pdf"
|
101
101
|
id = @test_folder.create_cmis_document(file_name, file)
|
102
102
|
context = @session.create_operation_context
|
103
|
-
context.rendition_filter_string = "
|
103
|
+
context.rendition_filter_string = "*"
|
104
104
|
@session.clear
|
105
105
|
doc = @session.get_object(id, context)
|
106
106
|
|
@@ -317,7 +317,7 @@ describe "CMIS" do
|
|
317
317
|
it "should not change token if nothing is changed" do
|
318
318
|
latest_token = @session.repository_info.get_latest_change_log_token
|
319
319
|
#Do nothing
|
320
|
-
changes = @session.get_content_changes(latest_token, true, 1000)
|
320
|
+
changes = @session.get_content_changes(latest_token, true, 1000)
|
321
321
|
new_token = changes.get_latest_change_log_token
|
322
322
|
new_token.should == latest_token
|
323
323
|
end
|
@@ -325,26 +325,6 @@ describe "CMIS" do
|
|
325
325
|
end
|
326
326
|
|
327
327
|
describe "Local Alfresco" do
|
328
|
-
# Basic test for web service binding
|
329
|
-
it "should be possible to use web services" do
|
330
|
-
repo_id = CMIS::repositories("http://localhost:8181/alfresco/service/cmis", "admin", "admin")[0].id
|
331
|
-
ws_url = "http://localhost:8181/alfresco/cmis/"
|
332
|
-
ws_urls = {
|
333
|
-
CMIS::SessionParameter::WEBSERVICES_ACL_SERVICE => "#{ws_url}ACLService?wsdl",
|
334
|
-
CMIS::SessionParameter::WEBSERVICES_DISCOVERY_SERVICE => "#{ws_url}DiscoveryService?wsdl",
|
335
|
-
CMIS::SessionParameter::WEBSERVICES_MULTIFILING_SERVICE => "#{ws_url}MultiFilingService?wsdl",
|
336
|
-
CMIS::SessionParameter::WEBSERVICES_NAVIGATION_SERVICE => "#{ws_url}NavigationService?wsdl",
|
337
|
-
CMIS::SessionParameter::WEBSERVICES_OBJECT_SERVICE => "#{ws_url}ObjectService?wsdl",
|
338
|
-
CMIS::SessionParameter::WEBSERVICES_POLICY_SERVICE => "#{ws_url}PolicyService?wsdl",
|
339
|
-
CMIS::SessionParameter::WEBSERVICES_RELATIONSHIP_SERVICE => "#{ws_url}RelationshipService?wsdl",
|
340
|
-
CMIS::SessionParameter::WEBSERVICES_REPOSITORY_SERVICE => "#{ws_url}RepositoryService?wsdl",
|
341
|
-
CMIS::SessionParameter::WEBSERVICES_VERSIONING_SERVICE => "#{ws_url}VersioningService?wsdl"
|
342
|
-
}
|
343
|
-
|
344
|
-
@ws_session = CMIS::create_session_with_soap("admin", "admin", ws_urls, repo_id)
|
345
|
-
@ws_session.locale.should_not be_nil
|
346
|
-
end
|
347
|
-
|
348
328
|
atom_url = "http://localhost:8181/alfresco/service/cmis"
|
349
329
|
user = "admin"
|
350
330
|
password = "admin"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -9,23 +9,21 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
MA==
|
20
|
+
version: '0'
|
22
21
|
none: false
|
23
22
|
requirement: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
|
-
- -
|
24
|
+
- - '>='
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
MA==
|
26
|
+
version: '0'
|
29
27
|
none: false
|
30
28
|
prerelease: false
|
31
29
|
type: :development
|
@@ -44,6 +42,11 @@ files:
|
|
44
42
|
- Rakefile
|
45
43
|
- cmis.gemspec
|
46
44
|
- lib/cmis.rb
|
45
|
+
- lib/cmis/content_helpers.rb
|
46
|
+
- lib/cmis/enums.rb
|
47
|
+
- lib/cmis/imports.rb
|
48
|
+
- lib/cmis/object_impl.rb
|
49
|
+
- lib/cmis/session_helpers.rb
|
47
50
|
- lib/cmis/version.rb
|
48
51
|
- pom.xml
|
49
52
|
- samples.rb
|
@@ -53,11 +56,11 @@ files:
|
|
53
56
|
- spec/fixtures/text_file2.txt
|
54
57
|
- spec/spec_helper.rb
|
55
58
|
- target/dependency/activation-1.1.jar
|
56
|
-
- target/dependency/chemistry-opencmis-client-api-0.
|
57
|
-
- target/dependency/chemistry-opencmis-client-bindings-0.
|
58
|
-
- target/dependency/chemistry-opencmis-client-impl-0.
|
59
|
-
- target/dependency/chemistry-opencmis-commons-api-0.
|
60
|
-
- target/dependency/chemistry-opencmis-commons-impl-0.
|
59
|
+
- target/dependency/chemistry-opencmis-client-api-0.9.0.jar
|
60
|
+
- target/dependency/chemistry-opencmis-client-bindings-0.9.0.jar
|
61
|
+
- target/dependency/chemistry-opencmis-client-impl-0.9.0.jar
|
62
|
+
- target/dependency/chemistry-opencmis-commons-api-0.9.0.jar
|
63
|
+
- target/dependency/chemistry-opencmis-commons-impl-0.9.0.jar
|
61
64
|
- target/dependency/jaxb-api-2.1.jar
|
62
65
|
- target/dependency/jaxb-impl-2.1.11.jar
|
63
66
|
- target/dependency/jaxws-api-2.1.jar
|
@@ -68,11 +71,12 @@ files:
|
|
68
71
|
- target/dependency/resolver-20050927.jar
|
69
72
|
- target/dependency/saaj-api-1.3.jar
|
70
73
|
- target/dependency/saaj-impl-1.3.3.jar
|
71
|
-
- target/dependency/slf4j-api-1.
|
74
|
+
- target/dependency/slf4j-api-1.7.5.jar
|
72
75
|
- target/dependency/stax-api-1.0-2.jar
|
73
76
|
- target/dependency/stax-ex-1.2.jar
|
77
|
+
- target/dependency/stax2-api-3.1.1.jar
|
74
78
|
- target/dependency/streambuffer-0.9.jar
|
75
|
-
- target/dependency/
|
79
|
+
- target/dependency/woodstox-core-asl-4.2.0.jar
|
76
80
|
homepage: https://github.com/ricn/cmis
|
77
81
|
licenses: []
|
78
82
|
post_install_message:
|
@@ -81,17 +85,15 @@ require_paths:
|
|
81
85
|
- lib
|
82
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
87
|
requirements:
|
84
|
-
- -
|
88
|
+
- - '>='
|
85
89
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
87
|
-
MA==
|
90
|
+
version: '0'
|
88
91
|
none: false
|
89
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
93
|
requirements:
|
91
|
-
- -
|
94
|
+
- - '>='
|
92
95
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
94
|
-
MA==
|
96
|
+
version: '0'
|
95
97
|
none: false
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|