neo4j-java-driver 0.4.0-java → 4.1.0.beta.2-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: 0d15a30347713fb80742a8abc60472a20dd240dc327dc7b5ec48e69e128810e7
4
- data.tar.gz: a276cf844d3a0a1b5c3b977744aedd8e74634d7a0e9c1829addb334d7e19d825
3
+ metadata.gz: 828896723fbab7c465973c3809166bba8d472faa408dcbcd6b7b5eecf8b57b1c
4
+ data.tar.gz: ded0e916567c3374388ed3b1021b0e8ee81a30efcc2e8e98e89b3ae0c79c85fe
5
5
  SHA512:
6
- metadata.gz: 7afbfb75c3268db498e5a5ec0a8b64b664e4fc0121f395e97448338e4fbce30fd80dc5341b951465063056f0ad2f7119faba49410cce2440a4733ffaa4cbda9a
7
- data.tar.gz: 960124acd456ee2a9fb4f3edd2d0c9bc816b3929792a926a5397d13bbcf814932a6d813b5e2fd81be4694fcb25ddf055293dcfa085e6ef2fe490e6287695e033
6
+ metadata.gz: 7ce6018b659820388be9dd2c80bccb6e8cfc5de323f11f005e99ff2827db9bef998508b81dc7a1858e181e792b55d5c4d40cfa06c5c7921a5c6e8efadd463e3f
7
+ data.tar.gz: c7473b8f3519972cf851572a31a42188c393130bcea86bccb3c915e98bcab885437792b899db2e1f0ffe4210d62b544adabb377c0f1dc51ac95c665e64d61374
@@ -7,18 +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
11
 
12
12
  Record = Java::OrgNeo4jDriverInternal::InternalRecord
13
- StatementResult = Java::OrgNeo4jDriverInternal::InternalStatementResult
14
- Transaction = Java::OrgNeo4jDriverInternal::ExplicitTransaction
13
+ Result = Java::OrgNeo4jDriverInternal::InternalResult
14
+ Transaction = Java::OrgNeo4jDriverInternal::InternalTransaction
15
15
 
16
16
  module Net
17
- include_package 'org.neo4j.driver.v1.net'
17
+ include_package 'org.neo4j.driver.net'
18
18
  end
19
19
 
20
20
  module Summary
21
- include_package 'org.neo4j.driver.v1.summary'
21
+ include_package 'org.neo4j.driver.summary'
22
22
  end
23
23
 
24
24
  module Types
@@ -28,7 +28,7 @@ module Neo4j
28
28
  Relationship = Java::OrgNeo4jDriverInternal::InternalRelationship
29
29
  end
30
30
 
31
- # Workaround for missing zeitwerk support in jruby-9.2.8.0
31
+ # Workaround for missing zeitwerk support as of jruby-9.2.13.0
32
32
  module Ext
33
33
  module Internal
34
34
  module Summary
@@ -41,19 +41,21 @@ end
41
41
 
42
42
  Loader.load
43
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
44
49
  Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
45
- Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::MapAccessor
50
+ Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
46
51
  Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
47
52
  Java::OrgNeo4jDriverInternal::InternalPath.include Neo4j::Driver::Ext::StartEndNaming
48
53
  Java::OrgNeo4jDriverInternal::InternalPath::SelfContainedSegment.include Neo4j::Driver::Ext::StartEndNaming
49
54
  Java::OrgNeo4jDriverInternal::InternalRecord.prepend Neo4j::Driver::Ext::InternalRecord
50
55
  Java::OrgNeo4jDriverInternal::InternalRelationship.prepend Neo4j::Driver::Ext::InternalRelationship
51
- Java::OrgNeo4jDriverInternal::InternalStatementResult.prepend Neo4j::Driver::Ext::InternalStatementResult
52
- Java::OrgNeo4jDriverInternal::ExplicitTransaction.prepend Neo4j::Driver::Ext::ExplicitTransaction
53
- Java::OrgNeo4jDriverInternal::NetworkSession.prepend Neo4j::Driver::Ext::NetworkSession
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
54
59
  Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
55
60
  Java::OrgNeo4jDriverInternalValue::ValueAdapter.include Neo4j::Driver::Ext::RubyConverter
56
- Java::OrgNeo4jDriverV1::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
57
- Java::OrgNeo4jDriverV1::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
58
- Java::OrgNeo4jDriverV1::Statement.prepend Neo4j::Driver::Ext::Statement
59
- 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
@@ -8,8 +8,8 @@ module Neo4j
8
8
 
9
9
  private
10
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
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
13
  end
14
14
 
15
15
  def config_method(key, value)
@@ -32,6 +32,8 @@ module Neo4j
32
32
  when 'resolver'
33
33
  proc = value
34
34
  value = ->(address) { java.util.HashSet.new(proc.call(address)) }
35
+ when 'bookmarks'
36
+ return [method, *value]
35
37
  else
36
38
  value = to_neo(value, skip_unknown: true)
37
39
  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
