cmis_server 1.0.3

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.
Files changed (133) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +51 -0
  5. data/app/assets/javascripts/cmis_server/application.js +13 -0
  6. data/app/assets/stylesheets/cmis_server/application.css +15 -0
  7. data/app/controllers/cmis_server/application_controller.rb +19 -0
  8. data/app/controllers/cmis_server/atom_pub/base_controller.rb +23 -0
  9. data/app/controllers/cmis_server/atom_pub/bulk_controller.rb +302 -0
  10. data/app/controllers/cmis_server/atom_pub/content_controller.rb +178 -0
  11. data/app/controllers/cmis_server/atom_pub/entries_controller.rb +41 -0
  12. data/app/controllers/cmis_server/atom_pub/folder_collection_controller.rb +70 -0
  13. data/app/controllers/cmis_server/atom_pub/query_controller.rb +138 -0
  14. data/app/controllers/cmis_server/atom_pub/repository_controller.rb +75 -0
  15. data/app/controllers/cmis_server/atom_pub/secondary_types_controller.rb +149 -0
  16. data/app/controllers/cmis_server/atom_pub/service_documents_controller.rb +34 -0
  17. data/app/controllers/cmis_server/atom_pub/types_controller.rb +229 -0
  18. data/app/controllers/cmis_server/atom_pub/uri_templates_controller.rb +58 -0
  19. data/app/controllers/concerns/cmis_server/atom_pub/repository_scopable.rb +18 -0
  20. data/app/helpers/cmis_server/application_helper.rb +31 -0
  21. data/app/models/cmis_server/application_record.rb +5 -0
  22. data/app/services/cmis_server/bulk_update_service.rb +69 -0
  23. data/app/services/cmis_server/content_stream_service.rb +75 -0
  24. data/app/services/cmis_server/discovery_service.rb +31 -0
  25. data/app/services/cmis_server/navigation_service.rb +43 -0
  26. data/app/services/cmis_server/object_service.rb +176 -0
  27. data/app/services/cmis_server/repository_service.rb +40 -0
  28. data/app/services/cmis_server/secondary_type_service.rb +120 -0
  29. data/app/services/cmis_server/type_management_service.rb +117 -0
  30. data/app/views/cmis_server/atom_pub/bulk_update_feed.atom.builder +47 -0
  31. data/app/views/cmis_server/atom_pub/entries/_cmis_document_links.atom_entry.builder +0 -0
  32. data/app/views/cmis_server/atom_pub/entries/_cmis_folder_links.atom_entry.builder +3 -0
  33. data/app/views/cmis_server/atom_pub/entries/_object_entry.atom_entry.builder +64 -0
  34. data/app/views/cmis_server/atom_pub/entries/_property.atom_entry.builder +8 -0
  35. data/app/views/cmis_server/atom_pub/entries/object_entry.atom_entry.builder +1 -0
  36. data/app/views/cmis_server/atom_pub/entries/type_entry.atom_entry.builder +59 -0
  37. data/app/views/cmis_server/atom_pub/feeds/_feed_entry.atom_feed.builder +1 -0
  38. data/app/views/cmis_server/atom_pub/feeds/feed.atom_feed.builder +30 -0
  39. data/app/views/cmis_server/atom_pub/service_documents/_uri_template.atom_service.builder +5 -0
  40. data/app/views/cmis_server/atom_pub/service_documents/_workspace.atom_service.builder +89 -0
  41. data/app/views/cmis_server/atom_pub/service_documents/service_document.atom_service.builder +1 -0
  42. data/app/views/cmis_server/atom_pub/shared/_collection.xml.builder +7 -0
  43. data/app/views/cmis_server/atom_pub/shared/atom_entry_layout.atom_entry.builder +0 -0
  44. data/app/views/cmis_server/atom_pub/type_entry.atom.builder +69 -0
  45. data/app/views/cmis_server/atom_pub/types_feed.atom.builder +91 -0
  46. data/app/views/layouts/cmis_server/application.atom_entry.builder +2 -0
  47. data/app/views/layouts/cmis_server/application.atom_feed.builder +3 -0
  48. data/app/views/layouts/cmis_server/application.atom_service.builder +10 -0
  49. data/app/views/layouts/cmis_server/application.html.erb +14 -0
  50. data/config/routes.rb +49 -0
  51. data/lib/cmis_server/atom_pub/entry_parser.rb +72 -0
  52. data/lib/cmis_server/base_objects/base_type.rb +128 -0
  53. data/lib/cmis_server/base_objects/document.rb +68 -0
  54. data/lib/cmis_server/base_objects/folder.rb +104 -0
  55. data/lib/cmis_server/base_objects/item.rb +25 -0
  56. data/lib/cmis_server/base_types.rb +123 -0
  57. data/lib/cmis_server/cmis_object.rb +190 -0
  58. data/lib/cmis_server/configuration.rb +43 -0
  59. data/lib/cmis_server/constants.rb +8 -0
  60. data/lib/cmis_server/content_stream.rb +52 -0
  61. data/lib/cmis_server/context.rb +11 -0
  62. data/lib/cmis_server/document_object.rb +12 -0
  63. data/lib/cmis_server/document_type.rb +67 -0
  64. data/lib/cmis_server/engine.rb +60 -0
  65. data/lib/cmis_server/exceptions.rb +185 -0
  66. data/lib/cmis_server/folder_object.rb +18 -0
  67. data/lib/cmis_server/folder_type.rb +34 -0
  68. data/lib/cmis_server/id.rb +18 -0
  69. data/lib/cmis_server/item_adapter.rb +26 -0
  70. data/lib/cmis_server/item_object.rb +15 -0
  71. data/lib/cmis_server/item_type.rb +7 -0
  72. data/lib/cmis_server/object_adapter.rb +79 -0
  73. data/lib/cmis_server/property.rb +29 -0
  74. data/lib/cmis_server/property_definition.rb +118 -0
  75. data/lib/cmis_server/query/parser.output +2250 -0
  76. data/lib/cmis_server/query/parser.racc +222 -0
  77. data/lib/cmis_server/query/parser.racc.rb +1039 -0
  78. data/lib/cmis_server/query/parser.rex +114 -0
  79. data/lib/cmis_server/query/parser.rex.rb +238 -0
  80. data/lib/cmis_server/query/statement.rb +395 -0
  81. data/lib/cmis_server/query.rb +2 -0
  82. data/lib/cmis_server/renderable_collection.rb +45 -0
  83. data/lib/cmis_server/renderable_object.rb +49 -0
  84. data/lib/cmis_server/repository.rb +91 -0
  85. data/lib/cmis_server/secondary_type.rb +11 -0
  86. data/lib/cmis_server/type.rb +62 -0
  87. data/lib/cmis_server/type_registry.rb +115 -0
  88. data/lib/cmis_server/version.rb +4 -0
  89. data/lib/cmis_server.rb +22 -0
  90. data/lib/tasks/cmis_server_tasks.rake +4 -0
  91. data/test/cmis_server_test.rb +7 -0
  92. data/test/dummy/README.rdoc +28 -0
  93. data/test/dummy/Rakefile +6 -0
  94. data/test/dummy/app/assets/javascripts/application.js +13 -0
  95. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  96. data/test/dummy/app/controllers/application_controller.rb +5 -0
  97. data/test/dummy/app/helpers/application_helper.rb +2 -0
  98. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  99. data/test/dummy/bin/bundle +3 -0
  100. data/test/dummy/bin/rails +4 -0
  101. data/test/dummy/bin/rake +4 -0
  102. data/test/dummy/bin/setup +29 -0
  103. data/test/dummy/config/application.rb +26 -0
  104. data/test/dummy/config/boot.rb +5 -0
  105. data/test/dummy/config/database.yml +25 -0
  106. data/test/dummy/config/environment.rb +5 -0
  107. data/test/dummy/config/environments/development.rb +41 -0
  108. data/test/dummy/config/environments/production.rb +79 -0
  109. data/test/dummy/config/environments/test.rb +42 -0
  110. data/test/dummy/config/initializers/assets.rb +11 -0
  111. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  112. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  113. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  114. data/test/dummy/config/initializers/inflections.rb +16 -0
  115. data/test/dummy/config/initializers/mime_types.rb +4 -0
  116. data/test/dummy/config/initializers/session_store.rb +3 -0
  117. data/test/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
  118. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  119. data/test/dummy/config/locales/en.yml +23 -0
  120. data/test/dummy/config/routes.rb +4 -0
  121. data/test/dummy/config/secrets.yml +22 -0
  122. data/test/dummy/config.ru +4 -0
  123. data/test/dummy/public/404.html +67 -0
  124. data/test/dummy/public/422.html +67 -0
  125. data/test/dummy/public/500.html +66 -0
  126. data/test/dummy/public/favicon.ico +0 -0
  127. data/test/integration/navigation_test.rb +8 -0
  128. data/test/services/bulk_update_service_test.rb +121 -0
  129. data/test/services/content_stream_service_test.rb +176 -0
  130. data/test/services/secondary_type_service_test.rb +174 -0
  131. data/test/services/type_management_service_test.rb +146 -0
  132. data/test/test_helper.rb +16 -0
  133. metadata +326 -0
