Package org.apache.tuscany.sca.interfacedef

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


    private void setNormalizedWSDLContract() {
        if (wsdl == null || wsdl.length() < 1) {
            return;
        }
        InterfaceContract ic = getComponentServiceInterfaceContract();
        if (ic != null) {
            // ic.setNormalizedWSDLContract(WSDLHelper.createWSDLInterfaceContract(registry, wsdl));
        }
    }
View Full Code Here


    /**
     * Initialize the invocation chains
     */
    private void initInvocationChains() {
        InterfaceContract sourceContract = getComponentTypeReferenceInterfaceContract();
        // TODO - EPR why is this looking at the component types. The endpoint reference should have the right interface contract by this time
        //InterfaceContract sourceContract = getLeafInterfaceContract(endpointReference);

        // It's the reference wire
        resolveEndpointReference();

        InterfaceContract targetContract = getBindingInterfaceContract();
        // TODO - EPR why is this looking at the component types. The endpoint should have the right interface contract by this time
        //InterfaceContract targetContract = getLeafInterfaceContract(endpoint);

        if (sourceContract == null && targetContract != null) {
            // TODO: until the web component introspection is brought up
            try {
                sourceContract = (InterfaceContract)targetContract.clone();
            } catch (CloneNotSupportedException e) {
                throw new IllegalStateException(e);
            }
        }
       
        validateReferenceInterfaceCompatibility();

        List<InvocationChain> chainList = new ArrayList<InvocationChain>();
        if(sourceContract != null && targetContract != null) {
            RuntimeComponentReference reference = (RuntimeComponentReference)getReference();
            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 reference "
                        + getComponent().getURI()
                        + "#"
View Full Code Here

     * There is checking in the activator but of course endpoint references may not have a binding assigned
     * until final resolution.
     */
    public void validateReferenceInterfaceCompatibility() {

        InterfaceContract referenceContract = getComponentReferenceInterfaceContract();
        InterfaceContract bindingContract =  getBindingInterfaceContract();
       
       if ((referenceContract != 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 (referenceContract.getClass() != bindingContract.getClass() ||
                   referenceContract.getNormalizedWSDLContract() != null ||
                   bindingContract.getNormalizedWSDLContract() != null) {
                   interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(referenceContract),
                                                              getGeneratedWSDLContract(bindingContract),
                                                              Compatibility.SUBSET,
                                                              !bindingHasCallback, // ignore callbacks if binding doesn't have one
                                                              false);
View Full Code Here

     * Use endpoint information to work out what the interface contract for the
     * binding is.
     */
    @Override
    public InterfaceContract getInterfaceContract(Binding binding) {
        InterfaceContract interfaceContract = null;

        if (interfaceContract == null) {
            interfaceContract = getInterfaceContract();
        }
        return interfaceContract;
View Full Code Here

       
        // Set pseudo-service onto the component
        getComponent().getServices().add(service);
       
        // if the reference has a WSDL contract reset the response endpoint to be WSDL also
        InterfaceContract referenceInterfaceContract = getComponentTypeReferenceInterfaceContract();
        if (referenceInterfaceContract instanceof WSDLInterfaceContract){
            WSDLInterfaceContract wsdlInterfaceContract = (WSDLInterfaceContract)endpoint.getGeneratedWSDLContract(interfaceContract);
            service.setInterfaceContract(wsdlInterfaceContract);
        }        
View Full Code Here

     * @param target
     * @return
     */
    public boolean isMutuallyCompatible(InterfaceContract source, InterfaceContract target) {
        ExtensionType ext = source.getInterface().getExtensionType();
        InterfaceContract sourceContract = null;

        // Are the forward interfaces equal?
        if (isMutuallyCompatible(source.getInterface(), target.getInterface())) {
            // Is there a Callback interface?
            if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) {
View Full Code Here

        mapper = utilities.getUtility(InterfaceContractMapper.class);
    }

    @Test
    public void testNoOperation() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        InterfaceContract target = new MockContract("FooContract");
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

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

    @Test
    public void testBasic() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        Operation opSource1 = newOperation("op1");
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());
        InterfaceContract target = new MockContract("FooContract");
        Operation opSource2 = newOperation("op1");
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opSource2);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

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

    @Test
    public void testBasicIncompatibleOperationNames() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        Operation opSource1 = newOperation("op1");
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());
        InterfaceContract target = new MockContract("FooContract");
        Operation opSource2 = newOperation("op2");
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op2", opSource2);
        target.getInterface().getOperations().addAll(targetOperations.values());
        try {
            mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
            fail();
        } catch (IncompatibleInterfaceContractException e) {
            // expected
View Full Code Here

        }
    }

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

        InterfaceContract target = new MockContract("FooContract");
        List<DataType> targetInputTypes = new ArrayList<DataType>();
        targetInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
        DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);

        Operation opTarget = newOperation("op1");
        opTarget.setInputType(targetInputType);
        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

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.