pacer-orient 2.2.1.pre-java → 2.2.2.pre-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pacer-orient/db_listener.rb +60 -0
- data/lib/pacer-orient/graph.rb +3 -3
- data/lib/pacer-orient/tx_data_wrapper.rb +101 -0
- data/lib/pacer-orient/version.rb +2 -2
- data/lib/{pacer-orient-2.2.1.pre-standalone.jar → pacer-orient-2.2.2.pre-standalone.jar} +0 -0
- data/lib/pacer-orient.rb +1 -0
- data/pom.xml +2 -7
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7585dfffb391debc95334403f88386f77a80d3ca
|
4
|
+
data.tar.gz: 97c0a11ee8b963a857d2886f3cc2c95e56856097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cd87e583db12206f061197bc71f3c867b835c4b3fc59ad0bf8fcc2c29f60f03577911e780c79471c05454c512bfe701f7ce5cba96f932deacb8f1a5ce60b02a
|
7
|
+
data.tar.gz: 0ab844a4af7c5894b90e41458d571a9ed2a86742c49bb3f316b8baf0b75c71ab0b6e3d6934f4b7da719a5c8e41607854a2861d8b5ae84fb70a115767ee4d436c
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Orient
|
3
|
+
import com.orientechnologies.orient.core.db.ODatabaseListener
|
4
|
+
|
5
|
+
class DbListener
|
6
|
+
include ODatabaseListener
|
7
|
+
|
8
|
+
attr_reader :graph
|
9
|
+
|
10
|
+
def initialize(graph)
|
11
|
+
# TDOO: use graph factory?
|
12
|
+
@graph = graph
|
13
|
+
end
|
14
|
+
|
15
|
+
def onCreate(db)
|
16
|
+
end
|
17
|
+
|
18
|
+
def onDelete(db)
|
19
|
+
end
|
20
|
+
|
21
|
+
def onOpen(db)
|
22
|
+
end
|
23
|
+
|
24
|
+
def onBeforeTxBegin(db)
|
25
|
+
end
|
26
|
+
|
27
|
+
def onBeforeTxRollback(db)
|
28
|
+
end
|
29
|
+
|
30
|
+
def onAfterTxRollback(db)
|
31
|
+
end
|
32
|
+
|
33
|
+
def onBeforeTxCommit(db)
|
34
|
+
data = TxDataWrapper.new db, graph
|
35
|
+
pp transaction: { getAllRecordEntries: data.entries,
|
36
|
+
length: data.entries.length,
|
37
|
+
contents: data.entries.to_a }
|
38
|
+
pp created_v: data.created_v
|
39
|
+
pp created_e: data.created_e
|
40
|
+
pp changed_v: data.changed_v
|
41
|
+
pp changed_e: data.changed_e
|
42
|
+
pp deleted_v: data.deleted_v
|
43
|
+
pp deleted_e: data.deleted_e
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def onAfterTxCommit(db)
|
48
|
+
end
|
49
|
+
|
50
|
+
def onClose(db)
|
51
|
+
end
|
52
|
+
|
53
|
+
def onCorruptionRepairDatabase(db, iReason, iWhatWillbeFixed)
|
54
|
+
return false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/lib/pacer-orient/graph.rb
CHANGED
@@ -122,7 +122,7 @@ module Pacer
|
|
122
122
|
alias lightweight_edges? lightweight_edges
|
123
123
|
|
124
124
|
def lightweight_edges=(b)
|
125
|
-
blueprints_graph.
|
125
|
+
blueprints_graph.setUseLightweightEdges b
|
126
126
|
end
|
127
127
|
|
128
128
|
def use_class_for_edge_label
|
@@ -130,7 +130,7 @@ module Pacer
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def use_class_for_edge_label=(b)
|
133
|
-
blueprints_graph.
|
133
|
+
blueprints_graph.setUseClassForEdgeLabel b
|
134
134
|
end
|
135
135
|
|
136
136
|
def use_class_for_vertex_label
|
@@ -138,7 +138,7 @@ module Pacer
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def use_class_for_vertex_label=(b)
|
141
|
-
blueprints_graph.
|
141
|
+
blueprints_graph.setUseClassForVertexLabel b
|
142
142
|
end
|
143
143
|
|
144
144
|
def sql(sql = nil, args = nil, opts = {})
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Orient
|
3
|
+
class TxDataWrapper
|
4
|
+
import com.orientechnologies.orient.core.db.record.ORecordOperation
|
5
|
+
|
6
|
+
attr_reader :db, :v_base, :e_base, :graph, :blueprints_graph
|
7
|
+
|
8
|
+
def initialize(db, graph)
|
9
|
+
@db = db
|
10
|
+
@graph = graph
|
11
|
+
@blueprints_graph = graph.blueprints_graph
|
12
|
+
@v_base = graph.orient_graph.getMetadata.getSchema.getClass("V")
|
13
|
+
@e_base = graph.orient_graph.getMetadata.getSchema.getClass("E")
|
14
|
+
end
|
15
|
+
|
16
|
+
def created_v
|
17
|
+
keep(ORecordOperation::CREATED, v_base) { |e| wrap_vertex e }
|
18
|
+
end
|
19
|
+
|
20
|
+
def deleted_v
|
21
|
+
keep(ORecordOperation::DELETED, v_base) { |e| wrap_vertex e }
|
22
|
+
end
|
23
|
+
|
24
|
+
def changed_v
|
25
|
+
keep(ORecordOperation::UPDATED, v_base) { |e| changes e, :vertex }.flatten
|
26
|
+
end
|
27
|
+
|
28
|
+
def created_e
|
29
|
+
keep(ORecordOperation::CREATED, e_base) { |e| wrap_edge e }
|
30
|
+
end
|
31
|
+
|
32
|
+
def deleted_e
|
33
|
+
keep(ORecordOperation::DELETED, e_base) { |e| wrap_edge e }
|
34
|
+
end
|
35
|
+
|
36
|
+
def changed_e
|
37
|
+
keep(ORecordOperation::UPDATED, e_base) { |e| changes e, :edge }.flatten
|
38
|
+
end
|
39
|
+
|
40
|
+
def created_v_ids
|
41
|
+
keep(ORecordOperation::CREATED, v_base) { |e| e.getIdentity }
|
42
|
+
end
|
43
|
+
|
44
|
+
def deleted_v_ids
|
45
|
+
keep(ORecordOperation::DELETED, v_base) { |e| e.getIdentity }
|
46
|
+
end
|
47
|
+
|
48
|
+
def created_e_ids
|
49
|
+
keep(ORecordOperation::CREATED, e_base) { |e| e.getIdentity }
|
50
|
+
end
|
51
|
+
|
52
|
+
def deleted_e_ids
|
53
|
+
keep(ORecordOperation::DELETED, e_base) { |e| e.getIdentity }
|
54
|
+
end
|
55
|
+
|
56
|
+
def deleted?(e)
|
57
|
+
entry = db.getTransaction.getRecordEntry e.element_id
|
58
|
+
entry and entry.type == ORecordOperation::DELETED
|
59
|
+
end
|
60
|
+
|
61
|
+
def entries
|
62
|
+
db.getTransaction.getCurrentRecordEntries
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# !!!!!!!!!!!!!!!!!!!!
|
68
|
+
# !!!!!!!!!!!!!!!!!!!!
|
69
|
+
# TODO: how do I deal with lightweight edges?
|
70
|
+
# !!!!!!!!!!!!!!!!!!!!
|
71
|
+
# !!!!!!!!!!!!!!!!!!!!
|
72
|
+
|
73
|
+
def keep(op, klass)
|
74
|
+
return unless entries
|
75
|
+
entries.map do |e|
|
76
|
+
if e.type == op and e.getRecord.getSchemaClass.isSubClassOf(klass)
|
77
|
+
yield e.getRecord
|
78
|
+
end
|
79
|
+
end.compact
|
80
|
+
end
|
81
|
+
|
82
|
+
def changes(doc, type)
|
83
|
+
doc.getDirtyFields.map do |field|
|
84
|
+
{ element_type: type,
|
85
|
+
id: doc.getIdentity,
|
86
|
+
key: field,
|
87
|
+
was: graph.decode_property(doc.getOriginalValue(field)),
|
88
|
+
is: graph.decode_property(doc.field(field)) }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def wrap_edge(e)
|
93
|
+
Pacer::Wrappers::EdgeWrapper.new graph, blueprints_graph.getEdge(e)
|
94
|
+
end
|
95
|
+
|
96
|
+
def wrap_vertex(e)
|
97
|
+
Pacer::Wrappers::VertexWrapper.new graph, blueprints_graph.getVertex(e)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
data/lib/pacer-orient/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Pacer
|
2
2
|
module Orient
|
3
|
-
VERSION = "2.2.
|
3
|
+
VERSION = "2.2.2.pre"
|
4
4
|
JAR = "pacer-orient-#{ VERSION }-standalone.jar"
|
5
5
|
JAR_PATH = "lib/#{ JAR }"
|
6
|
-
ORIENT_VERSION = "2.0-M2
|
6
|
+
ORIENT_VERSION = "2.0-M2"
|
7
7
|
PIPES_VERSION = "2.6.0"
|
8
8
|
PACER_REQ = ">= 1.5.4"
|
9
9
|
end
|
Binary file
|
data/lib/pacer-orient.rb
CHANGED
data/pom.xml
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
<artifactId>pacer-orient</artifactId>
|
8
8
|
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-orient/version.rb -->
|
9
9
|
<properties>
|
10
|
-
<orient.version>2.0-M2
|
11
|
-
<gem.version>2.2.
|
10
|
+
<orient.version>2.0-M2</orient.version>
|
11
|
+
<gem.version>2.2.2.pre</gem.version>
|
12
12
|
<pipes.version>2.6.0</pipes.version>
|
13
13
|
</properties>
|
14
14
|
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-orient/version.rb -->
|
@@ -27,11 +27,6 @@
|
|
27
27
|
</developer>
|
28
28
|
</developers>
|
29
29
|
<dependencies>
|
30
|
-
<dependency>
|
31
|
-
<groupId>com.orientechnologies</groupId>
|
32
|
-
<artifactId>orient-commons</artifactId>
|
33
|
-
<version>${orient.version}</version>
|
34
|
-
</dependency>
|
35
30
|
<dependency>
|
36
31
|
<groupId>com.orientechnologies</groupId>
|
37
32
|
<artifactId>orientdb-core</artifactId>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacer-orient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2.pre
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Darrick Wiebe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pacer
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- README.md
|
37
37
|
- Rakefile
|
38
38
|
- lib/pacer-orient.rb
|
39
|
+
- lib/pacer-orient/db_listener.rb
|
39
40
|
- lib/pacer-orient/encoder.rb
|
40
41
|
- lib/pacer-orient/factory_container.rb
|
41
42
|
- lib/pacer-orient/graph.rb
|
@@ -44,11 +45,12 @@ files:
|
|
44
45
|
- lib/pacer-orient/record_id.rb
|
45
46
|
- lib/pacer-orient/rspec.rb
|
46
47
|
- lib/pacer-orient/sql_filter.rb
|
48
|
+
- lib/pacer-orient/tx_data_wrapper.rb
|
47
49
|
- lib/pacer-orient/version.rb
|
48
50
|
- pacer-orient.gemspec
|
49
51
|
- pom.xml
|
50
52
|
- pom/standalone.xml
|
51
|
-
- lib/pacer-orient-2.2.
|
53
|
+
- lib/pacer-orient-2.2.2.pre-standalone.jar
|
52
54
|
homepage: http://orientechnologies.com
|
53
55
|
licenses: []
|
54
56
|
metadata: {}
|