@@ -0,0 +1,114 @@
1
+ class CmisServer::Query::Parser
2
+
3
+ option
4
+ ignorecase
5
+
6
+ macro
7
+ DIGIT [0-9]
8
+ UINT {DIGIT}+
9
+ BLANK \s+
10
+
11
+ YEARS {DIGIT}{DIGIT}{DIGIT}{DIGIT}
12
+ MONTHS {DIGIT}{DIGIT}
13
+ DAYS {DIGIT}{DIGIT}
14
+ HOUR {DIGIT}{DIGIT}
15
+ MINUTES {DIGIT}{DIGIT}
16
+ SECONDS {DIGIT}{DIGIT}
17
+ MILISECONDS {DIGIT}{DIGIT}{DIGIT}
18
+ DATE {YEARS}-{MONTHS}-{DAYS}T{HOUR}:{MINUTES}:{SECONDS}\.{MILISECONDS}
19
+
20
+ IDENT [\w:]+
21
+ rule
22
+ # [:state] pattern [actions]
23
+
24
+ # literals
25
+ #\"{DATE}\" { [:date_string, DateTime.parse(text)] }
26
+ \'{DATE}\' { [:date_string, DateTime.parse(text)] }
27
+
28
+ \' { @state = :STRS; [:quote, text] }
29
+ :STRS \' { @state = nil; [:quote, text] }
30
+ #:STRS .*(?=\') { [:character_string_literal, text.gsub("''", "'")] }
31
+ :STRS [^\']* { [:character_string_literal, text.gsub("''", "'")] }
32
+
33
+ # \" { @state = :STRD; [:quote, text] }
34
+ #:STRD \" { @state = nil; [:quote, text] }
35
+ #:STRD .*(?=\") { [:character_string_literal, text.gsub('""', '"')] }
36
+
37
+ {UINT} { [:unsigned_integer, text.to_i] }
38
+
39
+ # skip
40
+ {BLANK} # no action
41
+
42
+ # keywords
43
+ SELECT { [:SELECT, text] }
44
+ SCORE { [:SCORE, text] }
45
+ AS { [:AS, text] }
46
+ FROM { [:FROM, text] }
47
+ LEFT { [:LEFT, text] }
48
+ INNER { [:INNER, text] }
49
+ OUTER { [:OUTER, text] }
50
+ ON { [:ON, text] }
51
+ JOIN { [:JOIN, text] }
52
+ WHERE { [:WHERE, text] }
53
+ TIMESTAMP { [:TIMESTAMP, text] }
54
+ IN_FOLDER { [:IN_FOLDER, text] }
55
+ IN_TREE { [:IN_TREE, text] }
56
+ IN { [:IN, text] }
57
+ NOT { [:NOT, text] }
58
+ IS { [:IS, text] }
59
+ NULL { [:NULL, text] }
60
+ LIKE { [:LIKE, text] }
61
+ AND { [:AND, text] }
62
+ ANY { [:ANY, text] }
63
+ ORDER { [:ORDER, text] }
64
+ BY { [:BY, text] }
65
+ OR { [:OR, text] }
66
+ ASC { [:ASC, text] }
67
+ DESC { [:DESC, text] }
68
+
69
+ TRUE { [:TRUE, true]}
70
+ FALSE { [:FALSE, false]}
71
+
72
+
73
+ # BETWEEN { [:BETWEEN, text] }
74
+ # INTO { [:INTO, text] }
75
+ # COUNT { [:COUNT, text] }
76
+ # AVG { [:AVG, text] }
77
+ # MAX { [:MAX, text] }
78
+ # MIN { [:MIN, text] }
79
+ # SUM { [:SUM, text] }
80
+ # GROUP { [:GROUP, text] }
81
+ # HAVING { [:HAVING, text] }
82
+ # CROSS { [:CROSS, text] }
83
+ # FULL { [:FULL, text] }
84
+ # USING { [:USING, text] }
85
+ # EXISTS { [:EXISTS, text] }
86
+ # CURRENT_USER { [:CURRENT_USER, text] }
87
+ # VALUES { [:VALUES, text] }
88
+
89
+ # tokens
90
+ E { [:E, text] }
91
+
92
+ <> { [:not_equals_operator, text] }
93
+ != { [:not_equals_operator, text] }
94
+ = { [:equals_operator, text] }
95
+ <= { [:less_than_or_equals_operator, text] }
96
+ < { [:less_than_operator, text] }
97
+ >= { [:greater_than_or_equals_operator, text] }
98
+ > { [:greater_than_operator, text] }
99
+
100
+ \( { [:left_paren, text] }
101
+ \) { [:right_paren, text] }
102
+ \* { [:asterisk, text] }
103
+ \/ { [:solidus, text] }
104
+ \+ { [:plus_sign, text] }
105
+ \- { [:minus_sign, text] }
106
+ \. { [:period, text] }
107
+ , { [:comma, text] }
108
+
109
+ # identifier
110
+ `{IDENT}` { [:identifier, text[1..-2]] }
111
+ {IDENT} { [:identifier, text] }
112
+
113
+ ---- header ----
114
+ require 'date'
@@ -0,0 +1,238 @@
1
+ #--
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by rex 1.0.5
4
+ # from lexical definition file "lib/cmis_server/query/parser.rex".
5
+ #++
6
+
7
+ require 'racc/parser'
8
+ class CmisServer::Query::Parser < Racc::Parser
9
+ require 'strscan'
10
+
11
+ class ScanError < StandardError ; end
12
+
13
+ attr_reader :lineno
14
+ attr_reader :filename
15
+ attr_accessor :state
16
+
17
+ def scan_setup(str)
18
+ @ss = StringScanner.new(str)
19
+ @lineno = 1
20
+ @state = nil
21
+ end
22
+
23
+ def action
24
+ yield
25
+ end
26
+
27
+ def scan_str(str)
28
+ scan_setup(str)
29
+ do_parse
30
+ end
31
+ alias :scan :scan_str
32
+
33
+ def load_file( filename )
34
+ @filename = filename
35
+ open(filename, "r") do |f|
36
+ scan_setup(f.read)
37
+ end
38
+ end
39
+
40
+ def scan_file( filename )
41
+ load_file(filename)
42
+ do_parse
43
+ end
44
+
45
+
46
+ def next_token
47
+ return if @ss.eos?
48
+
49
+ # skips empty actions
50
+ until token = _next_token or @ss.eos?; end
51
+ token
52
+ end
53
+
54
+ def _next_token
55
+ text = @ss.peek(1)
56
+ @lineno += 1 if text == "\n"
57
+ token = case @state
58
+ when nil
59
+ case
60
+ when (text = @ss.scan(/\'[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]\'/i))
61
+ action { [:date_string, DateTime.parse(text)] }
62
+
63
+ when (text = @ss.scan(/\'/i))
64
+ action { @state = :STRS; [:quote, text] }
65
+
66
+ when (text = @ss.scan(/[0-9]+/i))
67
+ action { [:unsigned_integer, text.to_i] }
68
+
69
+ when (text = @ss.scan(/\s+/i))
70
+ ;
71
+
72
+ when (text = @ss.scan(/SELECT/i))
73
+ action { [:SELECT, text] }
74
+
75
+ when (text = @ss.scan(/SCORE/i))
76
+ action { [:SCORE, text] }
77
+
78
+ when (text = @ss.scan(/AS/i))
79
+ action { [:AS, text] }
80
+
81
+ when (text = @ss.scan(/FROM/i))
82
+ action { [:FROM, text] }
83
+
84
+ when (text = @ss.scan(/LEFT/i))
85
+ action { [:LEFT, text] }
86
+
87
+ when (text = @ss.scan(/INNER/i))
88
+ action { [:INNER, text] }
89
+
90
+ when (text = @ss.scan(/OUTER/i))
91
+ action { [:OUTER, text] }
92
+
93
+ when (text = @ss.scan(/ON/i))
94
+ action { [:ON, text] }
95
+
96
+ when (text = @ss.scan(/JOIN/i))
97
+ action { [:JOIN, text] }
98
+
99
+ when (text = @ss.scan(/WHERE/i))
100
+ action { [:WHERE, text] }
101
+
102
+ when (text = @ss.scan(/TIMESTAMP/i))
103
+ action { [:TIMESTAMP, text] }
104
+
105
+ when (text = @ss.scan(/IN_FOLDER/i))
106
+ action { [:IN_FOLDER, text] }
107
+
108
+ when (text = @ss.scan(/IN_TREE/i))
109
+ action { [:IN_TREE, text] }
110
+
111
+ when (text = @ss.scan(/IN/i))
112
+ action { [:IN, text] }
113
+
114
+ when (text = @ss.scan(/NOT/i))
115
+ action { [:NOT, text] }
116
+
117
+ when (text = @ss.scan(/IS/i))
118
+ action { [:IS, text] }
119
+
120
+ when (text = @ss.scan(/NULL/i))
121
+ action { [:NULL, text] }
122
+
123
+ when (text = @ss.scan(/LIKE/i))
124
+ action { [:LIKE, text] }
125
+
126
+ when (text = @ss.scan(/AND/i))
127
+ action { [:AND, text] }
128
+
129
+ when (text = @ss.scan(/ANY/i))
130
+ action { [:ANY, text] }
131
+
132
+ when (text = @ss.scan(/ORDER/i))
133
+ action { [:ORDER, text] }
134
+
135
+ when (text = @ss.scan(/BY/i))
136
+ action { [:BY, text] }
137
+
138
+ when (text = @ss.scan(/OR/i))
139
+ action { [:OR, text] }
140
+
141
+ when (text = @ss.scan(/ASC/i))
142
+ action { [:ASC, text] }
143
+
144
+ when (text = @ss.scan(/DESC/i))
145
+ action { [:DESC, text] }
146
+
147
+ when (text = @ss.scan(/TRUE/i))
148
+ action { [:TRUE, true]}
149
+
150
+ when (text = @ss.scan(/FALSE/i))
151
+ action { [:FALSE, false]}
152
+
153
+ when (text = @ss.scan(/E/i))
154
+ action { [:E, text] }
155
+
156
+ when (text = @ss.scan(/<>/i))
157
+ action { [:not_equals_operator, text] }
158
+
159
+ when (text = @ss.scan(/!=/i))
160
+ action { [:not_equals_operator, text] }
161
+
162
+ when (text = @ss.scan(/=/i))
163
+ action { [:equals_operator, text] }
164
+
165
+ when (text = @ss.scan(/<=/i))
166
+ action { [:less_than_or_equals_operator, text] }
167
+
168
+ when (text = @ss.scan(/</i))
169
+ action { [:less_than_operator, text] }
170
+
171
+ when (text = @ss.scan(/>=/i))
172
+ action { [:greater_than_or_equals_operator, text] }
173
+
174
+ when (text = @ss.scan(/>/i))
175
+ action { [:greater_than_operator, text] }
176
+
177
+ when (text = @ss.scan(/\(/i))
178
+ action { [:left_paren, text] }
179
+
180
+ when (text = @ss.scan(/\)/i))
181
+ action { [:right_paren, text] }
182
+
183
+ when (text = @ss.scan(/\*/i))
184
+ action { [:asterisk, text] }
185
+
186
+ when (text = @ss.scan(/\//i))
187
+ action { [:solidus, text] }
188
+
189
+ when (text = @ss.scan(/\+/i))
190
+ action { [:plus_sign, text] }
191
+
192
+ when (text = @ss.scan(/\-/i))
193
+ action { [:minus_sign, text] }
194
+
195
+ when (text = @ss.scan(/\./i))
196
+ action { [:period, text] }
197
+
198
+ when (text = @ss.scan(/,/i))
199
+ action { [:comma, text] }
200
+
201
+ when (text = @ss.scan(/`[\w:]+`/i))
202
+ action { [:identifier, text[1..-2]] }
203
+
204
+ when (text = @ss.scan(/[\w:]+/i))
205
+ action { [:identifier, text] }
206
+
207
+ when (text = @ss.scan(/----/i))
208
+ ;
209
+
210
+ when (text = @ss.scan(/require/i))
211
+ ;
212
+
213
+ else
214
+ text = @ss.string[@ss.pos .. -1]
215
+ raise ScanError, "can not match: '" + text + "'"
216
+ end # if
217
+
218
+ when :STRS
219
+ case
220
+ when (text = @ss.scan(/\'/i))
221
+ action { @state = nil; [:quote, text] }
222
+
223
+ when (text = @ss.scan(/[^\']*/i))
224
+ action { [:character_string_literal, text.gsub("''", "'")] }
225
+
226
+ else
227
+ text = @ss.string[@ss.pos .. -1]
228
+ raise ScanError, "can not match: '" + text + "'"
229
+ end # if
230
+
231
+ else
232
+ raise ScanError, "undefined state: '" + state.to_s + "'"
233
+ end # case state
234
+ p token
235
+ token
236
+ end # def _next_token
237
+
238
+ end # class