Examples of PojoObjectFactory


Examples of org.apache.tuscany.core.injection.PojoObjectFactory

            } catch (TuscanyRuntimeException e) {
                e.addContextName(name);
                throw e;
            }
        } else {
            PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters);
            return new SystemAtomicContext(name, objectFactory, eagerInit, init, destroy, stateless);
        }
    }
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

                Injector injector = new MethodInjector(method, new SingletonObjectFactory(moduleComponentContext));
                injectors.add(injector);
            }
        }
        boolean stateless = (scope == Scope.INSTANCE);
        return new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper
                .getDefaultConstructor(implType), null, injectors), eagerInit, initInvoker, destroyInvoker, stateless);
    }
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

            }
        }
        // setup constructor injection
        ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
        Constructor<?> constr = ctorDef.getConstructor();
        PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
        configuration.setInstanceFactory(instanceFactory);
        configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());
        SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(definition.getName(), configuration);
        // handle properties
        Map<String, PropertyValue<?>> propertyValues = definition.getPropertyValues();
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

            }
        }
        // setup constructor injection
        ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
        Constructor<?> constr = ctorDef.getConstructor();
        PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
        configuration.setInstanceFactory(instanceFactory);
        configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());

        JavaAtomicComponent component =
            new JavaAtomicComponent(definition.getName(), configuration, monitor);
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

        expectLastCall().andReturn(instance).anyTimes();
        replay(scope);
        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(scope);
        try {
            configuration.setInstanceFactory(new PojoObjectFactory(DummyImpl.class.getConstructor()));
        } catch (NoSuchMethodException e) {
            throw new AssertionError(e);
        }
        configuration.addServiceInterface(DummyImpl.class);
        configuration.setWireService(WIRE_SERVICE);
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

    @SuppressWarnings("unchecked")
    public static <T> JavaAtomicComponent createJavaComponent(String name, ScopeContainer scope, Class<T> clazz)
        throws NoSuchMethodException {
        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(scope);
        configuration.setInstanceFactory(new PojoObjectFactory(clazz.getConstructor()));
        configuration.addServiceInterface(clazz);
        configuration.setWireService(WIRE_SERVICE);
        return new JavaAtomicComponent(name, configuration, null);

    }
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

        InboundWire inboundWire = createServiceWire(serviceName, targetService, targetHeadInterceptor);
        targetContext.addInboundWire(inboundWire);

        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(sourceScope);
        configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
        configuration.addServiceInterface(sourceClass);
        configuration.setWireService(WIRE_SERVICE);
        for (Map.Entry<String, Member> entry : members.entrySet()) {
            configuration.addReferenceSite(entry.getKey(), entry.getValue());
        }
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

        InboundWire inboundWire = createServiceWire(serviceName, targetService, null);
        targetContext.addInboundWire(inboundWire);

        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(sourceScope);
        configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
        configuration.addServiceInterface(sourceClass);
        configuration.setWireService(WIRE_SERVICE);
        for (Map.Entry<String, Member> entry : members.entrySet()) {
            configuration.addReferenceSite(entry.getKey(), entry.getValue());
        }
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

        Map<String, AtomicComponent> contexts = new HashMap<String, AtomicComponent>();
        SystemAtomicComponent targetComponent = createAtomicComponent(target, targetScopeContainer, targetClass);
        PojoConfiguration sourceConfig = new PojoConfiguration();
        sourceConfig.getServiceInterfaces().addAll(sourceInterfaces);
        sourceConfig.setScopeContainer(sourceScopeContainer);
        sourceConfig.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));

        //create target wire
        Method[] sourceMethods = sourceClass.getMethods();
        Class[] interfaces = targetClass.getInterfaces();
        Method setter = null;
View Full Code Here

Examples of org.apache.tuscany.core.injection.PojoObjectFactory

    public static SystemAtomicComponent createAtomicComponent(String name, ScopeContainer container, Class<?> clazz)
        throws NoSuchMethodException {
        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(container);
        configuration.addServiceInterface(clazz);
        configuration.setInstanceFactory(new PojoObjectFactory(clazz.getConstructor()));
        Method[] methods = clazz.getMethods();
        for (Method method : methods) {
            Init init;
            if ((init = method.getAnnotation(Init.class)) != null) {
                configuration.setInitLevel(init.eager() ? 50 : 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.