Esempio n. 1
0
 def run(self, runtime):
     path = self['path']
     for registration in Format.read(self['config']):
         implementation = import_object(registration['implementation'])
         constructor = StaticConstructor(implementation.config,
                                         registration['archetypes'])
         runtime.execute('mesh.javascript',
                         path=path,
                         bundle=constructor.construct())
Esempio n. 2
0
    def _construct_mount(self, archetype, model):
        resource = Resource
        controller = None

        for version, mixins, mixin_controller in archetype.config.resources:
            if resource.version != version[0]:
                resource = self._construct_resource(archetype, resource, version[0], mixins)

            controller = self._construct_controller(
                model, resource, version, controller, import_object(mixin_controller)
            )

        return mount(resource, controller)
Esempio n. 3
0
    def _construct_mount(self, archetype, model):
        resource = Resource
        controller = None

        for version, mixins, mixin_controller in archetype.config.resources:
            if resource.version != version[0]:
                resource = self._construct_resource(archetype, resource,
                                                    version[0], mixins)

            controller = self._construct_controller(
                model, resource, version, controller,
                import_object(mixin_controller))

        return mount(resource, controller)
Esempio n. 4
0
 def _bootstrap_prototype(self, session, prototype):
     bundle = import_object(prototype.config.bundle)
     for archetype in session.query(prototype):
         model = self.models[archetype.id] = self._construct_model(archetype)
         bundle.attach([self._construct_mount(archetype, model)])
Esempio n. 5
0
 def construct(self):
     bundle = import_object(self.config.bundle)
     for archetype in self.archetypes:
         bundle.attach([self._construct_mount(archetype)])
     return bundle
Esempio n. 6
0
 def _bootstrap_prototype(self, session, prototype):
     bundle = import_object(prototype.config.bundle)
     for archetype in session.query(prototype):
         model = self.models[archetype.id] = self._construct_model(
             archetype)
         bundle.attach([self._construct_mount(archetype, model)])
Esempio n. 7
0
 def construct(self):
     bundle = import_object(self.config.bundle)
     for archetype in self.archetypes:
         bundle.attach([self._construct_mount(archetype)])
     return bundle
Esempio n. 8
0
 def run(self, runtime):
     path = self['path']
     for registration in Format.read(self['config']):
         implementation = import_object(registration['implementation'])
         constructor = StaticConstructor(implementation.config, registration['archetypes'])
         runtime.execute('mesh.javascript', path=path, bundle=constructor.construct())
Esempio n. 9
0
 def instantiate(self, unit):
     if isinstance(unit, basestring):
         unit = import_object(unit)
     return self.acquire(unit.identity, unit, ())
Esempio n. 10
0
 def instantiate(self, unit):
     if isinstance(unit, basestring):
         unit = import_object(unit)
     return self.acquire(unit.identity, unit, ())