Last active
August 29, 2015 14:17
-
-
Save pinyin/c90e17a11a11b34725ac to your computer and use it in GitHub Desktop.
Add OrientDB Java Hook in JRuby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[20] pry(main)> d = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.new 'plocal:db/pacer' | |
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x6dccc34c> | |
[21] pry(main)> d.registerHook H.new | |
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x6dccc34c> | |
[22] pry(main)> dd = d.open 'admin', 'admin' | |
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x6dccc34c> | |
[23] pry(main)> g = com.tinkerpop.blueprints.impls.orient.OrientGraph.new dd | |
=> #<Java::ComTinkerpopBlueprintsImplsOrient::OrientGraph:0x1d6ed6d9> | |
[24] pry(main)> gg = Pacer.orient g | |
=> #<PacerGraph orientgraph[plocal:db/pacer] | |
[25] pry(main)> gg.tx { gg.create_vertex } | |
V#9:-2 v0 | |
=> #<V[9:1]> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class H < com.orientechnologies.orient.core.hook.ORecordHookAbstract | |
def onRecordAfterCreate(r) | |
puts r | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment