Package org.apache.tuscany.sca.interfacedef

Examples of org.apache.tuscany.sca.interfacedef.InterfaceContract


                    //inherit applicable policy sets from parent contract
                    addInheritedPolicySets(contract.getApplicablePolicySets(), confOp.getApplicablePolicySets());
                }
                               
                // Resolve the interface contract
                InterfaceContract interfaceContract = contract.getInterfaceContract();
                if (interfaceContract != null) {
                    extensionProcessor.resolve(interfaceContract, resolver);
                }
   
                // Resolve bindings
View Full Code Here


    protected <C extends AbstractContract> void resolveAbstractContracts(List<C> contracts, ModelResolver resolver)
        throws ContributionResolveException {
        for (AbstractContract contract : contracts) {

            // Resolve the interface contract
            InterfaceContract interfaceContract = contract.getInterfaceContract();
            if (interfaceContract != null) {
                extensionProcessor.resolve(interfaceContract, resolver);
            }
        }
    }
View Full Code Here

            RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
            reference.setName("default");
            ModelFactoryExtensionPoint factories =
                nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
            JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
            InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
            reference.setInterfaceContract(interfaceContract);
            component.getReferences().add(reference);
            reference.setComponent(component);
            SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
            SCABinding binding = scaBindingFactory.createSCABinding();
View Full Code Here

            RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
            reference.setName("default");
            ModelFactoryExtensionPoint factories =
                runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
            JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
            InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
            reference.setInterfaceContract(interfaceContract);
            component.getReferences().add(reference);
            reference.setComponent(component);
            SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
            SCABinding binding = scaBindingFactory.createSCABinding();
View Full Code Here

        if (((Contract)contract).getInterfaceContract(wsBinding) == null) {
            // can happen if incorrect component service name
            fatal(monitor, "MissingInterfaceContract", wsBinding, component.getName(), contract.getName());
        }

        InterfaceContract icontract = wsBinding.getBindingInterfaceContract();
        if (icontract == null) {
            icontract = ((Contract)contract).getInterfaceContract(wsBinding).makeUnidirectional(false);
            if (icontract instanceof JavaInterfaceContract) {
                ModelResolver resolver = component instanceof ResolverExtension ?
                                             ((ResolverExtension)component).getModelResolver() : null;
                icontract = createWSDLInterfaceContract(
                                    (JavaInterfaceContract)icontract,
                                    requiresSOAP12(wsBinding),
                                    resolver,
                                    dataBindings,
                                    wsdlFactory,
                                    xsdFactory,
                                    monitor);
            } else {
                try {
                    //TUSCANY-2316 Cloning the Interface Contract to avoid overriding data binding information
                    icontract = (InterfaceContract)icontract.clone();
                } catch (Exception e) {
                    //ignore
                }
            }
            wsBinding.setBindingInterfaceContract(icontract);
        }
       
        // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL
        // as we don't yet support requires="conversational" or sca:endConversation annotations
        // in WSDL interface descriptions (see section 1.5.4 of the Assembly Specification V1.0)
        if (contract.getInterfaceContract().getInterface() != null ) {
            icontract.getInterface().setConversational(contract.getInterfaceContract().getInterface().isConversational());
           
            for (Operation operation : icontract.getInterface().getOperations()){
                Operation serviceOperation = null;
               
                for (Operation tmpOp : contract.getInterfaceContract().getInterface().getOperations()){
                    if (operation.getName().equals(tmpOp.getName())) {
                        serviceOperation = tmpOp;
View Full Code Here

        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }

    @Test
    public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> sourceFaultTypes = new ArrayList<DataType>();
        sourceFaultTypes.add(0, sourceFaultType);
        Operation opSource1 = newOperation("op1");
        opSource1.setFaultTypes(sourceFaultTypes);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        Operation opTarget = newOperation("op1");
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

        i2.getOperations().add(callbackOp1);
    }
   
    @Test
    public void testClone() throws Exception {
        InterfaceContract copy = (InterfaceContract) contract.clone();
        Assert.assertNotNull(copy);
        Assert.assertNotSame(copy.getCallbackInterface(), contract.getCallbackInterface());
        Assert.assertNotSame(copy.getInterface(), contract.getInterface());
    }
View Full Code Here

    /**
     * Initialize the invocation chains
     */
    private void initInvocationChains() {
        chains = new ArrayList<InvocationChain>();
        InterfaceContract sourceContract = getBindingInterfaceContract();

        // It's the service wire
        RuntimeComponentService service = (RuntimeComponentService)getService();
        RuntimeComponent serviceComponent = (RuntimeComponent)getComponent();

        //InterfaceContract targetContract = getInterfaceContract();
        // TODO - EPR - why is this looking at the component types. The endpoint should have the right interface contract by this time
        InterfaceContract targetContract = getComponentTypeServiceInterfaceContract();
        // setInterfaceContract(targetContract);
        validateServiceInterfaceCompatibility();
        for (Operation operation : sourceContract.getInterface().getOperations()) {
            Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
            if (targetOperation == null) {
                throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                    + " is found in service "
                    + serviceComponent.getURI()
                    + "#"
View Full Code Here

     * Check that endpoint  has compatible interface at the component and binding ends.
     * The user can specify the interfaces at both ends so there is a danger that they won't be compatible.
     */
    public void validateServiceInterfaceCompatibility() {
       
        InterfaceContract serviceContract = getComponentServiceInterfaceContract();
        InterfaceContract bindingContract = getBindingInterfaceContract();
               
        if ((serviceContract != bindingContract) &&
            (serviceContract != null) && (bindingContract != null)) {
          
            boolean bindingHasCallback = bindingContract.getCallbackInterface() != null;
           
            try {                                                        
              
                // Use the normalized contract if the interface types are different or if
                // a normalized contract has been previously generate, for example, by virtue
                // of finding a JAXWS annotation on a Java class that references a WSDL file
                if (serviceContract.getClass() != bindingContract.getClass() ||
                    serviceContract.getNormalizedWSDLContract() != null ||
                    bindingContract.getNormalizedWSDLContract() != null) {
                    interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract),
                                                               getGeneratedWSDLContract(bindingContract),
                                                               Compatibility.SUBSET,
                                                               !bindingHasCallback, // ignore callbacks if binding doesn't have one
                                                               false);
View Full Code Here

        }
        return xml;
    }
   
    private String getWsdl() {
        InterfaceContract ic = getComponentServiceInterfaceContract();
        if (ic == null || ic.getInterface() == null || !!!ic.getInterface().isRemotable()) {
            return "";
        }
        WSDLInterfaceContract wsdlIC = (WSDLInterfaceContract)getGeneratedWSDLContract(getComponentServiceInterfaceContract());
        if (wsdlIC == null) {
            return "";
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.interfacedef.InterfaceContract

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.