neo4j-java-driver 0.3.2-java → 4.1.0.beta.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80aa014268c37593184afdd382a4b592f67f39e14acc90ff275697bdf220835e
4
- data.tar.gz: d483ae75865378d922e43364ab938c8c8ee49f3794ec1921b550abf4c740257a
3
+ metadata.gz: 5631416868ef0ee4e31eee3ebe51534110c0dc8edf012121d0555662141fd79a
4
+ data.tar.gz: 9d2703ce1ccb0ac139589582b26c274b5a4985cd01e160634e45b9a058600205
5
5
  SHA512:
6
- metadata.gz: 7ff736a3dcc239556265d588c3855f284ec4e04038391eef015f5cebadcb8e7dbe8137385472a6b7948b8e3e5b3a607df2d0bb7fc69fa1ce46e8847bd2821a9e
7
- data.tar.gz: 5c2f1a36b1456d8532dc333b6a3b7fbfef9e747581736d3fa5dbaf546113cbcbcbb50b3ae537690d84464a628980332823adde447559991fe8105dbfcb7815cc
6
+ metadata.gz: b0003aa8a1bf14b9d7daca164c9cb1ce79fecb7d354495123a5bd3dc1f75c266707e8617c652f5df3b6294b4ce79415cce71c2d57e7cb099eef91d68ca32de64
7
+ data.tar.gz: 166d16d61082ad1c8997c6f50c0d72c25ac23cbd1a495c1d175f0061e992fe44b75b96ef80788c3f7d1fc89221f52f3cc4cb04c0107550f9840ba29d4056d6e2
data/README.md CHANGED
@@ -26,8 +26,13 @@ Or install it yourself as:
26
26
 
27
27
  ### neo4j-ruby-driver
28
28
 