@@ -20,8 +20,19 @@ module Neo4j
20
20
 
21
21
  def reverse_check
22
22
  yield
23
- rescue StandardError => e
24
- raise(e.cause || ExceptionMapper.reverse_exception_class(e)&.new('') || e)
23
+ rescue Neo4j::Driver::Exceptions::ServiceUnavailableException => e
24
+ raise(throwable(e.cause) || Java::OrgNeo4jDriverExceptions::ServiceUnavailableException.new(e.message))
25
+ rescue Neo4j::Driver::Exceptions::Neo4jException,
26
+ Neo4j::Driver::Exceptions::NoSuchRecordException,
27
+ Neo4j::Driver::Exceptions::UntrustedServerException,
28
+ Neo4j::Driver::Exceptions::IllegalStateException => e
29
+ raise(throwable(e.cause) || e)
30
+ end
31
+
32
+ private
33
+
34
+ def throwable(e)
35
+ e if e.is_a? Java::JavaLang::Throwable
25
36
  end
26
37
  end
27
38
  end
@@ -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
@@ -23,14 +24,7 @@ module Neo4j
23
24
  end
24
25
 
25
26
  def arguments
26
- [code, message, self, suppressed.map(&method(:mapped_exception))]
27
- end
28
-
29
- def self.reverse_exception_class(exception)
30
- case exception
31
- when Neo4j::Driver::Exceptions::ServiceUnavailableException
32
- ServiceUnavailableException
33
- end
27
+ [code, message, suppressed.map(&method(:mapped_exception))]
34
28
  end
35
29
 
36
30
  private
@@ -39,6 +33,8 @@ module Neo4j
39
33
  case exception
40
34
  when AuthenticationException
41
35
  Neo4j::Driver::Exceptions::AuthenticationException
36
+ when ResultConsumedException
37
+ Neo4j::Driver::Exceptions::ResultConsumedException
42
38
  when ClientException
43
39
  Neo4j::Driver::Exceptions::ClientException
44
40
  when DatabaseException
@@ -10,14 +10,14 @@ module Neo4j
10
10
 
11
11
  auto_closable :driver, :routing_driver
12
12
 
13
- def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, config = nil)
13
+ def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, **config)
14
14
  check do
15
- java_method(:driver, [java.lang.String, org.neo4j.driver.v1.AuthToken, org.neo4j.driver.v1.Config])
15
+ java_method(:driver, [java.lang.String, org.neo4j.driver.AuthToken, org.neo4j.driver.Config])
16
16
  .call(uri.to_s, auth_token, to_java_config(Neo4j::Driver::Config, config))
17
17
  end
18
18
  end
19
19
 
20
- def routing_driver(routing_uris, auth_token, config)
20
+ def routing_driver(routing_uris, auth_token, **config)
21
21
  check do
22
22
  super(routing_uris.map { |uri| java.net.URI.create(uri.to_s) }, auth_token,
23
23
  to_java_config(Neo4j::Driver::Config, config))
@@ -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,7 +3,7 @@
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
9
  alias properties to_h
@@ -11,6 +11,10 @@ module Neo4j
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
@@ -3,12 +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
9
  include InternalKeys
10
10
 
11
- %i[has_next? next single consume summary peek].each do |method|
11
+ %i[has_next? next single consume peek].each do |method|
12
12
  define_method(method) do |*args, &block|
13
13
  check { super(*args, &block) }
14
14
  end
@@ -3,7 +3,7 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
- module NetworkSession
6
+ module InternalSession
7
7
  extend AutoClosable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
@@ -26,7 +26,7 @@ module Neo4j
26
26
 
27
27
  def run(statement, parameters = {}, config = {})
28
28
  check do
29
- java_method(:run, [org.neo4j.driver.v1.Statement, org.neo4j.driver.v1.TransactionConfig])
29
+ java_method(:run, [org.neo4j.driver.Query, org.neo4j.driver.TransactionConfig])
30
30
  .call(to_statement(statement, parameters), to_java_config(Neo4j::Driver::TransactionConfig, config))
31
31
  end
32
32
  end
@@ -3,13 +3,21 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
- module ExplicitTransaction
6
+ module InternalTransaction
7
7
  include ExceptionCheckable
8
8
  include RunOverride
9
9
 
10
10
  def run(statement, parameters = {})
11
11
  check { super(to_statement(statement, parameters)) }
12
12
  end
13
+
14
+ def commit
15
+ check { super }
16
+ end
17
+
18
+ # def rollback
19
+ # check { super }
20
+ # end
13
21
  end
14
22
  end
15
23
  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
 
@@ -5,7 +5,7 @@ module Neo4j
5
5
  module Ext
6
6
  module MapConverter
7
7
  def to_h
8
- java_method(:asMap, [org.neo4j.driver.v1.util.Function]).call(&:itself).to_hash
8
+ java_method(:asMap, [java.util.function.Function]).call(&:itself).to_hash
9
9
  .transform_values!(&:as_ruby_object).symbolize_keys!
