Sha256: a359ad12eb32c8bbdefd6c94c318cc3b90572318531016936bcc3c5893f3c704
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module Trinidad module Extensions class DbpoolWebAppExtension < WebAppExtension def configure(tomcat, app_context) case @options when Hash [create_resource tomcat, app_context, @options] when Array @options.map { |opts| create_resource tomcat, app_context, opts } end end private def create_resource tomcat, app_context, opts jndi = opts.delete(:jndi) url = opts.delete(:url) url = protocol + url unless %r{^#{protocol}} =~ url opts[:url] = url resource = Trinidad::Tomcat::ContextResource.new resource.set_auth(opts.delete(:auth)) if opts.key?(:auth) resource.set_name(jndi) resource.set_type('javax.sql.DataSource') resource.set_description(opts.delete(:description)) if opts.key?(:description) opts.each { |key, value| resource.set_property(key.to_s, value.to_s) } resource.set_property('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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trinidad_dbpool-0.3.0 | lib/trinidad_dbpool/webapp_extension.rb |