Created
May 1, 2013 20:07
-
-
Save okram/5497959 to your computer and use it in GitHub Desktop.
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
@ExtensionNaming(namespace = "egosystem", name = "faunus") | |
class FaunusExtension extends AbstractRexsterExtension { | |
private static FaunusGremlinScriptEngine engine = new FaunusGremlinScriptEngine(); | |
static { | |
Configuration configuration = new Configuration(); | |
Properties properties = new Properties(); | |
properties.load(FaunusExtension.class.getResourceAsStream("titan-cassandra-input.properties")); | |
for (Map.Entry<Object, Object> entry : properties.entrySet()) { | |
configuration.set(entry.getKey().toString(), entry.getValue().toString()); | |
} | |
FaunusGraph graph = new FaunusGraph(configuration); | |
engine.put("g", graph); | |
} | |
@ExtensionDefinition(extensionPoint = ExtensionPoint.GRAPH, method = HttpMethod.GET) | |
@ExtensionDescriptor(description = "Execute a discovery algorithm") | |
public ExtensionResponse evaluate(@RexsterContext RexsterResourceContext context, | |
@RexsterContext Graph g) { | |
((FaunusPipeline) engine.eval((String) context.getRequestObject().get('script'))).submit(); | |
return ExtensionResponse.ok(new JSONObject("{ 'status' : 'done' }")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment