Sha256: 95f321b5c3d62df91346d9cdcdac23c8db4a315fd695fced399c61aec7979de5

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

module Trinidad
  module Extensions
    class DbpoolWebAppExtension < WebAppExtension
      def configure(tomcat, app_context)
        jndi = @options.delete(:jndi)
        url = @options.delete(:url)
        url = protocol + url unless %r{^#{protocol}} =~ url
        @options[:url] = url

        resource = Trinidad::Tomcat::ContextResource.new
        resource.setAuth(@options.delete(:auth)) if @options.has_key?(:auth) 
        resource.setName(jndi)
        resource.setType("javax.sql.DataSource")
        resource.setDescription(@options.delete(:description)) if @options.has_key?(:description)

        @options.each do |key, value|
          resource.setProperty(key.to_s, value.to_s)
        end

        resource.setProperty("driverClassName", driver_name)

        app_context.naming_resources.add_resource(resource)
        app_context.naming_resources = resource.naming_resources

        resource
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trinidad_dbpool-0.2.0 lib/trinidad_dbpool/webapp_extension.rb
trinidad_dbpool-0.1.1 lib/trinidad_dbpool/webapp_extension.rb