Package org.apache.tuscany.model.assembly

Examples of org.apache.tuscany.model.assembly.Service


        return ref;
    }

    public EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName) {
        // create and configure the exposed service
        Service service = createService();
        service.setName(entryPointName);
        service.setServiceContract(serviceContract);
        ConfiguredService configuredService = createConfiguredService();
        configuredService.setPort(service);

        // create and configure a reference to target
        Reference reference = createReference();
View Full Code Here


        else
            moduleComponentName = "";
        if (configuredPort instanceof ConfiguredService) {
            partName = part.getName();
            ConfiguredService configuredService = (ConfiguredService) configuredPort;
            Service service = configuredService.getPort();
            if (service != null) {
                serviceName = configuredService.getPort().getName();
                address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName;
            } else {
                address = "sca:///" + moduleComponentName + '/' + partName;
View Full Code Here

            if (ep.getBindings().size() < 1 || !(ep.getBindings().get(0) instanceof FooBinding)) {
                return;
            }
            EntryPointContextFactory contextFactory = new FooEntryPointContextFactory(ep.getName(), messageFactory);
            ConfiguredService configuredService = ep.getConfiguredService();
            Service service = configuredService.getPort();
            SourceWireFactory wireFactory = wireFactoryService.createSourceFactory(ep.getConfiguredReference()).get(0);
            contextFactory.addSourceWireFactory(service.getName(), wireFactory);
            ep.setContextFactory(contextFactory);
        } else if (object instanceof ExternalService) {
            ExternalService es = (ExternalService) object;
            if (es.getBindings().size() < 1 || !(es.getBindings().get(0) instanceof FooBinding)) {
                return;
            }
            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

        ContextFactory contextFactory;
        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) {
                for (ConfiguredProperty property : configuredProperties) {
View Full Code Here

            return;
        }

        EntryPointContextFactory contextFactory = createEntryPointContextFactory(entryPoint, messageFactory);
        ConfiguredService configuredService = entryPoint.getConfiguredService();
        Service service = configuredService.getPort();
        SourceWireFactory wireFactory = wireService.createSourceFactory(entryPoint.getConfiguredReference()).get(0);
        contextFactory.addSourceWireFactory(service.getName(), wireFactory);
        entryPoint.setContextFactory(contextFactory);
    }
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

        // Also derive properties from the overridable properties of the components in the composite
        if (componentType == null) {
            AssemblyFactory factory = modelContext.getAssemblyFactory();
            componentType = factory.createComponentType();
            for (EntryPoint entryPoint : getEntryPoints()) {
                Service service = factory.createService();
                service.setName(entryPoint.getName());
                ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract();
                if (serviceContract != null)
                    service.setServiceContract(serviceContract);
                componentType.getServices().add(service);

                ConfiguredReference configuredReference = entryPoint.getConfiguredReference();
                ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference);
                for (String target : configuredReference.getTargets()) {
View Full Code Here

    private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl();
    private AssemblyContext assemblyContext = new AssemblyContextImpl(factory, null, null);
    
    public void testModelVisit() throws Exception {
        ComponentType componentType;
        Service service;
        SystemImplementation impl;
        Component component;

        Module module = factory.createModule();

        // create target component
        componentType = factory.createComponentType();
        service = factory.createService();
        service.setName("target");
        componentType.getServices().add(service);
        impl = factory.createSystemImplementation();
        impl.setComponentType(componentType);
        component = factory.createSimpleComponent();
        component.setName("target");
        component.setImplementation(impl);
        component.initialize(assemblyContext);
        module.getComponents().add(component);

        // create source component
        componentType = factory.createComponentType();
        Reference ref = factory.createReference();
        ref.setName("ref");
        componentType.getReferences().add(ref);
        impl = factory.createSystemImplementation();
        impl.setComponentType(componentType);
        component = factory.createSimpleComponent();
        component.setName("source");
        component.setImplementation(impl);
        ConfiguredReference cRef = factory.createConfiguredReference("ref", "target");
        component.getConfiguredReferences().add(cRef);
        component.initialize(assemblyContext);
        module.getComponents().add(component);

        EntryPoint ep = factory.createEntryPoint();
        JavaServiceContract contract = factory.createJavaServiceContract();
        contract.setInterface(ModuleScopeSystemComponent.class);
        service = factory.createService();
        service.setServiceContract(contract);
        ConfiguredService cService = factory.createConfiguredService();
        cService.setPort(service);
        cService.initialize(assemblyContext);
        ep.setConfiguredService(cService);
        SystemBinding binding = factory.createSystemBinding();
View Full Code Here

        system1Component.getImplementation().getEntryPoints().add(ep);
        system.registerModelObject(system1Component);
        EntryPoint systemEp = MockFactory.createEPSystemBinding("target.system.ep", Target.class, "ref");

        systemEp.getBindings().add(systemFactory.createSystemBinding());
        Service service = systemFactory.createService();
        service.setName("system1/target.ep");
        (systemEp.getConfiguredReference().getTargetConfiguredServices().get(0)).setPort(service);

        system.registerModelObject(systemEp);
        ModuleComponent app1Component = createAppModuleComponent("app1");
        ModuleComponent app1aComponent = createAppModuleComponent("app1a");
View Full Code Here

        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        app1bComponent.getImplementation().getComponents().add(target);

        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        ep.getBindings().add(systemFactory.createSystemBinding());
        Service service = systemFactory.createService();
        service.setName("target.ep");
        ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service);
        app1bComponent.getImplementation().getEntryPoints().add(ep);

        CompositeContext root = runtime.getRootContext();
        root.registerModelObject(app1Component);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.model.assembly.Service

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.