root/Explorator/trunk/vendor/plugins/active_rdf/lib/active_rdf.rb @ 487

Revision 487, 1.7 KB (checked in by mauriciobomfim, 7 years ago)

Added jruby support

Line 
1
2require 'rubygems'
3
4# ActiveRDF loader
5
6# determine the directory in which we are running depending on cruby or jruby
7file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
8this_dir = File.dirname(File.expand_path(file)) 
9
10
11$: << this_dir + '/'
12$: << this_dir + '/active_rdf/'
13
14require 'active_rdf_helpers'
15require 'active_rdf_log'
16
17$activerdflog.info "ActiveRDF started, logging level: #{$activerdflog.level}"
18
19# load standard classes that need to be loaded at startup
20require 'objectmanager/resource'
21require 'objectmanager/bnode'
22require 'objectmanager/literal'
23require 'objectmanager/namespace'
24require 'federation/connection_pool'
25require 'queryengine/query'
26require 'federation/active_rdf_adapter'
27
28def load_adapter s
29  begin
30    require s
31  rescue Exception => e
32    $activerdflog.info "could not load adapter #{s}: #{e}"
33  end
34end
35
36
37# determine whether activerdf is installed as a gem:
38if Gem::cache.search(/^activerdf$/).empty?
39        # we are not running as a gem
40        $activerdflog.info 'ActiveRDF is NOT installed as a Gem'
41        #load_adapter this_dir + '/../activerdf-rdflite/lib/activerdf_rdflite/rdflite'
42        #load_adapter this_dir + '/../activerdf-rdflite/lib/activerdf_rdflite/fetching'
43        #load_adapter this_dir + '/../activerdf-rdflite/lib/activerdf_rdflite/suggesting'
44        #load_adapter this_dir + '/../activerdf-redland/lib/activerdf_redland/redland'
45        load_adapter this_dir + '/../activerdf-sparql/lib/activerdf_sparql/sparql'
46        #load_adapter this_dir + '/../activerdf-yars/lib/activerdf_yars/jars2'   
47 
48else
49        # we are running as a gem
50        require 'gem_plugin'
51        $activerdflog.info 'ActiveRDF is installed as a Gem'
52        GemPlugin::Manager.instance.load "activerdf" => GemPlugin::INCLUDE
53end
54
Note: See TracBrowser for help on using the browser.