10
10
  end
11
11
  end
@@ -23,7 +23,7 @@ module Neo4j
23
23
  *Driver::Internal::DurationNormalizer.normalize(object)
24
24
  )
25
25
  when Types::Point
26
- Java::OrgNeo4jDriverV1::Values.point(object.srid, *object.coordinates)
26
+ Java::OrgNeo4jDriver::Values.point(object.srid, *object.coordinates)
27
27
  when Types::OffsetTime
28
28
  Java::JavaTime::OffsetTime.of(object.hour, object.min, object.sec,
29
29
  object.nsec, Java::JavaTime::ZoneOffset.of_total_seconds(object.utc_offset))
@@ -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
@@ -14,7 +14,7 @@ module Neo4j
14
14
 
15
15
  def to_statement(text, parameters)
16
16
  Neo4j::Driver::Internal::Validator.require_hash_parameters!(parameters)
17
- Neo4j::Driver::Statement.new(text, to_neo(parameters || {}))
17
+ Neo4j::Driver::Query.new(text, to_neo(parameters || {}))
18
18
  end
19
19
  end
20
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)
@@ -4,12 +4,11 @@ module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
6
  class Neo4jException < RuntimeError
7
- attr_reader :code, :cause, :suppressed
7
+ attr_reader :code, :suppressed
8
8
 
9
9
  def initialize(*args)
10
10
  @code = args.shift if args.count > 1
11
11
  message = args.shift
12
- @cause = args.shift
13
12
  @suppressed = args.shift
14
13
  super(message)
15
14
  end
@@ -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.4.0'
5
+ VERSION = '4.1.0.beta.2'
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.4.0
4
+ version: 4.1.0.beta.2
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-04-09 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -211,27 +211,28 @@ files:
211
211
  - README.md
212
212
  - jruby/neo4j/driver.rb
213
213
  - jruby/neo4j/driver/ext/auth_tokens.rb
214
+ - jruby/neo4j/driver/ext/bookmark.rb
214
215
  - jruby/neo4j/driver/ext/config_converter.rb
215
216
  - jruby/neo4j/driver/ext/exception_checkable.rb
216
217
  - jruby/neo4j/driver/ext/exception_mapper.rb
217
- - jruby/neo4j/driver/ext/explicit_transaction.rb
218
218
  - jruby/neo4j/driver/ext/graph_database.rb
219
219
  - jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb
220
220
  - jruby/neo4j/driver/ext/internal_driver.rb
221
+ - jruby/neo4j/driver/ext/internal_entity.rb
221
222
  - jruby/neo4j/driver/ext/internal_keys.rb
222
223
  - jruby/neo4j/driver/ext/internal_node.rb
223
224
  - jruby/neo4j/driver/ext/internal_record.rb
224
225
  - jruby/neo4j/driver/ext/internal_relationship.rb
225
- - 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
226
229
  - jruby/neo4j/driver/ext/logger.rb
227
- - jruby/neo4j/driver/ext/map_accessor.rb
228
230
  - jruby/neo4j/driver/ext/map_converter.rb
229
231
  - jruby/neo4j/driver/ext/neo_converter.rb
230
- - jruby/neo4j/driver/ext/network_session.rb
232
+ - jruby/neo4j/driver/ext/query.rb
231
233
  - jruby/neo4j/driver/ext/ruby_converter.rb
232
234
  - jruby/neo4j/driver/ext/run_override.rb
233
235
  - jruby/neo4j/driver/ext/start_end_naming.rb
234
- - jruby/neo4j/driver/ext/statement.rb
235
236
  - lib/loader.rb
236
237
  - lib/neo4j/driver/auto_closable.rb
237
238
  - lib/neo4j/driver/exceptions/authentication_exception.rb
@@ -241,6 +242,7 @@ files:
241
242
  - lib/neo4j/driver/exceptions/neo4j_exception.rb
242
243
  - lib/neo4j/driver/exceptions/no_such_record_exception.rb
243
244
  - lib/neo4j/driver/exceptions/protocol_exception.rb
245
+ - lib/neo4j/driver/exceptions/result_consumed_exception.rb
244
246
  - lib/neo4j/driver/exceptions/security_exception.rb
245
247
  - lib/neo4j/driver/exceptions/service_unavailable_exception.rb
246
248
  - lib/neo4j/driver/exceptions/session_expired_exception.rb
@@ -276,11 +278,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
276
278
  version: '2.5'
277
279
  required_rubygems_version: !ruby/object:Gem::Requirement
278
280
  requirements:
279
- - - ">="
281
+ - - ">"
280
282
  - !ruby/object:Gem::Version
281
- version: '0'
283
+ version: 1.3.1
282
284
  requirements:
283
- - jar org.neo4j.driver, neo4j-java-driver, 1.7.5
285
+ - jar org.neo4j.driver, neo4j-java-driver, 4.1.1
284
286
  rubygems_version: 3.0.6
285
287
  signing_key:
286
288
  specification_version: 4