Ejemplo n.º 1
0
 def deserialize(self, sock: BinarySocketReader):
     """
     Deserialize message (called after magic & type read)
     """
     super().deserialize(sock)
     self.classname = sock.readString()
     argc = sock.readInt16()
     self.argv = [CLRMessage.read(sock).value for i in range(0, argc)]
Ejemplo n.º 2
0
 def deserialize(self, sock: BinarySocketReader):
     """
     Deserialize message (called after magic & type read)
     """
     super().deserialize(sock)
     self.objectId = sock.readInt32()
     self.property = sock.readString()
     self.setval = CLRMessage.read(sock)
Ejemplo n.º 3
0
    def deserialize (self, sock: BinarySocketReader):
        """
        Deserialize message (called after magic & type read)
        """
        super().deserialize(sock)

        vlen = sock.readInt32()
        msgs = [CLRMessage.read(sock) for i in range(0,vlen)]
        self.value = [msg.toValue() for msg in msgs]
Ejemplo n.º 4
0
    def getIndexed(self, objectId: int, idx: int):
        """
        get indexed on CLR-side object (this is only used internally)

        :param objectId: object ID of previously created object
        :param idx: index to retrieve
        """
        ## create object request
        req = CLRGetIndexed(objectId, idx)
        CLRMessage.write(self.cout, req)

        ## process result
        rep = CLRMessage.read(self.cin)
        return rep.toValue()
Ejemplo n.º 5
0
    def getProperty(self, objectId: int, property: str):
        """
        get property on CLR-side object (this is only used internally)

        :param objectId: object ID of previously created object
        :param property: name of property to get
        """
        ## create object request
        req = CLRGetProperty(objectId, property)
        CLRMessage.write(self.cout, req)

        ## process result
        rep = CLRMessage.read(self.cin)
        return rep.toValue()
Ejemplo n.º 6
0
    def new(self, classname: str, *args):
        """
        create a new CLR object

        :param classname: fully qualified or partially qualified class name (i.e. 'com.stg.models.MyClass' or 'MyClass')
        :param *args: optional arguments to the constructor
        """
        ## create object request
        req = CLRCreateObject(classname, args)
        CLRMessage.write(self.cout, req)

        ## process result
        rep = CLRMessage.read(self.cin)
        return rep.toValue()
Ejemplo n.º 7
0
    def call(self, objectId: int, methodname: str, *args):
        """
        call method on CLR-side object (this is only used internally)

        :param objectId: object ID of previously created object
        :param methodname: name of method / function to call
        :param *args: arguments to method / function        
        """
        ## create object request
        req = CLRCallMethod(objectId, methodname, args)
        CLRMessage.write(self.cout, req)

        ## process result
        rep = CLRMessage.read(self.cin)
        return rep.toValue()
Ejemplo n.º 8
0
    def callstatic(self, classname: str, methodname: str, *args):
        """
        call class method on CLR-side object

        :param classname: fully qualified or partially qualified class name (i.e. 'com.stg.models.MyClass' or 'MyClass')
        :param methodname: name of method / function to call
        :param *args: arguments to method / function
        """
        ## create object request
        req = CLRCallStaticMethod(classname, methodname, args)
        CLRMessage.write(self.cout, req)

        ## process result
        rep = CLRMessage.read(self.cin)
        return rep.toValue()
Ejemplo n.º 9
0
    def classFor(self, classname: str):
        """
        get class template for named type (this is only used internally)
        """
        klass = CLRApi.Classes.get(classname, None)
        if klass is not None:
            return klass
        else:
            ## create request
            req = CLRTemplateReq(classname)
            CLRMessage.write(self.cout, req)

            ## process result
            rep = CLRMessage.read(self.cin)
            info = rep.toValue()
            klass = CLRObject.proxyClassFor(classname, info)
            CLRApi.Classes[classname] = klass
            return klass