line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Cmis; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13465
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
5
|
2
|
|
|
2
|
|
44
|
use v5.12.1; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
122
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
WebService::Cmis - Perl interface to CMIS-compliant document management systems |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use WebService::Cmis; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $client = WebService::Cmis::getClient( |
16
|
|
|
|
|
|
|
url => "http://.../alfresco/service/cmis", |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$client->login( |
20
|
|
|
|
|
|
|
user => "...", |
21
|
|
|
|
|
|
|
password => "..." |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $repo = $client->getRepository; |
25
|
|
|
|
|
|
|
my $root = $client->getRootFolder; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This library provides a CMIS client library for Perl that can be used to work with |
30
|
|
|
|
|
|
|
CMIS-compliant repositories such as Alfresco, IBM FileNet, Nuxeo and others. |
31
|
|
|
|
|
|
|
CMIS is an OASIS approved specification with backing by major ECM players including |
32
|
|
|
|
|
|
|
those mentioned as well as Microsoft, Oracle, and SAP. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
CMIS providers must expose both Web Services and Restful AtomPub bindings. |
35
|
|
|
|
|
|
|
WebService::Cmis uses the Restful AtomPub binding to communicate with the CMIS |
36
|
|
|
|
|
|
|
repository. All you have to tell WebService::Cmis is the repository's service |
37
|
|
|
|
|
|
|
URL and your credentials. There is nothing to install on the server side. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
See the F |
40
|
|
|
|
|
|
|
for a full understanding of what CMIS is. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over 4 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
2
|
|
4116
|
use Error qw(:try); |
|
2
|
|
|
|
|
8211
|
|
|
2
|
|
|
|
|
12
|
|
49
|
2
|
|
|
2
|
|
481
|
use Exporter qw(import); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
53
|
|
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
2
|
|
260
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
524
|
|
52
|
|
|
|
|
|
|
$Carp::Verbose = 1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
our @_namespaces = qw(ATOM_NS APP_NS CMISRA_NS CMIS_NS OPENSEARCH_NS); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
our @_contenttypes = qw(ATOM_XML_TYPE ATOM_XML_ENTRY_TYPE ATOM_XML_ENTRY_TYPE_P |
61
|
|
|
|
|
|
|
ATOM_XML_FEED_TYPE ATOM_XML_FEED_TYPE_P CMIS_TREE_TYPE CMIS_TREE_TYPE_P |
62
|
|
|
|
|
|
|
CMIS_QUERY_TYPE CMIS_ACL_TYPE); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
our @_relations = qw(ACL_REL ALLOWABLEACTIONS_REL ALTERNATE_REL CHANGE_LOG_REL DESCRIBEDBY_REL |
65
|
|
|
|
|
|
|
DOWN_REL EDIT_MEDIA_REL EDIT_REL FIRST_REL FOLDER_TREE_REL LAST_REL NEXT_REL |
66
|
|
|
|
|
|
|
POLICIES_REL PREV_REL RELATIONSHIPS_REL ROOT_DESCENDANTS_REL SELF_REL |
67
|
|
|
|
|
|
|
SERVICE_REL TYPE_DESCENDANTS_REL UP_REL VERSION_HISTORY_REL VIA_REL); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
our @_collections = qw(QUERY_COLL TYPES_COLL CHECKED_OUT_COLL UNFILED_COLL |
70
|
|
|
|
|
|
|
ROOT_COLL); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
our @_utils = qw(_writeCmisDebug _urlEncode); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
our @EXPORT_OK = (@_namespaces, @_contenttypes, @_relations, @_collections, @_utils); |
75
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
76
|
|
|
|
|
|
|
namespaces => \@_namespaces, |
77
|
|
|
|
|
|
|
contenttypes => \@_contenttypes, |
78
|
|
|
|
|
|
|
relations => \@_relations, |
79
|
|
|
|
|
|
|
collections => \@_collections, |
80
|
|
|
|
|
|
|
utils => \@_utils, |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Namespaces |
84
|
2
|
|
|
2
|
|
19
|
use constant ATOM_NS => 'http://www.w3.org/2005/Atom'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
140
|
|
85
|
2
|
|
|
2
|
|
14
|
use constant APP_NS => 'http://www.w3.org/2007/app'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
101
|
|
86
|
2
|
|
|
2
|
|
12
|
use constant CMISRA_NS => 'http://docs.oasis-open.org/ns/cmis/restatom/200908/'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
540
|
|
87
|
2
|
|
|
2
|
|
11
|
use constant CMIS_NS => 'http://docs.oasis-open.org/ns/cmis/core/200908/'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
82
|
|
88
|
2
|
|
|
2
|
|
10
|
use constant OPENSEARCH_NS => 'http://a9.com/-/spec/opensearch/1.1/'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
81
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Content types |
91
|
|
|
|
|
|
|
# Not all of these patterns have variability, but some do. It seemed cleaner |
92
|
|
|
|
|
|
|
# just to treat them all like patterns to simplify the matching logic |
93
|
2
|
|
|
2
|
|
9
|
use constant ATOM_XML_TYPE => 'application/atom+xml'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
94
|
2
|
|
|
2
|
|
8
|
use constant ATOM_XML_ENTRY_TYPE => 'application/atom+xml;type=entry'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
126
|
|
95
|
2
|
|
|
2
|
|
9
|
use constant ATOM_XML_ENTRY_TYPE_P => qr/^application\/atom\+xml.*type.*entry/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
91
|
|
96
|
2
|
|
|
2
|
|
9
|
use constant ATOM_XML_FEED_TYPE => 'application/atom+xml;type=feed'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
102
|
|
97
|
2
|
|
|
2
|
|
10
|
use constant ATOM_XML_FEED_TYPE_P => qr/^application\/atom\+xml.*type.*feed/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
76
|
|
98
|
2
|
|
|
2
|
|
9
|
use constant CMIS_TREE_TYPE => 'application/cmistree+xml'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
103
|
|
99
|
2
|
|
|
2
|
|
9
|
use constant CMIS_TREE_TYPE_P => qr/^application\/cmistree\+xml/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
105
|
|
100
|
2
|
|
|
2
|
|
9
|
use constant CMIS_QUERY_TYPE => 'application/cmisquery+xml'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
116
|
|
101
|
2
|
|
|
2
|
|
11
|
use constant CMIS_ACL_TYPE => 'application/cmisacl+xml'; |
|
2
|
|
|
|
|
28
|
|
|
2
|
|
|
|
|
107
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# Standard rels |
104
|
2
|
|
|
2
|
|
9
|
use constant ALTERNATE_REL => 'alternate'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
83
|
|
105
|
2
|
|
|
2
|
|
11
|
use constant DESCRIBEDBY_REL => 'describedby'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
106
|
2
|
|
|
2
|
|
11
|
use constant DOWN_REL => 'down'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
88
|
|
107
|
2
|
|
|
2
|
|
9
|
use constant EDIT_MEDIA_REL => 'edit-media'; |
|
2
|
|
|
|
|
489
|
|
|
2
|
|
|
|
|
83
|
|
108
|
2
|
|
|
2
|
|
9
|
use constant EDIT_REL => 'edit'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
109
|
2
|
|
|
2
|
|
10
|
use constant ENCLOSURE_REL => 'enclosure'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
110
|
2
|
|
|
2
|
|
9
|
use constant FIRST_REL => 'first'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
123
|
|
111
|
2
|
|
|
2
|
|
28
|
use constant LAST_REL => 'last'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
112
|
2
|
|
|
2
|
|
10
|
use constant NEXT_REL => 'next'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
94
|
|
113
|
2
|
|
|
2
|
|
11
|
use constant PREV_REL => 'previous'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
114
|
2
|
|
|
2
|
|
9
|
use constant SELF_REL => 'self'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
115
|
2
|
|
|
2
|
|
8
|
use constant SERVICE_REL => 'service'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
116
|
2
|
|
|
2
|
|
9
|
use constant UP_REL => 'up'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
330
|
|
117
|
2
|
|
|
2
|
|
9
|
use constant VERSION_HISTORY_REL => 'version-history'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
118
|
2
|
|
|
2
|
|
9
|
use constant VIA_REL => 'via'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
2
|
|
9
|
use constant ACL_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/acl'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
69
|
|
121
|
2
|
|
|
2
|
|
8
|
use constant ALLOWABLEACTIONS_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
75
|
|
122
|
2
|
|
|
2
|
|
9
|
use constant CHANGE_LOG_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/changes'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
123
|
2
|
|
|
2
|
|
9
|
use constant FOLDER_TREE_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/foldertree'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
124
|
2
|
|
|
2
|
|
9
|
use constant POLICIES_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/policies'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
125
|
2
|
|
|
2
|
|
10
|
use constant RELATIONSHIPS_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/relationships'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
109
|
|
126
|
2
|
|
|
2
|
|
9
|
use constant ROOT_DESCENDANTS_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/rootdescendants'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
94
|
|
127
|
2
|
|
|
2
|
|
9
|
use constant TYPE_DESCENDANTS_REL => 'http://docs.oasis-open.org/ns/cmis/link/200908/typedescendants'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
100
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# Collection types |
130
|
2
|
|
|
2
|
|
9
|
use constant QUERY_COLL => 'query'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
90
|
|
131
|
2
|
|
|
2
|
|
10
|
use constant TYPES_COLL => 'types'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
132
|
2
|
|
|
2
|
|
9
|
use constant CHECKED_OUT_COLL => 'checkedout'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
65
|
|
133
|
2
|
|
|
2
|
|
8
|
use constant UNFILED_COLL => 'unfiled'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
134
|
2
|
|
|
2
|
|
8
|
use constant ROOT_COLL => 'root'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
534
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item getClient(%params) -> L |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Static method to create a cmis client. The client serves as an agent to fulfill |
139
|
|
|
|
|
|
|
all operations while contacting the document management system. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
While passing on all provided parameters to the real client constructor, the C |
142
|
|
|
|
|
|
|
parameter is used to point to the class that actually implements the client, defaulting |
143
|
|
|
|
|
|
|
to L. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub getClient { |
148
|
0
|
|
|
0
|
1
|
|
require WebService::Cmis::Client; |
149
|
0
|
|
|
|
|
|
return new WebService::Cmis::Client(@_); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# static utility to write debug output to STDERR. Set the CMIS_DEBUG environment variable to switch on some additional debug messages. |
153
|
|
|
|
|
|
|
sub _writeCmisDebug { |
154
|
0
|
0
|
|
0
|
|
|
print STDERR "WebService::Cmis - $_[0]\n" if $ENV{CMIS_DEBUG}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#encodes a string to be used as a parameter in an url |
158
|
|
|
|
|
|
|
sub _urlEncode { |
159
|
0
|
|
|
0
|
|
|
my $text = shift; |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
$text =~ s/([^0-9a-zA-Z-_.:~!*'\/])/'%'.sprintf('%02x',ord($1))/ge; |
|
0
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
return $text; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=back |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 BUGS |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
172
|
|
|
|
|
|
|
the web interface at F. I will be notified, and then you'll |
173
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 SUPPORT |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
perldoc WebService::Cmis |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
You can also look for information at: |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=over 4 |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item * Github |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
F |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * Meta CPAN |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
F |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
F |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * CPAN Ratings |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
F |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This implementation is inspired by the Pyhton implementation |
207
|
|
|
|
|
|
|
F written by Jeff Potts. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 AUTHOR |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Michael Daum C<< >> |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Copyright 2012-2013 Michael Daum |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
218
|
|
|
|
|
|
|
the same terms as Perl itself. See F. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
1; |