Class: RBoss::HypersonicReplacer

Inherits:
Object
  • Object
show all
Includes:
FileUtils, Component
Defined in:
lib/rboss/components/hypersonic_replacer.rb,
lib/rboss/components/soa-p/hypersonic_replacer.rb

Overview

A class to replace Hypersonic in SOA-P. This class makes a build.properties file and calls the ant script present in $JBOSS_HOME/tools/schema/build.xml since this script does everything we need to replace Hypersonic.

The configuration must be in a form key => value and the keys needs to be in the $JBOSS_HOME/tools/schema/build.properties file.

The ant script minimal keys are:

- db.name
- db.hostname
- db.port
- db.username
- db.password
- source.dir (the directory in $JBOSS_HOME/tools/schema/ that matches the database type)

author: Marcelo Guimarães <[email protected]>

Instance Method Summary collapse

Methods included from Component

#initialize, #load_yaml, #new_file_processor

Instance Method Details

#configure(config) ⇒ Object



37
38
39
40
41
# File 'lib/rboss/components/hypersonic_replacer.rb', line 37

def configure config
  @datasource = config if config.is_a? Datasource
  @datasource ||= Datasource::new(@jboss, @logger, config)
  @datasource.jndi_name = "DefaultDS"
end

#defaultsObject



46
47
48
49
50
51
52
53
54
55
# File 'lib/rboss/components/soa-p/hypersonic_replacer.rb', line 46

def defaults
  {
    "org.jboss.esb.server.home" => File.expand_path(@jboss.home),
    "org.jboss.esb.server.clustered" => "#{File.exists? "#{@jboss.profile}/farm"}",
    "org.jboss.esb.server.config" => "#{@jboss.profile_name}",

    "db.minpoolsize" => 15,
    "db.maxpoolsize" => 50
  }
end

#processObject



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rboss/components/hypersonic_replacer.rb', line 43

def process
  @logger.info "Removing Hypersonic..."
  rm_f "#{@jboss.profile}/deploy/hsqldb-ds.xml"
  rm_f "#{@jboss.profile}/deploy/messaging/hsqldb-persistence-service.xml"

  @datasource.process

  @logger.info "Copying persistence service template for #{@datasource.type}..."
  # For postgres, the jms example filename differs from jca
  @datasource.type = :postgresql if @datasource.type.to_s == "postgres"
  cp "#{@jboss.home}/docs/examples/jms/#{@datasource.type}-persistence-service.xml", "#{@jboss.profile}/deploy/messaging"
end