29
- As a prerequisite [seabolt](https://github.com/neo4j-drivers/seabolt) must be installed. Please follow the instructions to install either from package or source.
30
- Add `SEABOLT_LIB` environment variable with the location of the installed library.
29
+ As a prerequisite seabolt must be installed.
30
+
31
+ On macOS
32
+
33
+ $ brew install michael-simons/homebrew-seabolt/seabolt
34
+
35
+ On other systems please follow the instructions to install [seabolt](https://github.com/neo4j-drivers/seabolt) either from package or source. Make sure the libseabolt17 ends up in a system lib path e.g. /usr/local/lib
31
36
 
32
37
  Add this line to your application's Gemfile:
33
38
 
@@ -56,17 +61,23 @@ This gem includes 2 different implementations: java driver based and another one
56
61
 
57
62
  For java driver based:
58
63
 
59
- $ bin/setup
64
+ $ driver=java bin/setup
60
65
 
61
- FFI based same as above but with SEABOLT_LIB variable set (e.g. on Mac OSX):
66
+ FFI based same as above but with driver variable set:
62
67
 
63
- $ SEABOLT_LIB=~/seabolt/build/dist/lib/libseabolt17.dylib bin/setup
68
+ $ bin/setup
64
69
 
65
- Please note that seabolt has to be installed separately: https://github.com/neo4j-drivers/seabolt
70
+ ## Testing
71
+
72
+ To run the tests the following tools need to be installed:
73
+
74
+ $ brew install python
75
+ $ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
76
+ $ neoctrl-install -e 4.0.2 servers
77
+ $ neoctrl-configure servers/neo4j-enterprise-4.0.2 dbms.directories.import= dbms.default_listen_address=::
78
+ $ neoctrl-set-initial-password password servers/neo4j-enterprise-4.0.2
79
+ $ neoctrl-start servers/neo4j-enterprise-4.0.2
66
80
 
67
- In order to run test by running `rake spec` you may have to set your own `NEO4J_BOLT_URL` URI or it will
68
- fallback to `bolt://localhost:7687`.
69
-
70
81
  ## Contributing
71
82
 
72
83
  Suggestions, improvements, bug reports and pull requests are welcome on GitHub at https://github.com/neo4jrb/neo4j-ruby-driver.
@@ -7,14 +7,18 @@ require 'neo4j-java-driver_jars'
7
7
 
8
8
  module Neo4j
9
9
  module Driver
10
- include_package 'org.neo4j.driver.v1'
10
+ include_package 'org.neo4j.driver'
11
+
12
+ Record = Java::OrgNeo4jDriverInternal::InternalRecord
13
+ Result = Java::OrgNeo4jDriverInternal::InternalResult
14
+ Transaction = Java::OrgNeo4jDriverInternal::InternalTransaction
11
15
 
12
16
  module Net
13
- include_package 'org.neo4j.driver.v1.net'
17
+ include_package 'org.neo4j.driver.net'
14
18
  end
15
19
 
16
20
  module Summary
17
- include_package 'org.neo4j.driver.v1.summary'
21
+ include_package 'org.neo4j.driver.summary'
18
22
  end
19
23
 
20
24
  module Types
@@ -24,7 +28,7 @@ module Neo4j
24
28
  Relationship = Java::OrgNeo4jDriverInternal::InternalRelationship
25
29
  end
26
30
 
27
- # Workaround for missing zeitwerk support in jruby-9.2.8.0
31
+ # Workaround for missing zeitwerk support as of jruby-9.2.13.0
28
32
  module Ext
29
33
  module Internal
30
34
  module Summary
@@ -37,19 +41,21 @@ end
37
41
 
38
42
  Loader.load
39
43
 
44
+ Java::OrgNeo4jDriver::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
45
+ Java::OrgNeo4jDriver::Bookmark.singleton_class.prepend Neo4j::Driver::Ext::Bookmark::ClassMethods
46
+ Java::OrgNeo4jDriver::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
47
+ Java::OrgNeo4jDriver::Query.prepend Neo4j::Driver::Ext::Query
48
+ Java::OrgNeo4jDriverInternal::InternalBookmark.include Neo4j::Driver::Ext::Bookmark::InstanceMethods
40
49
  Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
41
- Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::MapAccessor
50
+ Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
42
51
  Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
43
52
  Java::OrgNeo4jDriverInternal::InternalPath.include Neo4j::Driver::Ext::StartEndNaming
44
53
  Java::OrgNeo4jDriverInternal::InternalPath::SelfContainedSegment.include Neo4j::Driver::Ext::StartEndNaming
45
54
  Java::OrgNeo4jDriverInternal::InternalRecord.prepend Neo4j::Driver::Ext::InternalRecord
46
55
  Java::OrgNeo4jDriverInternal::InternalRelationship.prepend Neo4j::Driver::Ext::InternalRelationship
47
- Java::OrgNeo4jDriverInternal::InternalStatementResult.prepend Neo4j::Driver::Ext::InternalStatementResult
48
- Java::OrgNeo4jDriverInternal::ExplicitTransaction.prepend Neo4j::Driver::Ext::RunOverride
49
- Java::OrgNeo4jDriverInternal::NetworkSession.prepend Neo4j::Driver::Ext::RunOverride
56
+ Java::OrgNeo4jDriverInternal::InternalResult.prepend Neo4j::Driver::Ext::InternalResult
57
+ Java::OrgNeo4jDriverInternal::InternalSession.prepend Neo4j::Driver::Ext::InternalSession
58
+ Java::OrgNeo4jDriverInternal::InternalTransaction.prepend Neo4j::Driver::Ext::InternalTransaction
50
59
  Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
51
60
  Java::OrgNeo4jDriverInternalValue::ValueAdapter.include Neo4j::Driver::Ext::RubyConverter
52
- Java::OrgNeo4jDriverV1::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
53
- Java::OrgNeo4jDriverV1::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
54
- Java::OrgNeo4jDriverV1::Statement.prepend Neo4j::Driver::Ext::Statement
55
- Java::OrgNeo4jDriverV1Exceptions::Neo4jException.include Neo4j::Driver::Ext::ExceptionMapper
61
+ Java::OrgNeo4jDriverExceptions::Neo4jException.include Neo4j::Driver::Ext::ExceptionMapper
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module Bookmark
7
+ module ClassMethods
8
+ def from(values)
9
+ super(java.util.HashSet.new(values))
10
+ end
11
+ end
12
+
13
+ module InstanceMethods
14
+ extend ActiveSupport::Concern
15
+ included do
16
+ delegate :to_set, to: :values
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module ConfigConverter
7
+ include NeoConverter
8
+
9
+ private
10
+
11
+ def to_java_config(builder_class, **hash)
12
+ hash.reduce(builder_class.builder) { |object, key_value| object.send(*config_method(*key_value)) }.build
13
+ end
14
+
15
+ def config_method(key, value)
16
+ method = :"with_#{key}"
17
+ unit = nil
18
+ case key.to_s
19
+ when 'encryption'
20
+ unless value
21
+ method = :without_encryption
22
+ value = nil
23
+ end
24
+ when 'timeout'
25
+ value = java.time.Duration.ofMillis(Driver::Internal::DurationNormalizer.milliseconds(value))
26
+ when /time(out)?$/
27
+ value = Driver::Internal::DurationNormalizer.milliseconds(value)
28
+ unit = java.util.concurrent.TimeUnit::MILLISECONDS
29
+ when 'logger'
30
+ method = :with_logging
31
+ value = Neo4j::Driver::Ext::Logger.new(value)
32
+ when 'resolver'
33
+ proc = value
34
+ value = ->(address) { java.util.HashSet.new(proc.call(address)) }
35
+ when 'bookmarks'
36
+ return [method, *value]
37
+ else
38
+ value = to_neo(value, skip_unknown: true)
39
+ end
40
+ [method, value, unit].compact
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -6,11 +6,11 @@ module Neo4j
6
6
  module ExceptionCheckable
7
7
  def check
8
8
  yield
9
- rescue Java::OrgNeo4jDriverV1Exceptions::Neo4jException => e
9
+ rescue Java::OrgNeo4jDriverExceptions::Neo4jException => e
10
10
  e.reraise
11
- rescue Java::OrgNeo4jDriverV1Exceptions::NoSuchRecordException => e
11
+ rescue Java::OrgNeo4jDriverExceptions::NoSuchRecordException => e
12
12
  raise Neo4j::Driver::Exceptions::NoSuchRecordException, e.message
13
- rescue Java::OrgNeo4jDriverV1Exceptions::UntrustedServerException => e
13
+ rescue Java::OrgNeo4jDriverExceptions::UntrustedServerException => e
14
14
  raise Neo4j::Driver::Exceptions::UntrustedServerException, e.message
15
15
  rescue Java::JavaLang::IllegalStateException => e
16
16
  raise Neo4j::Driver::Exceptions::IllegalStateException, e.message
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- java_import org.neo4j.driver.v1.exceptions.AuthenticationException
4
- java_import org.neo4j.driver.v1.exceptions.ClientException
5
- java_import org.neo4j.driver.v1.exceptions.DatabaseException
6
- java_import org.neo4j.driver.v1.exceptions.ProtocolException
7
- java_import org.neo4j.driver.v1.exceptions.SecurityException
8
- java_import org.neo4j.driver.v1.exceptions.ServiceUnavailableException
9
- java_import org.neo4j.driver.v1.exceptions.SessionExpiredException
10
- java_import org.neo4j.driver.v1.exceptions.TransientException
11
- java_import org.neo4j.driver.v1.exceptions.UntrustedServerException
3
+ java_import org.neo4j.driver.exceptions.AuthenticationException
4
+ java_import org.neo4j.driver.exceptions.ClientException
5
+ java_import org.neo4j.driver.exceptions.DatabaseException
6
+ java_import org.neo4j.driver.exceptions.ProtocolException
7
+ java_import org.neo4j.driver.exceptions.ResultConsumedException
8
+ java_import org.neo4j.driver.exceptions.SecurityException
9
+ java_import org.neo4j.driver.exceptions.ServiceUnavailableException
10
+ java_import org.neo4j.driver.exceptions.SessionExpiredException
11
+ java_import org.neo4j.driver.exceptions.TransientException
12
+ java_import org.neo4j.driver.exceptions.UntrustedServerException
12
13
 
13
14
  module Neo4j
14
15
  module Driver
@@ -39,6 +40,8 @@ module Neo4j
39
40
  case exception
40
41
  when AuthenticationException
41
42
  Neo4j::Driver::Exceptions::AuthenticationException
43
+ when ResultConsumedException
44
+ Neo4j::Driver::Exceptions::ResultConsumedException
42
45
  when ClientException
43
46
  Neo4j::Driver::Exceptions::ClientException
44
47
  when DatabaseException
@@ -5,48 +5,23 @@ module Neo4j
5
5
  module Ext
6
6
  module GraphDatabase
7
7
  extend AutoClosable
8
+ include ConfigConverter
8
9
  include ExceptionCheckable
9
10
 
10
11
  auto_closable :driver, :routing_driver
11
12
 
12
- def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, config = nil)
13
+ def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, **config)
13
14
  check do
