Package org.apache.tuscany.sca.assembly

Examples of org.apache.tuscany.sca.assembly.Reference


        } catch (CloneNotSupportedException e) {
            // will not happen
        }
        Service implService = service.getService();
        if (implService != null) {
            Reference implReference = assemblyFactory.createReference();
            implReference.setName(implService.getName());
            try {
                InterfaceContract implContract =
                    (InterfaceContract)implService.getInterfaceContract().clone();
                implContract.setInterface(implContract.getCallbackInterface());
                implContract.setCallbackInterface(null);
                implReference.setInterfaceContract(implContract);
            } catch (CloneNotSupportedException e) {
                // will not happen
            }
            componentReference.setReference(implReference);
        }
View Full Code Here


    reference.setInterfaceContract(interfaceContract);
        String referenceName = endpoint.getService().getName() + "_asyncCallback";
        reference.setName(referenceName);
        reference.setForCallback(true);
        // Add in "implementation" reference (really a dummy, but with correct interface)
        Reference implReference = assemblyFactory.createReference();
        implReference.setInterfaceContract(interfaceContract);
        implReference.setName(referenceName);
        implReference.setForCallback(true);
       
        reference.setReference(implReference);
        // Set the created ComponentReference into the EPR
        epr.setReference(reference);
       
View Full Code Here

    public List<Reference> getReferences() {
        return references;
    }
   
    public Reference getReference(String name){
        Reference reference = null;
       
        for (Reference tmp : getReferences()){
            if (tmp.getName().equals(name)){
                reference = tmp;
                break;
View Full Code Here

                xqueryImplementation.getServices().add(theService);
            } else if (uri.startsWith(SCA_REFERENCE_PREFIX)) {
                String referenceName = prefix;
                String className = uri.substring(SCA_REFERENCE_PREFIX.length());
                Class<?> interfaze = resolveClass(resolver, className);
                Reference theReference = createReference(interfaze, referenceName);
                xqueryImplementation.getReferences().add(theReference);
            } else if (uri.startsWith(SCA_PROPERTY_JAVA_PREFIX)) {
                String propertyName = prefix;
                String className = uri.substring(SCA_PROPERTY_JAVA_PREFIX.length());
                Class<?> clazz = resolveClass(resolver, className);
View Full Code Here

    /**
     * Creates a Reference for the component type based on its name and Java interface
     */
    private Reference createReference(Class<?> interfaze, String name) throws InvalidInterfaceException {
        Reference reference = assemblyFactory.createReference();
        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
        reference.setInterfaceContract(interfaceContract);

        // Set the name of the reference to the supplied name and the multiplicity of the reference
        // to 1..1 - for XQuery implementations, this is the only multiplicity supported
        reference.setName(name);
        reference.setMultiplicity(Multiplicity.ONE_ONE);

        // Set the call interface and, if present, the callback interface
        JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
        reference.getInterfaceContract().setInterface(callInterface);
        if (callInterface.getCallbackClass() != null) {
            JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
            reference.getInterfaceContract().setCallbackInterface(callbackInterface);
        }

        return reference;
    }
View Full Code Here

        // Propagate interfaces from inner composite components' references to
        // their component references
        for (Component component : composite.getComponents()) {
            if (component.getImplementation() instanceof Composite) {
                for (ComponentReference componentReference : component.getReferences()) {
                    Reference reference = componentReference.getReference();
                    if (reference != null) {
                        if (componentReference.getInterfaceContract() == null) {
                            componentReference.setInterfaceContract(reference.getInterfaceContract());
                        }
                    }
                }
            }
        }
View Full Code Here

        // in this composite
        for (Component component : composite.getComponents()) {
            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {
                for (ComponentReference componentReference : component.getReferences()) {
                    Reference implReference = componentReference.getReference();
                    if (implReference != null && implReference instanceof CompositeReference) {
                        CompositeReference compositeReference = (CompositeReference)implReference;
                        List<ComponentReference> promotedReferences =
                            getPromotedComponentReferences(compositeReference);
                        for (ComponentReference promotedReference : promotedReferences) {
View Full Code Here

     * @return
     */
    private void collectPromotedComponentReferences(CompositeReference compositeReference,
                                                    List<ComponentReference> componentReferences) {
        for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
            Reference reference = componentReference.getReference();
            if (reference instanceof CompositeReference) {
   
                // Continue to follow the reference promotion chain
                collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
   
View Full Code Here

                    //throw new RuntimeException(e);
                }
            }
       
            for (ComponentReference componentReference : component.getReferences()) {
                Reference reference = componentReference.getReference();
                if (reference != null) {
                    // reconcile intents and policysets
                    PolicyComputationUtils.addInheritedIntents(reference.getRequiredIntents(), componentReference.getRequiredIntents());
                    PolicyComputationUtils.addInheritedPolicySets(reference.getPolicySets(), componentReference.getPolicySets(), true);
                }
               
                if ( componentReference.getCallback() != null ) {
                    PolicyComputationUtils.addInheritedIntents(componentReference.getRequiredIntents(),
                                        componentReference.getCallback().getRequiredIntents());
View Full Code Here

    }
   
    public ComponentType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        ComponentType componentType = null;
        Service service = null;
        Reference reference = null;
        Contract contract = null;
        Property property = null;
        Callback callback = null;
        QName name = null;
       
        // Read the componentType document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    name = reader.getName();

                    if (Constants.COMPONENT_TYPE_QNAME.equals(name)) {

                        // Read a <componentType>
                        componentType = assemblyFactory.createComponentType();
                        componentType.setConstrainingType(readConstrainingType(reader));

                    } else if (Constants.SERVICE_QNAME.equals(name)) {

                        // Read a <service>
                        service = assemblyFactory.createService();
                        contract = service;
                        service.setName(getString(reader, Constants.NAME));
                        componentType.getServices().add(service);
                        policyProcessor.readPolicies(service, reader);

                    } else if (Constants.REFERENCE_QNAME.equals(name)) {

                        // Read a <reference>
                        reference = assemblyFactory.createReference();
                        contract = reference;
                        reference.setName(getString(reader, Constants.NAME));
                        reference.setWiredByImpl(getBoolean(reader, Constants.WIRED_BY_IMPL));
                        readMultiplicity(reference, reader);
                        readTargets(reference, reader);
                        componentType.getReferences().add(reference);
                        policyProcessor.readPolicies(reference, reader);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.Reference

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.