Sha256: 9fef9c19f922f55c0e0f94e4cbaa1d3b7ebb484733f57a97bf21a5b5cc2b83f9

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'java'

EHCACHE_LIBS_DIR = "#{Ehcache::EHCACHE_HOME}/ext"

module Ehcache
  slf4j_loader = lambda { Java::OrgSlf4j::LoggerFactory.getLogger("JRubyEhcache") }
  begin
    LOG = slf4j_loader.call
    LOG.info("Using SLF4J Logger from CLASSPATH")
  rescue NameError
    Dir["#{EHCACHE_LIBS_DIR}/**/*slf4j*.jar"].each do |l| require l end
    LOG = slf4j_loader.call
    LOG.info("Using bundled SLF4J Logger")
  end

  ehcache_version_loader = lambda {
    Java::NetSfEhcacheUtil::ProductInfo.new.getVersion()
  }
  begin
    # If Ehcache is already on the classpath, use it.
    VERSION = ehcache_version_loader.call
    LOG.info("Using Ehcache #{VERSION} from CLASSPATH")
  rescue NameError
    # If not, use the Ehcache bundled with the jruby-ehcache gem.
    Dir["#{EHCACHE_LIBS_DIR}/**/*.jar"].each do |l|
      require l unless l =~ /slf4j/
    end
    VERSION = ehcache_version_loader.call
    LOG.info("Using bundled Ehcache #{VERSION}")
  end

  include_package 'net.sf.ehcache'

  module Config
    include_package 'net.sf.ehcache.config'
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jruby-ehcache-1.1.1 lib/ehcache/java.rb
jruby-ehcache-1.1.0 lib/ehcache/java.rb
jruby-ehcache-1.0.0 lib/ehcache/java.rb