Class List Method List File List

# Class: VertxServiceDiscovery::JDBCDataSource

Inherits:
  Object
  - Object
  - VertxServiceDiscovery::JDBCDataSource
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/jdbc_data_source.rb

## Overview

@author Clement Escoffier

## Class Method Summary (collapse)

- + (Hash) create_record(name = nil, location = nil, metadata = nil)
- + (void) get_jdbc_client(discovery = nil, filter = nil, consumerConfiguration = nil) { ... }
  Convenient method that looks for a JDBC datasource source and provides the configured VertxJdbc::JDBCClient.

## Class Method Details

### + (`Hash`) create_record(name = nil, location = nil, metadata = nil)

Parameters:

- name (`String`) (defaults to: `nil`)
- location (`Hash{String => Object}`) (defaults to: `nil`)
- metadata (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

    22
    23
    24
    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/jdbc_data_source.rb', line 22

    def self.create_record(name=nil,location=nil,metadata=nil)
      if name.class == String && location.class == Hash && metadata.class == Hash && !block_given?
        return Java::IoVertxServicediscoveryTypes::JDBCDataSource.java_method(:createRecord, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(name,::Vertx::Util::Utils.to_json_object(location),::Vertx::Util::Utils.to_json_object(metadata)) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::JDBCDataSource.java_method(:createRecord, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(name,::Vertx::Util::Utils.to_json_object(location),::Vertx::Util::Utils.to_json_object(metadata)).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_record(name,location,metadata)"
    end

### + (`void`) get_jdbc_client(discovery = nil, filter = nil, consumerConfiguration = nil) { ... }

This method returns an undefined value.

Convenient method that looks for a JDBC datasource source and provides the configured VertxJdbc::JDBCClient. The async result is marked as failed is there are no matching services, or if the lookup fails.

Parameters:

- discovery (`::VertxServiceDiscovery::ServiceDiscovery`) (defaults to: `nil`) —
  The service discovery instance
- filter (`Hash{String => Object}`) (defaults to: `nil`) —
  The filter, optional
- consumerConfiguration (`Hash{String => Object}`) (defaults to: `nil`) —
  the consumer configuration

Yields:

- the result handler

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/jdbc_data_source.rb', line 35

    def self.get_jdbc_client(discovery=nil,filter=nil,consumerConfiguration=nil)
      if discovery.class.method_defined?(:j_del) && filter.class == Hash && block_given? && consumerConfiguration == nil
        return Java::IoVertxServicediscoveryTypes::JDBCDataSource.java_method(:getJDBCClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(discovery.j_del,::Vertx::Util::Utils.to_json_object(filter),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxJdbc::JDBCClient) : nil) }))
      elsif discovery.class.method_defined?(:j_del) && filter.class == Hash && consumerConfiguration.class == Hash && block_given?
        return Java::IoVertxServicediscoveryTypes::JDBCDataSource.java_method(:getJDBCClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(discovery.j_del,::Vertx::Util::Utils.to_json_object(filter),::Vertx::Util::Utils.to_json_object(consumerConfiguration),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxJdbc::JDBCClient) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_jdbc_client(discovery,filter,consumerConfiguration)"
    end