Exemplo n.º 1
0
def registerExtension():
    from codeintel2.oop.driver import CommandHandler, Driver

    class DummyHandler(CommandHandler):
        supportedCommands = ["extension-command"]

        def __init__(self):
            self._askedRequest = None

        def canHandleRequest(self, request):
            if self._askedRequest is not None:
                raise AssertionError("Duplicate canHandleRequest call")
            if request.command == "extension-command":
                self._askedRequest = request
                return True
            raise AssertionError("Invalid command %s" % request.command)

        def handleRequest(self, request, driver):
            if self._askedRequest is not request:
                raise AssertionError("Unexpected request %r (expected %r)" %
                                     (request, self._askedRequest))
            self._askedRequest = {}  # unique thing to fail future comparisons
            log.debug("Extension handling request!!!")
            driver.send(request=request, **{"extension-result": True})

    Driver.registerCommandHandler(DummyHandler())
Exemplo n.º 2
0
def registerExtension():
    from codeintel2.oop.driver import CommandHandler, Driver

    class DummyHandler(CommandHandler):
        supportedCommands = ["extension-command"]

        def __init__(self):
            self._askedRequest = None

        def canHandleRequest(self, request):
            if self._askedRequest is not None:
                raise AssertionError("Duplicate canHandleRequest call")
            if request.command == "extension-command":
                self._askedRequest = request
                return True
            raise AssertionError("Invalid command %s" % request.command)

        def handleRequest(self, request, driver):
            if self._askedRequest is not request:
                raise AssertionError("Unexpected request %r (expected %r)" %
                                     (request, self._askedRequest))
            self._askedRequest = {}  # unique thing to fail future comparisons
            log.debug("Extension handling request!!!")
            driver.send(request=request, **{"extension-result": True})
    Driver.registerCommandHandler(DummyHandler())
Exemplo n.º 3
0
    def __init__(self):
        CommandHandler.__init__(self)
        threading.Thread.__init__(self, name="XPCOM Support Sending Thread")
        self._queue = Queue.Queue()
        self._read_buffer = ""
        self.daemon = True
        self.start()

        catalogs_zone = Driver.getInstance().mgr.db.get_catalogs_zone()
        self._real_get_blob = catalogs_zone.get_blob
        catalogs_zone.get_blob = self.get_blob
Exemplo n.º 4
0
def registerExtension():
    """JavaScript XPCOM component hooks"""
    log.debug("Registering XPCOM component library information")

    supporter = XPCOMSupport()
    Driver.registerCommandHandler(supporter)