def decodeOobMessage(self, domainClass, payload):
     """Decode an out-of-band message."""
     proxyType = self._service.resolveClientType(domainClass, BaseProxy, True)
     state = RequestState(self._service)
     message = AutoBeanCodex.decode(FACTORY, RequestMessage, payload).as_()
     self.processOperationMessages(state, message)
     decoded = self.decodeInvocationArguments(state,
             message.getInvocations()[0].getParameters(),
             [proxyType], [domainClass])
     return decoded
예제 #2
0
 def getBeanForPayload(self, id_, domainObject=None):
     """Get or create a BaseProxy AutoBean for the given id."""
     if domainObject is None:
         idMessage = AutoBeanCodex.decode(MessageFactoryHolder.FACTORY, IdMessage, id_).as_()
         toReturn = self.getBeansForPayload([idMessage]).get(0)
         return toReturn
     else:
         toReturn = self.beans.get(id_)
         if toReturn is None:
             toReturn = self.createProxyBean(id_, domainObject)
         return toReturn
예제 #3
0
 def getBeanForPayload(self, id_, domainObject=None):
     """Get or create a BaseProxy AutoBean for the given id."""
     if domainObject is None:
         idMessage = AutoBeanCodex.decode(MessageFactoryHolder.FACTORY,
                                          IdMessage, id_).as_()
         toReturn = self.getBeansForPayload([idMessage]).get(0)
         return toReturn
     else:
         toReturn = self.beans.get(id_)
         if toReturn is None:
             toReturn = self.createProxyBean(id_, domainObject)
         return toReturn
    def processPayload(self, payload):
        """Process a payload sent by a RequestFactory client.

        @param payload the payload sent by the client
        @return a payload to return to the client
        """
        req = AutoBeanCodex.decode(FACTORY, RequestMessage, payload).as_()
        responseBean = FACTORY.response()
        # Create a new response envelope, since the state is unknown
        # Return a JSON-formatted payload
        try:
            self.process(req, responseBean.as_())
        except ReportableException, e:
            responseBean = FACTORY.response()
            responseBean.as_().setGeneralFailure(self.createFailureMessage(e).as_())