# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../../rtm-majortom/lib") $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../../rtm-tmql/lib") require 'spec' require 'rtm/majortom' require 'rtm/revision' def implementation_for_spec ENV['RTM_IMPLEMENTATION'] && ENV['RTM_IMPLEMENTATION'].to_sym || :ontopia # if env is nil, the "normal progress will go on" # TODO: remove ontopia, as it should be chosen by connect by default end def get_used_tm_sys if implementation_for_spec == :majortom_db begin $database_params ||= YAML.load_file(File.join(File.dirname(__FILE__), "/../../rtm/spec/database_config.yml"))["database_params"] rescue raise("You need to define the database_config.yml in rtm/spec.") end connection = RTM.connect($database_params) else connection = RTM.connect(:implementation => :majortom) end return connection end def get_used_tm_sys_tm engine = get_used_tm_sys begin tm = engine.create("http://www.topicmapslab.de/") rescue Exception => e print_stack_trace(e) raise(e.message) end return tm end def print_stack_trace(e) puts "\nError because of:" puts e.message while e.cause puts "and because of:" e = e.cause puts e.message puts e.printStackTrace end end