14
- java_method(:driver, [java.lang.String, org.neo4j.driver.v1.AuthToken, org.neo4j.driver.v1.Config])
15
- .call(uri.to_s, auth_token, to_java_config(config))
15
+ java_method(:driver, [java.lang.String, org.neo4j.driver.AuthToken, org.neo4j.driver.Config])
16
+ .call(uri.to_s, auth_token, to_java_config(Neo4j::Driver::Config, config))
16
17
  end
17
18
  end
18
19
 
19
- def routing_driver(routing_uris, auth_token, config)
20
- check { super(routing_uris.map { |uri| java.net.URI.create(uri.to_s) }, auth_token, to_java_config(config)) }
21
- end
22
-
23
- private
24
-
25
- def to_java_config(hash)
26
- hash&.reduce(Neo4j::Driver::Config.build) { |object, key_value| object.send(*config_method(*key_value)) }
27
- &.to_config
28
- end
29
-
30
- def config_method(key, value)
31
- method = :"with_#{key}"
32
- unit = nil
33
- case key.to_s
34
- when 'encryption'
35
- unless value
36
- method = :without_encryption
37
- value = nil
38
- end
39
- when /Time(out)?$/i
40
- value = Driver::Internal::DurationNormalizer.milliseconds(value)
41
- unit = java.util.concurrent.TimeUnit::MILLISECONDS
42
- when 'logger'
43
- method = :with_logging
44
- value = Neo4j::Driver::Ext::Logger.new(value)
45
- when 'resolver'
46
- proc = value
47
- value = ->(address) { java.util.HashSet.new(proc.call(address)) }
20
+ def routing_driver(routing_uris, auth_token, **config)
21
+ check do
22
+ super(routing_uris.map { |uri| java.net.URI.create(uri.to_s) }, auth_token,
23
+ to_java_config(Neo4j::Driver::Config, config))
48
24
  end
