class DSpace::Config

Public Class Methods

new(dspace_home) click to toggle source
# File lib/dspace/dspace.rb, line 228
def initialize(dspace_home)
  @dspace_dir = dspace_home
  puts "Using #{@dspace_dir}"
  @dspace_cfg = "#{@dspace_dir}/config/dspace.cfg";
  @dspace_jars ||= Dir[File.join(@dspace_dir, 'lib/*.jar')]
  @context = nil;
  @kernel = nil;
end

Public Instance Methods

context() click to toggle source
# File lib/dspace/dspace.rb, line 245
def context
  init
  return @context
end
context_renew() click to toggle source
# File lib/dspace/dspace.rb, line 250
def context_renew
  @context.abort if @context
  @context = org.dspace.core.Context.new()
end
dspace_cfg() click to toggle source
# File lib/dspace/dspace.rb, line 241
def dspace_cfg
  @dspace_cfg || raise('dspace.cfg is undefined');
end
dspace_dir() click to toggle source
# File lib/dspace/dspace.rb, line 237
def dspace_dir
  @dspace_dir || raise('dspace_dir is undefined');
end
init() click to toggle source
# File lib/dspace/dspace.rb, line 255
def init
  if @context.nil? then
    puts "Loading jars"
    @dspace_jars.each do |jar|
      require jar
    end
    puts "Loading #{@dspace_cfg}"
    org.dspace.core.ConfigurationManager.load_config(@dspace_cfg)

    kernel_impl = org.dspace.servicemanager.DSpaceKernelInit.get_kernel(nil)
    if not kernel_impl.is_running then
      puts "Starting new DSpaceKernel"
      kernel_impl.start(@dspace_dir)
    end
    @kernel = kernel_impl;

    @context = org.dspace.core.Context.new()
  end
end