Package org.apache.tuscany.core.wire

Examples of org.apache.tuscany.core.wire.TargetWireFactory


        target.addRequestHandler(targetRequestHandler);
        target.addResponseHandler(targetResponseHandler);
        target.addInterceptor(targetInterceptor);
        target.addInterceptor(new InvokerInterceptor());

        TargetWireFactory targetFactory = new JDKWireFactoryFactory().createTargetWireFactory();
        Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>();
        targetInvocationConfigs.put(hello, target);
        WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"),
                targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        targetFactory.setConfiguration(targetConfig);
        targetFactory.setBusinessInterface(SimpleTarget.class);

        // bootstrap a scope container with the target in it
        Map<String,Object> instances = new HashMap<String,Object>();
        SimpleTarget simpleTarget = new SimpleTargetImpl();
        instances.put("target",simpleTarget);
View Full Code Here


            }
            FooExternalServiceContextFactory contextFactory = new FooExternalServiceContextFactory(es.getName(),
                    new FooClientFactory());
            ConfiguredService configuredService = es.getConfiguredService();
            Service service = configuredService.getPort();
            TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService);
            contextFactory.addTargetWireFactory(service.getName(), wireFactory);
            es.setContextFactory(contextFactory);
        }
    }
View Full Code Here

                    e.addContextName(source.getName());
                    e.addContextName(name);
                    throw e;
                }
                // get the proxy chain for the target
                TargetWireFactory targetFactory = target.getTargetWireFactory(targetName.getPortName());
                if (targetFactory == null) {
                    ContextInitException e = new ContextInitException("No proxy factory found for service");
                    e.setIdentifier(wireConfiguration.getTargetName().getPortName());
                    e.addContextName(target.getName());
                    e.addContextName(source.getName());
View Full Code Here

        } else {
            if (!(modelObject instanceof ConfiguredService)) {
                return;
            } else {
                ConfiguredService cservice = (ConfiguredService) modelObject;
                TargetWireFactory pFactory = (TargetWireFactory) cservice.getProxyFactory();
                for (InvocationConfiguration config : pFactory.getConfiguration().getInvocationConfigurations().values()) {
                    if (request) {
                        config.addRequestHandler(handler);
                    } else {
                        config.addResponseHandler(handler);
                    }
View Full Code Here

        try {
            contextFactory = createContextFactory(component.getName(), component.getImplementation(), scope);
            // create target-side wire invocation chains for each service offered by the implementation
            for (ConfiguredService configuredService : component.getConfiguredServices()) {
                Service service = configuredService.getPort();
                TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService);
                contextFactory.addTargetWireFactory(service.getName(), wireFactory);
            }
            // handle properties
            List<ConfiguredProperty> configuredProperties = component.getConfiguredProperties();
            if (configuredProperties != null) {
View Full Code Here

        ExternalServiceContextFactory contextFactory
                = createExternalServiceContextFactory(externalService);

        ConfiguredService configuredService = externalService.getConfiguredService();
        Service service = configuredService.getPort();
        TargetWireFactory wireFactory = wireService.createTargetFactory(configuredService);
        contextFactory.addTargetWireFactory(service.getName(), wireFactory);
        externalService.setContextFactory(contextFactory);
    }
View Full Code Here

        FooWireBuilder fooBuilder = new FooWireBuilder();
        BarWireBuilder barBuilder = new BarWireBuilder();
        DefaultWireBuilder defaultBuilder = new DefaultWireBuilder();
        defaultBuilder.addWireBuilder(fooBuilder);
        defaultBuilder.addWireBuilder(barBuilder);
        TargetWireFactory targetFooFactory = new JDKTargetWireFactory();
        Map<Method, TargetInvocationConfiguration> fooConfigs = new HashMap<Method, TargetInvocationConfiguration>();
        TargetInvocationConfiguration fooInvocation = new TargetInvocationConfiguration(m);
        fooConfigs.put(m, fooInvocation);
        Map<Method, TargetInvocationConfiguration> barConfigs = new HashMap<Method, TargetInvocationConfiguration>();
        TargetInvocationConfiguration barInvocation = new TargetInvocationConfiguration(m);
        barConfigs.put(m, barInvocation);
        targetFooFactory.setConfiguration(new WireTargetConfiguration(null, fooConfigs, null, null));
        TargetWireFactory targetBarFactory = new JDKTargetWireFactory();
        targetBarFactory.setConfiguration(new WireTargetConfiguration(null, barConfigs, null, null));
        ScopeContext ctx = new MockScopeContext();
        defaultBuilder.completeTargetChain(targetFooFactory, FooContextFactory.class, ctx);
        defaultBuilder.completeTargetChain(targetBarFactory, BarContextFactory.class, ctx);
        assertEquals(FooInvoker.class, targetFooFactory.getConfiguration().getInvocationConfigurations().get(m).getTargetInvoker().getClass());
        assertEquals(BarInvoker.class, targetBarFactory.getConfiguration().getInvocationConfigurations().get(m).getTargetInvoker().getClass());

    }
View Full Code Here

        sourceFactory.setConfiguration(sourceConfig);
        sourceFactory.setBusinessInterface(SimpleTarget.class);

        TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello);

        TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory();
        Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>();
        targetInvocationConfigs.put(hello, target);
        WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"),
                targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        targetFactory.setConfiguration(targetConfig);
        targetFactory.setBusinessInterface(SimpleTarget.class);

        // connect the source to the target
        DefaultWireBuilder builder = new DefaultWireBuilder();
        try {
            builder.connect(sourceFactory, targetFactory, null, true, null);
View Full Code Here

        target.addRequestHandler(targetRequestHandler);
        target.addResponseHandler(targetResponseHandler);
        target.addInterceptor(targetInterceptor);
        target.addInterceptor(new InvokerInterceptor());

        TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory();
        Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>();
        targetInvocationConfigs.put(hello, target);
        WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"),
                targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        targetFactory.setConfiguration(targetConfig);
        targetFactory.setBusinessInterface(SimpleTarget.class);

        // connect the source to the target
        DefaultWireBuilder builder = new DefaultWireBuilder();
        // no need for scopes since we use a static invoker
        builder.connect(sourceFactory, targetFactory, null, true, null);
View Full Code Here

        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        target.addRequestHandler(targetRequestHandler);
        target.addInterceptor(targetInterceptor);
        target.addInterceptor(new InvokerInterceptor());

        TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory();
        Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>();
        targetInvocationConfigs.put(hello, target);
        WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"),
                targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        targetFactory.setConfiguration(targetConfig);
        targetFactory.setBusinessInterface(SimpleTarget.class);

        // connect the source to the target
        DefaultWireBuilder builder = new DefaultWireBuilder();
        // no need for scopes since we use a static invoker
        builder.connect(sourceFactory, targetFactory, null, true, null);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.wire.TargetWireFactory

Copyright © 2018 www.massapicom. 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.