49
- [method, value, unit].compact
50
25
  end
51
26
  end
52
27
  end
@@ -5,12 +5,18 @@ module Neo4j
5
5
  module Ext
6
6
  module InternalDriver
7
7
  extend AutoClosable
8
+ include ConfigConverter
9
+ include ExceptionCheckable
8
10
 
9
11
  auto_closable :session
10
12
 
11
- def session(*args)
12
- java_method(:session, [org.neo4j.driver.v1.AccessMode, java.lang.Iterable])
13
- .call(*Neo4j::Driver::Internal::RubySignature.session(args))
13
+ def session(**session_config)
14
+ java_method(:session, [org.neo4j.driver.SessionConfig])
15
+ .call(to_java_config(Neo4j::Driver::SessionConfig, session_config))
16
+ end
17
+
18
+ def verify_connectivity
19
+ check { super }
14
20
  end
15
21
  end
16
22
  end
@@ -3,14 +3,18 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
- module MapAccessor
6
+ module InternalEntity
7
7
  include MapConverter
8
8
 
9
- alias properties to_hash
9
+ alias properties to_h
10
10
 
11
11
  def [](key)
12
12
  get(key.to_s).as_ruby_object
13
13
  end
14
+
15
+ def ==(other)
16
+ java_method(:isEqual).call(other)
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module InternalKeys
7
+ include ExceptionCheckable
8
+
9
+ def keys
10
+ check { super.map(&:to_sym) }
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,12 +4,20 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module InternalRecord
7
+ include MapConverter
8
+ include InternalKeys
9
+
7
10
  def values
8
11
  java_send(:values).map(&:as_ruby_object)
9
12
  end
10
13
 
