Skip to content

Commit

Permalink
change wrapping functionality to match new gremlin-node
Browse files Browse the repository at this point in the history
  • Loading branch information
inolen committed Dec 5, 2013
1 parent 3a1a758 commit dcf24c5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
6 changes: 3 additions & 3 deletions lib/titan-edge-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var util = require('util');
var TitanElementWrapper = require('./titan-element-wrapper');
var Gremlin = require('gremlin');

var TitanEdgeWrapper = module.exports = function (gremlin, el) {
TitanElementWrapper.call(this, gremlin, el);
Gremlin.EdgeWrapper.call(this, gremlin, el);
};

util.inherits(TitanEdgeWrapper, TitanElementWrapper);
util.inherits(TitanEdgeWrapper, Gremlin.EdgeWrapper);
10 changes: 0 additions & 10 deletions lib/titan-element-wrapper.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/titan-graph-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ TitanGraphWrapper.prototype.getVertex = function (key, attr, callback) {

txn.getVertex(key, attr, function (err, v) {
if (err) return callback(err);
callback(null, v ? new gremlin.VertexWrapper(gremlin, v) : null);
callback(null, v ? gremlin.wrapVertex(v) : null);
});
};
17 changes: 12 additions & 5 deletions lib/titan-gremlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,22 @@ var TitanGremlin = module.exports = function (opts) {

this.ClassTypes.Geoshape = this.java.getClassLoader().loadClassSync('com.thinkaurelius.titan.core.attribute.Geoshape');

// use our custom wrappers
this.GraphWrapper = TitanGraphWrapper;
this.VertexWrapper = TitanVertexWrapper;
this.EdgeWrapper = TitanEdgeWrapper;

// set loglevel
this.java.import('org.slf4j.LoggerFactory')
.getLoggerSync(this.java.import('org.slf4j.Logger').ROOT_LOGGER_NAME)
.setLevelSync(this.java.import('ch.qos.logback.classic.Level')[opts.loglevel]);
};

util.inherits(TitanGremlin, Gremlin);

TitanGremlin.prototype.wrap = function (val) {
return new TitanGraphWrapper(this, val);
};

TitanGremlin.prototype.wrapVertex = function (val) {
return new TitanVertexWrapper(this, val);
};

TitanGremlin.prototype.wrapEdge = function (val) {
return new TitanEdgeWrapper(this, val);
};
6 changes: 3 additions & 3 deletions lib/titan-vertex-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var util = require('util');
var TitanElementWrapper = require('./titan-element-wrapper');
var Gremlin = require('gremlin');

var TitanVertexWrapper = module.exports = function (gremlin, el) {
TitanElementWrapper.call(this, gremlin, el);
Gremlin.VertexWrapper.call(this, gremlin, el);
};

util.inherits(TitanVertexWrapper, TitanElementWrapper);
util.inherits(TitanVertexWrapper, Gremlin.VertexWrapper);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"install": "make package"
},
"dependencies": {
"gremlin": "~0.3.0"
"gremlin": "~0.3.11"
},
"devDependencies": {
"mocha": "~1.14.0",
Expand Down

0 comments on commit dcf24c5

Please sign in to comment.