infopark_cloud_connector 6.8.0.210.ed204b0 → 6.8.0.322.c003f11

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 (37) hide show
  1. data/.yardopts +5 -0
  2. data/README +5 -0
  3. data/app/helpers/rails_connector/marker_helper.rb +1 -1
  4. data/lib/infopark_cloud_connector.rb +1 -0
  5. data/lib/rails_connector/blob.rb +50 -33
  6. data/lib/rails_connector/cache.rb +0 -1
  7. data/lib/rails_connector/cache_middleware.rb +0 -1
  8. data/lib/rails_connector/chain.rb +0 -1
  9. data/lib/rails_connector/cloud_engine.rb +1 -1
  10. data/lib/rails_connector/cms_api_search_request.rb +3 -0
  11. data/lib/rails_connector/cms_base_model.rb +2 -3
  12. data/lib/rails_connector/cms_rest_api.rb +0 -2
  13. data/lib/rails_connector/content_cache.rb +0 -1
  14. data/lib/rails_connector/content_service.rb +9 -0
  15. data/lib/rails_connector/date_attribute.rb +1 -1
  16. data/lib/rails_connector/default_search_request.rb +2 -1
  17. data/lib/rails_connector/dict_storage.rb +1 -1
  18. data/lib/rails_connector/errors.rb +2 -0
  19. data/lib/rails_connector/link.rb +22 -8
  20. data/lib/rails_connector/named_link.rb +11 -8
  21. data/lib/rails_connector/obj.rb +113 -25
  22. data/lib/rails_connector/obj_data.rb +4 -7
  23. data/lib/rails_connector/obj_data_from_database.rb +0 -1
  24. data/lib/rails_connector/obj_data_from_hash.rb +0 -1
  25. data/lib/rails_connector/obj_data_from_service.rb +6 -1
  26. data/lib/rails_connector/path_conversion.rb +1 -1
  27. data/lib/rails_connector/revision.rb +0 -1
  28. data/lib/rails_connector/s3_blob.rb +17 -12
  29. data/lib/rails_connector/service_blob.rb +48 -0
  30. data/lib/rails_connector/service_cms_backend.rb +24 -19
  31. data/lib/rails_connector/version.rb +0 -1
  32. data/lib/rails_connector/workspace.rb +0 -1
  33. data/lib/rails_connector/workspace_data_from_database.rb +0 -1
  34. data/lib/rails_connector/workspace_data_from_service.rb +0 -1
  35. data/lib/rails_connector/workspace_selection_middleware.rb +0 -1
  36. metadata +23 -23
  37. data/lib/rails_connector/obj_body.rb +0 -60
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class ObjDataFromDatabase < ObjData
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class ObjDataFromHash < ObjData
@@ -23,13 +23,18 @@ module RailsConnector
23
23
  end
24
24
 
25
25
  def has_custom_attribute?(attribute_name)
26
- !!@data[attribute_name]
26
+ is_custom_attribute?(attribute_name) && !!@data[attribute_name]
27
27
  end
28
28
 
29
29
  private
30
30
 