11
- define_method(:[]) do |key|
12
- java_method(:get, [key.is_a?(Integer) ? Java::int : java.lang.String]).call(key).as_ruby_object
14
+ def [](key)
15
+ case key
16
+ when Integer
17
+ java_method(:get, [Java::int]).call(key)
18
+ else
19
+ java_method(:get, [java.lang.String]).call(key.to_s)
20
+ end.as_ruby_object
13
21
  end
14
22
 
15
23
  def first
@@ -3,11 +3,12 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
- module InternalStatementResult
6
+ module InternalResult
7
7
  include Enumerable
8
8
  include ExceptionCheckable
9
+ include InternalKeys
9
10
 
10
- %i[has_next? next keys single consume summary peek].each do |method|
11
+ %i[has_next? next single consume peek].each do |method|
11
12
  define_method(method) do |*args, &block|
12
13
  check { super(*args, &block) }
13
14
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module InternalSession
7
+ extend AutoClosable
8
+ include ConfigConverter
9
+ include ExceptionCheckable
10
+ include RunOverride
11
+
12
+ auto_closable :begin_transaction
13
+
14
+ # work around jruby issue https://github.com/jruby/jruby/issues/5603
15
+ Struct.new('Wrapper', :object)
16
+
17
+ %i[read write].each do |prefix|
18
+ define_method("#{prefix}_transaction") do |**config, &block|
19
+ check do
20
+ super(->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) }, to_java_config(Neo4j::Driver::TransactionConfig, config)).object
21
+ end
22
+ end
23
+ end
24
+
25
+ # end work around
26
+
27
+ def run(statement, parameters = {}, config = {})
28
+ check do
29
+ java_method(:run, [org.neo4j.driver.Query, org.neo4j.driver.TransactionConfig])
30
+ .call(to_statement(statement, parameters), to_java_config(Neo4j::Driver::TransactionConfig, config))
31
+ end
32
+ end
33
+
34
+ def begin_transaction(**config)
35
+ check { super(to_java_config(Neo4j::Driver::TransactionConfig, config)) }
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module InternalTransaction
7
+ include ExceptionCheckable
8
+ include RunOverride
9
+
10
+ def run(statement, parameters = {})
11
+ check { super(to_statement(statement, parameters)) }
12
+ end
13
+
14
+ def commit
15
+ check { super }
16
+ end
17
+
18
+ # def rollback
19
+ # check { super }
20
+ # end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -4,8 +4,8 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  class Logger
7
- include org.neo4j.driver.v1.Logger
8
- include org.neo4j.driver.v1.Logging
7
+ include org.neo4j.driver.Logger
8
+ include org.neo4j.driver.Logging
9
9
 
10
10
  delegate :debug?, to: :@active_support_logger
11
11
 
@@ -4,8 +4,9 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module MapConverter
7
- def to_hash
8
- as_map(&:itself).to_hash.transform_values!(&:as_ruby_object).symbolize_keys!
7
+ def to_h
8
+ java_method(:asMap, [java.util.function.Function]).call(&:itself).to_hash
9
+ .transform_values!(&:as_ruby_object).symbolize_keys!
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module NeoConverter
7
+ private
8
+
9
+ def to_neo(object, skip_unknown: false)
10
+ case object
11
+ when Hash
12
+ object.map { |key, value| [key.to_s, to_neo(value)] }.to_h
13
+ when Types::Path
14
+ Exceptions::ClientException.unable_to_convert(object)
15
+ when Enumerable
16
+ object.map(&method(:to_neo))
17
+ when Types::Bytes
18
+ object.to_java_bytes
19
+ when Date
20
+ Java::JavaTime::LocalDate.of(object.year, object.month, object.day)
21
+ when ActiveSupport::Duration
22
+ Java::OrgNeo4jDriverInternal::InternalIsoDuration.new(
23
+ *Driver::Internal::DurationNormalizer.normalize(object)
24
+ )
25
+ when Types::Point
26
+ Java::OrgNeo4jDriver::Values.point(object.srid, *object.coordinates)
27
+ when Types::OffsetTime
28
+ Java::JavaTime::OffsetTime.of(object.hour, object.min, object.sec,
29
+ object.nsec, Java::JavaTime::ZoneOffset.of_total_seconds(object.utc_offset))
30
+ when Types::LocalTime
31
+ Java::JavaTime::LocalTime.of(object.hour, object.min, object.sec, object.nsec)
32
+ when Types::LocalDateTime
33
+ Java::JavaTime::LocalDateTime.of(object.year, object.month, object.day, object.hour, object.min, object.sec,
34
+ object.nsec)
35
+ when ActiveSupport::TimeWithZone
36
+ to_zoned_date_time(object, object.time_zone.tzinfo.identifier)
37
+ when Time
38
+ to_zoned_date_time(object, object.formatted_offset)
39
+ when nil, true, false, Integer, Float, String
40
+ object
41
+ else
42
+ if skip_unknown
43
+ object
44
+ else
45
+ raise Exceptions::ClientException.unable_to_convert(object)
46
+ end
47
+ end
48
+ end
49
+
50
+ def to_zoned_date_time(object, zone)
51
+ Java::JavaTime::ZonedDateTime.of(object.year, object.month, object.day, object.hour, object.min, object.sec,
52
+ object.nsec, Java::JavaTime::ZoneId.of(zone))
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -3,7 +3,7 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
- module Statement
6
+ module Query
7
7
  def parameters
