Пример #1
0
 def createProxyBean(self, id_, domainObject):
     """Creates an AutoBean for the given id, tracking a domain object."""
     toReturn = AutoBeanFactorySource.createBean(id_.getProxyClass(),
             SimpleRequestProcessor.CONFIGURATION)
     toReturn.setTag(Constants.STABLE_ID, id_)
     toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject)
     self.beans[id_] = toReturn
     return toReturn
Пример #2
0
 def createProxyBean(self, id_, domainObject):
     """Creates an AutoBean for the given id, tracking a domain object."""
     toReturn = AutoBeanFactorySource.createBean(
         id_.getProxyClass(), SimpleRequestProcessor.CONFIGURATION)
     toReturn.setTag(Constants.STABLE_ID, id_)
     toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject)
     self.beans[id_] = toReturn
     return toReturn
from requestfactory.shared.base_proxy import BaseProxy
from requestfactory.shared.impl.entity_proxy_category import EntityProxyCategory

from autobean.shared.value_codex import ValueCodex
from autobean.vm.impl.type_utils import TypeUtils
from autobean.shared.auto_bean_visitor import AutoBeanVisitor, CollectionPropertyContext
from autobean.vm.auto_bean_factory_source import AutoBeanFactorySource
from autobean.shared.auto_bean_utils import AutoBeanUtils
from autobean.shared.auto_bean_codex import AutoBeanCodex
from autobean.vm.configuration import Configuration

from com.google.gwt.user.server.base64_utils import Base64Utils


# Vends message objects.
FACTORY = AutoBeanFactorySource.create(MessageFactory)


class SimpleRequestProcessor(object):
    """Processes request payloads from a RequestFactory client. This implementation
    is stateless. A single instance may be reused and is thread-safe.
    """

    # Allows the creation of properly-configured AutoBeans without having to
    # create an AutoBeanFactory with the desired annotations.
    CONFIGURATION = Configuration.Builder().setCategories(EntityProxyCategory,
        ValueProxyCategory, BaseProxyCategory).setNoWrap(EntityProxyId).build()

    def __init__(self, serviceLayer):
        self._service = serviceLayer
        self._exceptionHandler = DefaultExceptionHandler()