예제 #1
0
    def delete(self, robj):
        """
        Removes an object stored in the remote ObjectStore, and return a boolean
        status.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.delete(robj._ref))

        return response != None and response.reflection_response.status == Message.ReflectionResponse.SUCCESS
예제 #2
0
    def delete(self, robj):
        """
        Removes an object stored in the remote ObjectStore, and return a boolean
        status.
        """

        response = self.sendAndReceive(
            ReflectionRequestFactory.delete(robj._ref))

        return response != None and response.reflection_response.status == Message.ReflectionResponse.SUCCESS
예제 #3
0
    def invoke(self, robj, method, *args):
        """
        Invokes a method on an object, and returns the return value.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.invoke(robj._ref, method).setArguments(args))

        if response is None:
            raise ReflectionException("expected a response to INVOKE")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(response.reflection_response.errormessage)
예제 #4
0
    def getProperty(self, robj, property_name):
        """
        Reads a property from an object, and returns the value.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.getProperty(robj._ref, property_name))

        if response is None:
            raise ReflectionException("expected a response to GET_PROPERTY")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(response.reflection_response.errormessage)
예제 #5
0
    def deleteAll(self):
        """
        Removes all objects stored in the remote ObjectStore.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.deleteAll())

        if response is None:
            raise ReflectionException("expected a response to DELETE_ALL")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return True
        else:
            raise ReflectionException(response.reflection_response.errormessage)
예제 #6
0
    def setProperty(self, robj, property_name, value):
        """
        Sets a property on an object to a given value.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.setProperty(robj._ref, property_name, value))

        if response is None:
            raise ReflectionException("expected a response to SET_PROPERTY")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return response
        else:
            raise ReflectionException(response.reflection_response.errormessage)
예제 #7
0
    def resolve(self, class_name):
        """
        Resolves a Java class, given its fully qualified name, and returns a
        ReflectedObject that can be used to instantiate it with #construct.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.resolve(class_name))

        if response is None:
            raise ReflectionException("expected a response to RESOLVE")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(response.reflection_response.errormessage)
예제 #8
0
    def construct(self, robj, *args):
        """
        Constructs a new instance of a class, with optional arguments, and
        returns the object instance.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.construct(robj._ref).setArguments(args))

        if response is None:
            raise ReflectionException("expected a response to CONSTRUCT")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(response.reflection_response.errormessage)
예제 #9
0
    def deleteAll(self):
        """
        Removes all objects stored in the remote ObjectStore.
        """

        response = self.sendAndReceive(ReflectionRequestFactory.deleteAll())

        if response is None:
            raise ReflectionException("expected a response to DELETE_ALL")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return True
        else:
            raise ReflectionException(
                response.reflection_response.errormessage)
예제 #10
0
    def getProperty(self, robj, property_name):
        """
        Reads a property from an object, and returns the value.
        """

        response = self.sendAndReceive(
            ReflectionRequestFactory.getProperty(robj._ref, property_name))

        if response is None:
            raise ReflectionException("expected a response to GET_PROPERTY")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(
                response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(
                response.reflection_response.errormessage)
예제 #11
0
    def setProperty(self, robj, property_name, value):
        """
        Sets a property on an object to a given value.
        """

        response = self.sendAndReceive(
            ReflectionRequestFactory.setProperty(robj._ref, property_name,
                                                 value))

        if response is None:
            raise ReflectionException("expected a response to SET_PROPERTY")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return response
        else:
            raise ReflectionException(
                response.reflection_response.errormessage)
예제 #12
0
    def resolve(self, class_name):
        """
        Resolves a Java class, given its fully qualified name, and returns a
        ReflectedObject that can be used to instantiate it with #construct.
        """

        response = self.sendAndReceive(
            ReflectionRequestFactory.resolve(class_name))

        if response is None:
            raise ReflectionException("expected a response to RESOLVE")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(
                response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(
                response.reflection_response.errormessage)
예제 #13
0
    def invoke(self, robj, method, *args):
        """
        Invokes a method on an object, and returns the return value.
        """

        response = self.sendAndReceive(
            ReflectionRequestFactory.invoke(robj._ref,
                                            method).setArguments(args))

        if response is None:
            raise ReflectionException("expected a response to INVOKE")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(
                response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(
                response.reflection_response.errormessage)
예제 #14
0
    def construct(self, robj, *args):
        """
        Constructs a new instance of a class, with optional arguments, and
        returns the object instance.
        """

        response = self.sendAndReceive(
            ReflectionRequestFactory.construct(robj._ref).setArguments(args))

        if response is None:
            raise ReflectionException("expected a response to CONSTRUCT")
        elif response.reflection_response.status == Message.ReflectionResponse.SUCCESS:
            return ReflectedType.fromArgument(
                response.reflection_response.result, reflector=self)
        else:
            raise ReflectionException(
                response.reflection_response.errormessage)