Beispiel #1
0
 def __init__(self,db_dir):
     self.db_dir = db_dir
     self._startup()
     self.router = Router(self)
     self.router.add("vertices", VertexProxy(self.graph))
     self.router.add("edges", EdgeProxy(self.graph))
     self.router.add("indices", IndexProxy(self.graph))
     #self.router.add("gremlin", Gremlin(self.graph))
     self.method_map = dict(startup=self.startup,
                            shutdown=self.shutdown) 
Beispiel #2
0
class Blueprints(Resource):
    """Abstract method"""

    def __init__(self,db_dir):
        self.db_dir = db_dir
        self._startup()
        self.router = Router(self)
        self.router.add("vertices", VertexProxy(self.graph))
        self.router.add("edges", EdgeProxy(self.graph))
        self.router.add("indices", IndexProxy(self.graph))
        #self.router.add("gremlin", Gremlin(self.graph))
        self.method_map = dict(startup=self.startup,
                               shutdown=self.shutdown) 
        
    def _startup(self):
        self.graph = self.graph_class(self.db_dir)

    def startup(self,request):
        self._startup()
        return Response(200)

    def shutdown(self,request):
        print "Shutting down graph..."
        self.graph.shutdown()
        return Response(200)
    #
    # Resource-specific methods
    #

    def clear(self):
        raise NotImplementedError