8
8
  super.as_ruby_object
9
9
  end
@@ -11,7 +11,7 @@ module Neo4j
11
11
  when Java::OrgNeo4jDriverInternalTypes::TypeConstructor::LIST
12
12
  values(&:itself).map(&:as_ruby_object)
13
13
  when Java::OrgNeo4jDriverInternalTypes::TypeConstructor::MAP
14
- to_hash
14
+ to_h
15
15
  when Java::OrgNeo4jDriverInternalTypes::TypeConstructor::DATE
16
16
  date = as_local_date
17
17
  Date.new(date.year, date.month_value, date.day_of_month)
@@ -4,33 +4,7 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module RunOverride
7
- include ExceptionCheckable
8
- extend AutoClosable
9
-
10
- auto_closable :begin_transaction
11
-
12
- # work around jruby issue https://github.com/jruby/jruby/issues/5603
13
- Struct.new('Wrapper', :object)
14
-
15
- %i[read write].each do |prefix|
16
- define_method("#{prefix}_transaction") do |&block|
17
- check { super { |tx| Struct::Wrapper.new(reverse_check { block.call(tx) }) }.object }
18
- end
19
- end
20
-
21
- # end work around
22
-
23
- def run(statement, parameters = {})
24
- Neo4j::Driver::Internal::Validator.require_hash_parameters!(parameters)
25
- check do
26
- java_method(:run, [org.neo4j.driver.v1.Statement])
27
- .call(Neo4j::Driver::Statement.new(statement, to_neo(parameters) || {}))
28
- end
29
- end
30
-
31
- def begin_transaction # (config = nil)
32
- check { super }
33
- end
7
+ include NeoConverter
34
8
 
35
9
  def close
36
10
  check { super }
@@ -38,46 +12,9 @@ module Neo4j
38
12
 
39
13
  private
40
14
 
41
- def to_neo(object)
42
- case object
43
- when Hash
44
- object.map { |key, value| [key.to_s, to_neo(value)] }.to_h
45
- when Types::Path
46
- Exceptions::ClientException.unable_to_convert(object)
47
- when Enumerable
48
- object.map(&method(:to_neo))
49
- when Types::Bytes
50
- object.to_java_bytes
51
- when Date
52
- Java::JavaTime::LocalDate.of(object.year, object.month, object.day)
53
- when ActiveSupport::Duration
54
- Java::OrgNeo4jDriverInternal::InternalIsoDuration.new(
55
- *Driver::Internal::DurationNormalizer.normalize(object)
56
- )
57
- when Types::Point
58
- Java::OrgNeo4jDriverV1::Values.point(object.srid, *object.coordinates)
59
- when Types::OffsetTime
60
- Java::JavaTime::OffsetTime.of(object.hour, object.min, object.sec,
61
- object.nsec, Java::JavaTime::ZoneOffset.of_total_seconds(object.utc_offset))
62
- when Types::LocalTime
63
- Java::JavaTime::LocalTime.of(object.hour, object.min, object.sec, object.nsec)
64
- when Types::LocalDateTime
65
- Java::JavaTime::LocalDateTime.of(object.year, object.month, object.day, object.hour, object.min, object.sec,
66
- object.nsec)
67
- when ActiveSupport::TimeWithZone
68
- to_zoned_date_time(object, object.time_zone.tzinfo.identifier)
69
- when Time
70
- to_zoned_date_time(object, object.formatted_offset)
71
- when nil, true, false, Integer, Float, String
72
- object
73
- else
74
- raise Exceptions::ClientException.unable_to_convert(object)
75
- end
76
- end
77
-
78
- def to_zoned_date_time(object, zone)
79
- Java::JavaTime::ZonedDateTime.of(object.year, object.month, object.day, object.hour, object.min, object.sec,
80
- object.nsec, Java::JavaTime::ZoneId.of(zone))
15
+ def to_statement(text, parameters)
16
+ Neo4j::Driver::Internal::Validator.require_hash_parameters!(parameters)
17
+ Neo4j::Driver::Query.new(text, to_neo(parameters || {}))
81
18
  end
82
19
  end
83
20
  end
@@ -12,8 +12,8 @@ module Neo4j
12
12
  def with_block_definer(methods)
13
13
  Module.new do
14
14
  methods.each do |method|
15
- define_method(method) do |*args, &block|
16
- closable = super(*args)
15
+ define_method(method) do |*args, **kwargs, &block|
16
+ closable = super(*args, **kwargs)
17
17
  if block
18
18
  begin
19
19
  block.arity.zero? ? closable.instance_eval(&block) : block.call(closable)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Exceptions
6
+ class ResultConsumedException < ClientException
7
+ end
8
+ end
9
+ end
10
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '0.3.2'
5
+ VERSION = '4.1.0.beta.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-java-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 4.1.0.beta.1
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-24 00:00:00.000000000 Z
11
+ date: 2020-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: '0'
19
19
  name: activesupport
20
- prerelease: false
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
@@ -31,8 +31,8 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.1.10
33
33
  name: zeitwerk
34
- prerelease: false
35
34
  type: :runtime
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
@@ -45,8 +45,8 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  name: jar-dependencies
48
- prerelease: false
49
48
  type: :runtime
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
@@ -59,8 +59,8 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  name: ffaker
62
- prerelease: false
63
62
  type: :development
63
+ prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
@@ -73,8 +73,8 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  name: hoe
76
- prerelease: false
77
76
  type: :development
77
+ prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
@@ -87,8 +87,8 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  name: hoe-bundler
90
- prerelease: false
91
90
  type: :development
91
+ prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
@@ -101,27 +101,13 @@ dependencies:
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  name: hoe-gemspec
104
- prerelease: false
105
104
  type: :development
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: 0.3.0
117
- name: neo4j-rake_tasks
118
105
  prerelease: false
119
- type: :development
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - ">="
123
109
  - !ruby/object:Gem::Version
124
- version: 0.3.0
110
+ version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  requirement: !ruby/object:Gem::Requirement
127
113
  requirements:
@@ -129,8 +115,8 @@ dependencies:
129
115
  - !ruby/object:Gem::Version
130
116
  version: '0'
131
117
  name: parallel
132
- prerelease: false
133
118
  type: :development
119
+ prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - ">="
@@ -143,8 +129,8 @@ dependencies:
143
129
  - !ruby/object:Gem::Version
144
130
  version: '0'
145
131
  name: rake
146
- prerelease: false
147
132
  type: :development
133
+ prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - ">="
@@ -157,8 +143,8 @@ dependencies:
157
143
  - !ruby/object:Gem::Version
158
144
  version: '0'
159
145
  name: rspec-its
160
- prerelease: false
161
146
  type: :development
147
+ prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - ">="
@@ -171,8 +157,8 @@ dependencies:
171
157
  - !ruby/object:Gem::Version
172
158
  version: '0'
173
159
  name: rspec-mocks
174
- prerelease: false
175
160
  type: :development
161
+ prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - ">="
@@ -185,8 +171,8 @@ dependencies:
185
171
  - !ruby/object:Gem::Version
186
172
  version: '0'
187
173
  name: ruby-maven
