Sha256: ffabb8d7db6ba9aeff2625f9719975a765afd7b738240ea9e480e3b7bc0cddc3

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'pacer' unless defined? Pacer

lib_path = File.expand_path(File.join(File.dirname(__FILE__), '../lib'))
$:.unshift lib_path unless $:.any? { |path| path == lib_path }

require 'pacer-titan/version'
require Pacer::Titan::JAR
require 'pacer-titan/graph'
require 'pacer-titan/titan_query'
require 'pacer-titan/external_index_query'

module Pacer
  class << self
    def titan(path="config/inmemory.properties")      
      open = proc do
        graph = Pacer.open_graphs[path]
        unless graph
          args = [java.lang.String.java_class]
          graph = com.thinkaurelius.titan.core.TitanFactory.java_send(:open, args, path)
          Pacer.open_graphs[path] = graph
        end
        graph
      end
      
      shutdown = proc do |graph|
        graph.blueprints_graph.shutdown
        Pacer.open_graphs.delete path
      end

      Titan::Graph.new(Pacer::YamlEncoder, open, shutdown)
    end
    
    def executing_route(route)
      Rails.logger.debug "Pacer Titan executing route: #{route.description}" if defined? Rails
    end	
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pacer-titan-0.0.3-java lib/pacer-titan.rb
pacer-titan-0.0.2-java lib/pacer-titan.rb
pacer-titan-0.0.1-java lib/pacer-titan.rb