omf_oml 0.9.8 → 0.9.9

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/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2013 National ICT Australia (NICTA)
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without restriction,
7
+ including without limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicense, and/or sell copies of the Software,
9
+ and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'csv'
3
8
  require 'omf_oml'
4
9
  require 'omf_oml/table'
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'omf_base/lobject'
3
8
  require 'omf_oml'
4
9
 
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'monitor'
3
8
 
4
9
  require 'omf_oml'
@@ -1,3 +1,9 @@
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
1
7
  require 'monitor'
2
8
  require 'json'
3
9
  require 'set'
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'omf_oml'
3
8
  require 'omf_oml/schema'
4
9
  require 'omf_oml/tuple'
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'omf_base/lobject'
3
8
  require 'omf_oml'
4
9
 
@@ -1,3 +1,9 @@
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
1
7
  require 'rubygems'
2
8
  require 'rexml/document'
3
9
  require 'time'
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'omf_oml/oml_tuple'
3
8
  require 'omf_oml/table'
4
9
 
@@ -154,9 +159,6 @@ module OMF::OML
154
159
  t
155
160
  end
156
161
 
157
-
158
- protected
159
-
160
162
  def run(in_thread = true)
161
163
  return if @running
162
164
  if in_thread
@@ -232,29 +234,12 @@ if $0 == __FILE__
232
234
 
233
235
  require 'omf_oml/sql_source'
234
236
  db_file = File.join(File.dirname(__FILE__), '../../test/data/brooklynDemo.sq3')
235
- ss = OMF::OML::OmlSqlSource.new('sqlite://' + File.absolute_path(db_file))
237
+ ss = OMF::OML::OmlSqlSource.new('sqlite://' + File.expand_path(db_file))
236
238
 
237
239
  r = ss.create_stream('wimaxmonitor_wimaxstatus')
238
- puts r
239
-
240
- exit
241
-
242
- require 'omf_oml/table'
243
- ep = OMF::OML::OmlSqlSource.new(File.join(File.dirname(__FILE__), '../../test/data/brooklynDemo.sq3'))
244
- ep.on_new_stream() do |s|
245
- puts ">>>>>>>>>>>> New stream #{s.stream_name}: #{s.names.join(', ')}"
246
- case s.stream_name
247
- when 'wimaxmonitor_wimaxstatus'
248
- select = [:oml_ts_server, :sender_hostname, :frequency, :signal, :rssi, :cinr, :avg_tx_pw]
249
- when 'GPSlogger_gps_data'
250
- select = [:oml_ts_server, :oml_sender_id, :lat, :lon]
251
- end
252
-
253
- s.on_new_vector() do |v|
254
- puts "New vector(#{s.stream_name}): #{v.select(*select).join('|')}"
255
- end
256
- end
257
- ep.run()
240
+ r.run(false)
241
+ puts '=============='
242
+ puts r.row.inspect
258
243
 
259
244
  end
260
245
 
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'sequel'
3
8
 
4
9
  require 'omf_base/lobject'
@@ -189,7 +194,7 @@ module OMF::OML
189
194
  unless type = cd[:type] || FALLBACK_MAPPING[cd[:db_type]]
190
195
  warn "Can't find ruby type for database type '#{cd[:db_type]}'"
191
196
  end
192
- {name: col_name, type: type}
197
+ {:name => col_name, :type => type}
193
198
  end
194
199
  #puts "SCHEMA_DESCR>>>> #{schema_descr}"
195
200
  schema = OmlSchema.new(schema_descr)
@@ -199,9 +204,11 @@ module OMF::OML
199
204
  end
200
205
 
201
206
  def _def_query_for_table(table_name)
202
- t = table_name
207
+ t = table_name.to_sym
203
208
  @db["SELECT _senders.name as oml_sender, a.* FROM #{t} AS a INNER JOIN _senders ON (_senders.id = a.oml_sender_id);"]
204
- end
209
+ @db[t].select(:_senders__name___oml_sender).select_all(t).select_append(:_senders__name___oml_sender) \
210
+ .join('_senders'.to_sym, :id => :oml_sender_id)
211
+ end
205
212
  end
206
213
 
207
214
 
@@ -213,7 +220,7 @@ if $0 == __FILE__
213
220
 
214
221
  require 'omf_oml/table'
215
222
  db_file = File.join(File.dirname(__FILE__), '../../test/data/brooklynDemo.sq3')
216
- ep = OMF::OML::OmlSqlSource.new('sqlite://' + File.absolute_path(db_file), limit: 10)
223
+ ep = OMF::OML::OmlSqlSource.new('sqlite://' + File.expand_path(db_file), :limit => 10)
217
224
 
218
225
  def on_new_stream(ep)
219
226
  ep.on_new_stream() do |s|
@@ -244,7 +251,7 @@ if $0 == __FILE__
244
251
  puts t.schema
245
252
 
246
253
  # Raw query on database
247
- puts ep.dataset('GPSlogger_gps_data').select(:lat, :lon).limit(2).all
254
+ puts ep.dataset('GPSlogger_gps_data').select(:lat, :lon).limit(2).all.inspect
248
255
 
249
256
  end
250
257
 
data/lib/omf_oml/table.rb CHANGED
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'monitor'
3
8
 
4
9
  require 'omf_base/lobject'
data/lib/omf_oml/tuple.rb CHANGED
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  require 'omf_base/lobject'
3
8
  require 'omf_oml'
4
9
  require 'omf_oml/schema'
@@ -1,6 +1,11 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  module OMF
3
8
  module OML
4
- VERSION = '0.9.8'
9
+ VERSION = '0.9.9'
5
10
  end
6
- end
11
+ end
data/lib/omf_oml.rb CHANGED
@@ -1,4 +1,9 @@
1
-
1
+ #-------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 National ICT Australia Limited (NICTA).
3
+ # This software may be used and distributed solely under the terms of the MIT license (License).
4
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
5
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
6
+ #-------------------------------------------------------------------------------
2
7
  module OMF
3
8
  module OML; end
4
- end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_oml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-29 00:00:00.000000000 Z
12
+ date: 2013-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omf_base
@@ -53,6 +53,7 @@ extra_rdoc_files: []
53
53
  files:
54
54
  - .gitignore
55
55
  - Gemfile
56
+ - LICENSE.txt
56
57
  - Rakefile
57
58
  - lib/omf_oml.rb
58
59
  - lib/omf_oml/csv_table.rb