31
+ def is_custom_attribute?(attribute_name)
32
+ !attribute_name.starts_with?('_')
33
+ end
34
+
31
35
  internal_key_list = %w[
32
36
  last_changed
37
+ permalink
33
38
  sort_key1
34
39
  sort_key2
35
40
  sort_key3
@@ -1,6 +1,6 @@
1
1
  module RailsConnector
2
2
 
3
- module PathConversion #:nodoc: all
3
+ module PathConversion
4
4
 
5
5
  def self.path_from_list(components)
6
6
  if components
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class Revision < CmsBaseModel
@@ -7,17 +7,6 @@ class S3Blob
7
7
  @s3_objects ||= bucket.objects
8
8
  end
9
9
 
10
- def bucket
11
- s3_api.buckets[bucket_name]
12
- end
13
-
14
- def s3_api
15
- AWS::S3.new(
16
- :access_key_id => access_key_id,
17
- :secret_access_key => secret_access_key
18
- )
19
- end
20
-
21
10
  def bucket_url
22
11
  @cached_bucket_url ||= bucket.url
23
12
  end
@@ -27,6 +16,7 @@ class S3Blob
27
16
 
28
17
  # invalidate cache
29
18
  @cached_bucket_url = nil
19
+ @s3_objects = nil
30
20
  end
31
21
 
32
22
  def find(id)
@@ -37,6 +27,17 @@ class S3Blob
37
27
 
38
28
  attr_reader :spec
39
29
 
30
+ def s3_api
31
+ AWS::S3.new(
32
+ :access_key_id => access_key_id,
33
+ :secret_access_key => secret_access_key
34
+ )
35
+ end
36
+
37
+ def bucket
38
+ s3_api.buckets[bucket_name]
39
+ end
40
+
40
41
  def bucket_name
41
42
  spec[:bucket_name]
42
43
  end
@@ -58,7 +59,7 @@ class S3Blob
58
59
  end
59
60
 
60
61
  def s3_object
61
- @s3_object = self.class.s3_objects[id]
62
+ @s3_object ||= self.class.s3_objects[id]
62
63
  end
63
64
 
64
65
  def url
@@ -71,6 +72,10 @@ class S3Blob
71
72
  "#{self.class.bucket_url}#{@id}"
72
73
  end
73
74
 
75
+ def meta_url
76
+ url
77
+ end
78
+
74
79
  def content_type
75
80
  s3_object.content_type
76
81
  end
@@ -0,0 +1,48 @@
1
+ module RailsConnector
2
+
3
+ # TODO Caching:
4
+ # unlimited urls: ewig
5
+ # limited urls: zeitlimit - x (x fuer mindestverwendbarkeitszeit)
6
+ class ServiceBlob
7
+
8
+ class << self
9
+
10
+ def configure(config)
11
+ end
12
+
13
+ def find(id)
14
+ new(id)
15
+ end
16
+
17
+ end
18
+
19
+ attr_reader :id
20
+
21
+ def initialize(id)
22
+ @id = id
23
+ end
24
+
25
+ def url
26
+ raw_data["url"]
27
+ end
28
+
29
+ def content_type
30
+ meta_data[:content_type]
31
+ end
32
+
33
+ def length
34
+ meta_data[:content_length].to_i
35
+ end
36
+
37
+ private
38
+
39
+ def raw_data
40
+ @raw_data ||= ContentService.query("blobs/query", :blob_ids => [id])["blobs"][id]
41
+ end
42
+
43
+ def meta_data
44
+ @meta_data ||= RestClient.head(raw_data["meta_url"]).headers
45
+ end
46
+ end
47
+
48
+ end
@@ -81,27 +81,32 @@ module RailsConnector
81
81
 
82
82
  def find_raw_data_from_database_by(workspace_data, index, keys)
83
83
  return [] if keys.blank?
84
- @query_counter += 1
85
- raw_data = ContentService.query(
86
- "objs/query",
87
- :queries => keys.map do |key|
88
- { :type => index, :param => key }
89
- end,
90
- :workspace_id => workspace_data.id,
91
- :revision_id => workspace_data.revision_id
92
- )
93
-
94
- objs = {}
95
- raw_data["objs"].each do |obj|
96
- objs[obj["_id"].first] = obj
97
- end
84
+ instrumenter = ActiveSupport::Notifications.instrumenter
85
+ instrumenter.instrument(
86
+ "cms_load.rails_connector", :name => "Obj Load", :index => index, :keys => keys
87
+ ) do
88
+ @query_counter += 1
89
+ raw_data = ContentService.query(
90
+ "objs/query",
91
+ :queries => keys.map do |key|
92
+ { :type => index, :param => key }
93
+ end,
94
+ :workspace_id => workspace_data.id,
95
+ :revision_id => workspace_data.revision_id
96
+ )
97
+
98
+ objs = {}
99
+ raw_data["objs"].each do |obj|
100
+ objs[obj["_id"].first] = obj
101
+ end
98
102
 
99
- raw_data["results"].map do |query|
100
- query["refs"].map do |obj_ref|
101
- id = obj_ref["id"]
103
+ raw_data["results"].map do |query|
104
+ query["refs"].map do |obj_ref|
105
+ id = obj_ref["id"]
102
106
 
103
- # TODO fetch missing ObjData from Service
104
- objs[id] or raise "Data for Obj with id #{id} missing!"
107
+ # TODO fetch missing ObjData from Service
108
+ objs[id] or raise "Data for Obj with id #{id} missing!"
109
+ end
105
110
  end
106
111
  end
107
112
  end
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class Version
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class Workspace
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class WorkspaceDataFromDatabase < CmsBaseModel
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class WorkspaceDataFromService
@@ -1,4 +1,3 @@
1
- #:enddoc:
2
1
  module RailsConnector
3
2
 
4
3
  class WorkspaceSelectionMiddleware
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: -847135200
4
+ hash: 846608086
5
5
  prerelease: 10
6
6
  segments:
7
7
  - 6
8
8
  - 8
9
9
  - 0
10
- - 210
11
- - ed
12
- - 204
13
- - b
14
- - 0
15
- version: 6.8.0.210.ed204b0
10
+ - 322
11
+ - c
12
+ - 3
13
+ - f
14
+ - 11
15
+ version: 6.8.0.322.c003f11
16
16
  platform: ruby
17
17
  authors:
18
18
  - Infopark AG
@@ -20,7 +20,7 @@ autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
22
 
23
- date: 2012-11-06 00:00:00 +01:00
23
+ date: 2012-11-14 00:00:00 +01:00
24
24
  default_executable:
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
@@ -60,17 +60,17 @@ dependencies:
60
60
  requirements:
61
61
  - - "="
62
62
  - !ruby/object:Gem::Version
63
- hash: -847135200
63
+ hash: 846608086
64
64
  segments:
65
65
  - 6
66
66
  - 8
67
67
  - 0
68
- - 210
69
- - ed
70
- - 204
71
- - b
72
- - 0
73
- version: 6.8.0.210.ed204b0
68
+ - 322
69
+ - c
70
+ - 3
71
+ - f
72
+ - 11
73
+ version: 6.8.0.322.c003f11
74
74
  version_requirements: *id003
75
75
  name: kvom
76
76
  prerelease: false
@@ -81,9 +81,11 @@ executables: []
81
81
 
82
82
  extensions: []
83
83
 
84
- extra_rdoc_files:
85
- - app/helpers/rails_connector/marker_helper.rb
84
+ extra_rdoc_files: []
85
+
86
86
  files:
87
+ - .yardopts
88
+ - README
87
89
  - app/helpers/rails_connector/marker_helper.rb
88
90
  - lib/infopark_cloud_connector.rb
89
91
  - lib/rails_connector/blob.rb
@@ -108,7 +110,6 @@ files:
108
110
  - lib/rails_connector/log_subscriber.rb
109
111
  - lib/rails_connector/named_link.rb
110
112
  - lib/rails_connector/obj.rb
111
- - lib/rails_connector/obj_body.rb
112
113
  - lib/rails_connector/obj_data.rb
113
114
  - lib/rails_connector/obj_data_from_database.rb
114
115
  - lib/rails_connector/obj_data_from_hash.rb
@@ -118,21 +119,20 @@ files:
118
119
  - lib/rails_connector/rack_middlewares.rb
119
120
  - lib/rails_connector/revision.rb
120
121
  - lib/rails_connector/s3_blob.rb
122
+ - lib/rails_connector/service_blob.rb
121
123
  - lib/rails_connector/service_cms_backend.rb
122
124
  - lib/rails_connector/version.rb
123
125
  - lib/rails_connector/workspace.rb
124
126
  - lib/rails_connector/workspace_data_from_database.rb
125
127
  - lib/rails_connector/workspace_data_from_service.rb
126
128
  - lib/rails_connector/workspace_selection_middleware.rb
127
- has_rdoc: true
129
+ has_rdoc: yard
128
130
  homepage: http://www.infopark.de
129
131
  licenses: []
130
132
 
131
133
  post_install_message:
132
- rdoc_options:
133
- - --charset=UTF-8
134
- - --title
135
- - Infopark Cloud Connector
134
+ rdoc_options: []
135
+
136
136
  require_paths:
137
137
  - lib
138
138
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -1,60 +0,0 @@
1
- module RailsConnector
2
-
3
- module ObjBody
4
- # Returns the body (main content) of the Obj for non-binary Objs.
5
- # Returns nil for binary Objs.
6
- def body
7
- if binary?
8
- nil
9
- else
10
- StringTagging.tag_as_html(read_attribute('body'), self)
11
- end
12
- end
13
-
14
- # for binary Objs body_length equals the file size
15
- # for non-binary Objs body_length equals the number of characters in the body (main content)
16
- def body_length
17
- if binary?
18
- blob = find_blob
19
- blob ? blob.length : 0
20
- else
21
- (body || "").length
22
- end
23
- end
24
-
25
- # returns an URL to retrieve the Obj's body for binary Objs.
26
- # returns nil for non-binary Objs.
27
- def body_data_url
28
- if binary?
29
- blob = find_blob
30
- blob.url if blob
31
- end
32
- end
33
-
34
- def body_data_path # :nodoc:
35
- # not needed/supported when using cloud connector.
36
- nil
37
- end
38
-
39
- # returns the content type of the Obj's body for binary Objs.
40
- # returns nil for non-binary Objs.
41
- def body_content_type
42
- if binary?
43
- blob = find_blob
44
- if blob
45
- blob.content_type
46
- else
47
- "application/octet-stream"
48
- end
49
- end
50
- end
51
-
52
- private
53
-
54
- def find_blob
55
- blob_spec = read_attribute('blob')
56
- Blob.find(blob_spec["id"]) if blob_spec
57
- end
58
- end
59
-
60
- end # module RailsConnector