188
- prerelease: false
189
174
  type: :development
175
+ prerelease: false
190
176
  version_requirements: !ruby/object:Gem::Requirement
191
177
  requirements:
192
178
  - - ">="
@@ -202,8 +188,8 @@ dependencies:
202
188
  - !ruby/object:Gem::Version
203
189
  version: '7'
204
190
  name: rdoc
205
- prerelease: false
206
191
  type: :development
192
+ prerelease: false
207
193
  version_requirements: !ruby/object:Gem::Requirement
208
194
  requirements:
209
195
  - - ">="
@@ -225,22 +211,28 @@ files:
225
211
  - README.md
226
212
  - jruby/neo4j/driver.rb
227
213
  - jruby/neo4j/driver/ext/auth_tokens.rb
214
+ - jruby/neo4j/driver/ext/bookmark.rb
215
+ - jruby/neo4j/driver/ext/config_converter.rb
228
216
  - jruby/neo4j/driver/ext/exception_checkable.rb
229
217
  - jruby/neo4j/driver/ext/exception_mapper.rb
230
218
  - jruby/neo4j/driver/ext/graph_database.rb
231
219
  - jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb
232
220
  - jruby/neo4j/driver/ext/internal_driver.rb
221
+ - jruby/neo4j/driver/ext/internal_entity.rb
222
+ - jruby/neo4j/driver/ext/internal_keys.rb
233
223
  - jruby/neo4j/driver/ext/internal_node.rb
234
224
  - jruby/neo4j/driver/ext/internal_record.rb
235
225
  - jruby/neo4j/driver/ext/internal_relationship.rb
236
- - jruby/neo4j/driver/ext/internal_statement_result.rb
226
+ - jruby/neo4j/driver/ext/internal_result.rb
227
+ - jruby/neo4j/driver/ext/internal_session.rb
228
+ - jruby/neo4j/driver/ext/internal_transaction.rb
237
229
  - jruby/neo4j/driver/ext/logger.rb
238
- - jruby/neo4j/driver/ext/map_accessor.rb
239
230
  - jruby/neo4j/driver/ext/map_converter.rb
231
+ - jruby/neo4j/driver/ext/neo_converter.rb
232
+ - jruby/neo4j/driver/ext/query.rb
240
233
  - jruby/neo4j/driver/ext/ruby_converter.rb
241
234
  - jruby/neo4j/driver/ext/run_override.rb
242
235
  - jruby/neo4j/driver/ext/start_end_naming.rb
243
- - jruby/neo4j/driver/ext/statement.rb
244
236
  - lib/loader.rb
245
237
  - lib/neo4j/driver/auto_closable.rb
246
238
  - lib/neo4j/driver/exceptions/authentication_exception.rb
@@ -250,6 +242,7 @@ files:
250
242
  - lib/neo4j/driver/exceptions/neo4j_exception.rb
251
243
  - lib/neo4j/driver/exceptions/no_such_record_exception.rb
252
244
  - lib/neo4j/driver/exceptions/protocol_exception.rb
245
+ - lib/neo4j/driver/exceptions/result_consumed_exception.rb
253
246
  - lib/neo4j/driver/exceptions/security_exception.rb
254
247
  - lib/neo4j/driver/exceptions/service_unavailable_exception.rb
255
248
  - lib/neo4j/driver/exceptions/session_expired_exception.rb
@@ -282,16 +275,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
282
275
  requirements:
283
276
  - - ">="
284
277
  - !ruby/object:Gem::Version
285
- version: '0'
278
+ version: '2.5'
286
279
  required_rubygems_version: !ruby/object:Gem::Requirement
287
280
  requirements:
288
- - - ">="
281
+ - - ">"
289
282
  - !ruby/object:Gem::Version
290
- version: '0'
283
+ version: 1.3.1
291
284
  requirements:
292
- - jar org.neo4j.driver, neo4j-java-driver, 1.7.5
293
- rubyforge_project:
294
- rubygems_version: 2.7.9
285
+ - jar org.neo4j.driver, neo4j-java-driver, 4.1.1
286
+ rubygems_version: 3.0.6
295
287
  signing_key:
296
288
  specification_version: 4
297
289
  summary: ''