Package org.apache.tuscany.model.assembly

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


            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()) {
                    ServiceURI targetURI = factory.createServiceURI(null, target);
                    Wire wire = factory.createWire();
                    wire.setSource(sourceURI);
                    wire.setTarget(targetURI);
                    getWires().add(wire);
                }
            }
            for (ExternalService externalService : getExternalServices()) {
                if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO)
                    continue;
                Reference reference = factory.createReference();
                reference.setName(externalService.getName());
                ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract();
                if (serviceContract != null)
                    reference.setServiceContract(serviceContract);
                componentType.getReferences().add(reference);
            }
            for (Component<Implementation> component : getComponents()) {
View Full Code Here


    public void testServiceBasicProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestComponentImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestComponent.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

     */
    public void testSingleServiceProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestLocalComponentImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestLocalComponent.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

     */
    public void testInteraceHierarchyServiceProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(SuperFooImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(SuperSuperFoo.class, contract.getInterface());
    }
View Full Code Here

     */
    public void testNonServiceProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestNonServiceInterfacesImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestNonServiceInterfacesImpl.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

     */
    public void testNonServiceSpecifiedProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestNonServiceSpecifiedImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestNonServiceInterface.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

     */
    public void testParentScopeEvaluation() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(ScopeTestComponent.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

                    public Service getPort() {
                        return new Service() {

                            public ServiceContract getServiceContract() {
                                return new ServiceContract() {

                                    public Class getInterface() {
                                        return Foo.class;
                                    }
View Full Code Here

     * Its E4X if the JavaScript component uses WSDL to define its interface
     */
    protected boolean isE4XStyle(String componentName, List<Service> services) {
        Boolean isE4XStyle = null;
        for (Service service : services) {
            ServiceContract sc = service.getServiceContract();
            if (sc instanceof WSDLServiceContract) {
                if (isE4XStyle != null && !isE4XStyle.booleanValue()) {
                    throw new BuilderConfigException("mixed service interface types not supportted");
                }
                isE4XStyle = Boolean.TRUE;
View Full Code Here

    protected E4XDataBinding createDataBinding(JavaScriptImplementation jsImplementation) {
        ClassLoader classLoader = jsImplementation.getResourceLoader().getClassLoader();
        TypeHelper typeHelper = jsImplementation.getTypeHelper();
        E4XDataBinding dataBinding = new E4XDataBinding(classLoader, typeHelper);
        for (Service service : jsImplementation.getComponentType().getServices()) {
            ServiceContract sc = service.getServiceContract();
            if (sc instanceof WSDLServiceContract) {
                PortType pt = ((WSDLServiceContract) sc).getPortType();
                for (Object o : pt.getOperations()) {
                    Operation operation = (Operation) o;
                    Input input = operation.getInput();
View Full Code Here

TOP

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

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.