Class: RTM::TMQL::TMQL4JEngine

Inherits:
Engine
  • Object
show all
Defined in:
lib/rtm/tmql/tmql4j.rb

Constant Summary collapse

@@version =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Engine

create

Constructor Details

#initialize(topic_map, params = {}) ⇒ TMQL4JEngine

Returns a new instance of TMQL4JEngine.



7
8
9
10
11
12
# File 'lib/rtm/tmql/tmql4j.rb', line 7

def initialize(topic_map, params={})
  raise("topic_map must be a RTM::TopicMap") unless topic_map.is_a?(RTM::TopicMap)
  super(params) #@params is set
  @topic_map = topic_map
  @runtime_setting = set_runtime
end

Instance Attribute Details

#runtimeObject (readonly)

Returns the value of attribute runtime.



4
5
6
# File 'lib/rtm/tmql/tmql4j.rb', line 4

def runtime
  @runtime
end

#runtime_settingObject (readonly)

Returns the value of attribute runtime_setting.



4
5
6
# File 'lib/rtm/tmql/tmql4j.rb', line 4

def runtime_setting
  @runtime_setting
end

#topic_mapObject (readonly)

Returns the value of attribute topic_map.



4
5
6
# File 'lib/rtm/tmql/tmql4j.rb', line 4

def topic_map
  @topic_map
end

Class Method Details

.versionObject

Returns the version of the underlying TMQL4J version It’s a bit of a hack.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rtm/tmql/tmql4j.rb', line 33

def self.version
  unless @@version
    javalibs_directory = File.join(File.dirname(__FILE__), 'javalibs')
    if File.directory?(javalibs_directory)
      tmql_files = Dir[File.join(javalibs_directory + '/tmql4j-*.jar')]
      tmql_files = tmql_files.reject{|file| file.include?("tmml")}
      if tmql_files.size == 1
        file = tmql_files.first
        @@version = File.basename(file, ".jar").gsub("tmql4j-", "")
      end
    end
  end
  return @@version
end

Instance Method Details

#enable_materialize_meta_model(materialize) ⇒ Object



18
19
20
# File 'lib/rtm/tmql/tmql4j.rb', line 18

def enable_materialize_meta_model(materialize)
  properties.enableMaterializeMetaModel(materialize)
end

#enable_updates(enabled) ⇒ Object



22
23
24
# File 'lib/rtm/tmql/tmql4j.rb', line 22

def enable_updates(enabled)
  properties.enableLanguageExtensionTmqlUl(enabled)
end

#execute(query) ⇒ Object



26
27
28
29
# File 'lib/rtm/tmql/tmql4j.rb', line 26

def execute(query)
  q = runtime.run(query)
  q.results
end

#propertiesObject



14
15
16
# File 'lib/rtm/tmql/tmql4j.rb', line 14

def properties
  runtime.properties
end