Package org.apache.tuscany.core.context

Examples of org.apache.tuscany.core.context.QualifiedName


        source.addInterceptor(sourceInterceptor);

        SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory();
        Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>();
        sourceInvocationConfigs.put(hello, source);
        WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"),
                sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        sourceFactory.setConfiguration(sourceConfig);
        sourceFactory.setBusinessInterface(SimpleTarget.class);
       
        TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello);
        MockHandler targetRequestHandler = new MockHandler();
        MockHandler targetResponseHandler = new MockHandler();
        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        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
View Full Code Here


     * Reference source is an external service, target is in another module
     *
     * @param targetName the name of the target service
     */
    public InterCompositeReferenceFactory(String targetName) {
        targetQualifiedName = new QualifiedName(targetName);
    }
View Full Code Here

        assert (resolver != null) : "Context resolver was null";
        assert (targetName != null) : "Target name was null";
        assert (serviceInterface != null) : "Service interface is null";
        this.serviceInterface = serviceInterface;
        this.resolver = resolver;
        this.targetName = new QualifiedName(targetName);
    }
View Full Code Here

    protected void wireSource(ContextFactory<Context> source) {
        Scope sourceScope = source.getScope();
        if (source.getSourceWireFactories() != null) {
            for (SourceWireFactory<?> sourceFactory : source.getSourceWireFactories()) {
                WireConfiguration wireConfiguration = sourceFactory.getConfiguration();
                QualifiedName targetName = wireConfiguration.getTargetName();
                ContextFactory<?> target = configurations.get(targetName.getPartName());
                if (target == null) {
                    ContextInitException e = new ContextInitException("Target not found");
                    e.setIdentifier(targetName.getPartName());
                    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

    protected void registerAutowireInternal(Class<?> interfaze, String name, ScopeContext scopeContext) {
        assert interfaze != null;
        if (autowireInternal.containsKey(interfaze)) {
            return;
        }
        QualifiedName qname = new QualifiedName(name);
        NameToScope nts = new NameToScope(qname, scopeContext);
        autowireInternal.put(interfaze, nts);
    }
View Full Code Here

    protected void registerAutowireExternal(Class<?> interfaze, String name, ScopeContext scopeContext) {
        assert interfaze != null;
        if (autowireExternal.containsKey(interfaze)) {
            return;
        }
        QualifiedName qname = new QualifiedName(name);
        NameToScope nts = new NameToScope(qname, scopeContext);
        autowireExternal.put(interfaze, nts);
    }
View Full Code Here

        Assert.assertNotNull(echoMethod);
    }

    public void testScopedInvoke() throws Exception {
        ScopeContext container = new MockScopeContext();
        ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(new QualifiedName("foo"), echoMethod, container,false);
        Object ret = invoker.invokeTarget("foo");
        Assert.assertEquals("foo", ret);
    }
View Full Code Here

        Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
        childContext.registerModelObject(component);
        childContext.registerModelObject(ep);
        childContext.publish(new ModuleStart(this));
        Assert.assertNotNull(system.getContext("system.child").getInstance(new QualifiedName("./TestService1EP")));
        childContext.publish(new ModuleStop(this));
    }
View Full Code Here

    public NonProxiedTargetFactory(ConfiguredService targetService, ContextResolver resolver) throws FactoryInitException {
        assert (targetService != null) : "Target service was null";
        assert (resolver != null) : "Context resolver was null";

        this.resolver = resolver;
        targetName = new QualifiedName(targetService.getPart().getName());
        qualifiedServiceName = new QualifiedName("./"+targetName.getPortName());
    }
View Full Code Here

        SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello);

        SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory();
        Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>();
        sourceInvocationConfigs.put(hello, source);
        WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"),
                sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        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
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.context.QualifiedName

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.