Package org.apache.tuscany.sca.assembly

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


        this.registry = registry;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        EndpointReference cloned = (EndpointReference)super.clone();

        if (targetEndpoint != null){
            cloned.setTargetEndpoint((Endpoint)targetEndpoint.clone());
        }

        return cloned;
    }
View Full Code Here


                    warning(monitor, "ComponentReferenceMoreWire", promotedReference, promotedReference.getName());               
                } // end if
            } // end if
            // Clone the EndpointReferences from the outer level and add to the promoted reference
            for( EndpointReference epRef : reference.getEndpointReferences()){
              EndpointReference epRefClone = copyHigherReference( epRef, promotedReference );
              promotedReference.getEndpointReferences().add(epRefClone);
            } // end for
        } // end if
       
        Set<Binding> callbackBindings = new HashSet<Binding>();
View Full Code Here

     * @param epRef - the endpoint reference
     * @param promotedReference - the promoted reference
     * @return - a copy of the EndpointReference with data merged from the promoted reference
     */
    private static EndpointReference copyHigherReference( EndpointReference epRef, ComponentReference promotedReference ) {
      EndpointReference epRefClone = null;
      try {
        epRefClone = (EndpointReference) epRef.clone();
      } catch (Exception e) {
        // Ignore (we know that EndpointReference2 can be cloned)
      } // end try
      // Copy across details of the inner reference
      ComponentReference ref = epRefClone.getReference();
      //FIXME
      epRefClone.setReference(promotedReference);
      return epRefClone;
    } // end copyHigherReference
View Full Code Here

        componentReference.setInterfaceContract(interfaceContract);
        componentReference.setMultiplicity(Multiplicity.ONE_ONE);
        // component.getReferences().add(componentReference);
       
        // create endpoint reference
        EndpointReference endpointReference = assemblyFactory
                .createEndpointReference();
        endpointReference.setComponent(component);
        endpointReference.setReference(componentReference);
         endpointReference.setUnresolved(false);

        // create endpoint.
        Endpoint endpoint = assemblyFactory.createEndpoint();
        endpoint.setComponent(component);
        endpoint.setService(service);
        endpoint.setUnresolved(true);
        endpointReference.setTargetEndpoint(endpoint);
       
        componentReference.getEndpointReferences().add(endpointReference);
       
        // do binding matching
        endpointReferenceBuilder.build(endpointReference, monitor);
View Full Code Here

        ConversationSequence sequence = op.getConversationSequence();
        Object payload = msg.getBody();

        Object contextId = null;

        EndpointReference from = msg.getFrom();
        /* TODO - EPR - not required for OASIS
        ReferenceParameters parameters = null;
        if (from != null) {
            parameters = from.getReferenceParameters();
        }
View Full Code Here

        ref.getTargets().clear();
        ref.getBindings().clear();
        ref.getEndpointReferences().clear();
       
        // no access to the assembly factory so clone an existing epr
        EndpointReference callbackEndpointReference = (EndpointReference)reference.getEndpointReferences().get(0).clone();

        callbackEndpointReference.setReference(ref);
        callbackEndpointReference.setTargetEndpoint(callbackEndpoint);
        callbackEndpointReference.setUnresolved(true);
      
        // The callback endpoint will be resolved with the registry
        // when the wire chains are created
        ref.getEndpointReferences().add(callbackEndpointReference);
       
View Full Code Here

                    if (reference.getInterfaceContract() == null ||
                        interfaceContractMapper.isCompatible(reference.getInterfaceContract(),
                                                             targetComponentService.getInterfaceContract())) {
                        // create endpoint reference - with a dummy endpoint which will be replaced when policies
                        // are matched and bindings are configured later
                        EndpointReference endpointRef = createEndpointRef( component, reference, false  );
                        endpointRef.setTargetEndpoint( createEndpoint(targetComponent, targetComponentService, true) );
                        reference.getEndpointReferences().add(endpointRef);

                        // Stop with the first match for 0..1 and 1..1 references
                        if (multiplicity == Multiplicity.ZERO_ONE ||
                            multiplicity == Multiplicity.ONE_ONE) {
                            break;
                        } // end if
                    } // end if
                } // end for
            } // end for

            if (multiplicity == Multiplicity.ONE_N ||
                multiplicity == Multiplicity.ONE_ONE) {
                if (reference.getEndpointReferences().size() == 0) {
                    warning(monitor, "NoComponentReferenceTarget",
                            reference,
                            reference.getName());
                }
            }

        } else if (!refTargets.isEmpty()) {
            // Check that the component reference does not mix the use of endpoint references
          // specified via the target attribute with the presence of binding elements
            if( bindingsIdentifyTargets( reference ) ) {
                warning(monitor, "ReferenceEndPointMixWithTarget",
                        composite, composite.getName().toString(), component.getName(), reference.getName());
            }

            // Resolve targets specified on the component reference
            for (ComponentService target : refTargets) {

                String targetName = target.getName();
                ComponentService targetComponentService = componentServices.get(targetName);

                Component targetComponent = getComponentFromTargetName( components, targetName );

                if (targetComponentService != null) {
                    // Check that target component service provides a superset of the component reference interface
                    if (reference.getInterfaceContract() == null ||
                        interfaceContractMapper.isCompatible(reference.getInterfaceContract(),
                                                             targetComponentService.getInterfaceContract())) {

                        // create endpoint reference -  with dummy endpoint which will be replaced when policies
                        // are matched and bindings are configured later
                        EndpointReference endpointRef = createEndpointRef( component, reference, false  );
                        endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true));
                        reference.getEndpointReferences().add(endpointRef);
                    } else {
                        warning(monitor, "ReferenceIncompatibleInterface",
                                composite,
                                composite.getName().toString(),
                                component.getName() + "." + reference.getName(),
                                targetName);
                    }
                } else {
                    // add an unresolved endpoint reference with an unresolved endpoint to go with it
                    EndpointReference endpointRef = createEndpointRef( component, reference, true  );
                    endpointRef.setTargetEndpoint(createEndpoint(component, targetName));
                    endpointRef.setIsRemoteReference(true);
                    reference.getEndpointReferences().add(endpointRef);
                    warning(monitor, "ComponentReferenceTargetNotFound",
                            composite,
                            composite.getName().toString(),
                            targetName);
                } // end if
            } // end for
        } // end if

        // if no endpoints have found so far the bindings hold the targets.
        if (reference.getEndpointReferences().isEmpty()) {
            for (Binding binding : reference.getBindings()) {

                String uri = binding.getURI();

                // user hasn't put a uri on the binding so it's not a target name and the assumption is that
                // the target is established via configuration of the binding element itself
                if (uri == null) {
                  // Regular forward references are UNWIRED with no endpoint if they have an SCABinding with NO targets
                  // and NO URI set - but Callbacks with an SCABinding are wired and need an endpoint
                  if( !reference.isCallback() && (binding instanceof SCABinding) ) continue;

                    // create endpoint reference for manually configured bindings with a resolved endpoint to
                  // signify that this reference is pointing at some unwired endpoint
                    EndpointReference endpointRef = createEndpointRef( component, reference,
                        binding, null, false  );
                    endpointRef.setTargetEndpoint(createEndpoint(false));
                    endpointRef.setIsRemoteReference(true);
                    reference.getEndpointReferences().add(endpointRef);
                    continue;
                } // end if

                // user might have put a local target name in the uri - see if it refers to a target we know about
                // - if it does the reference binding will be matched with a service binding
                // - if it doesn't it is assumed to be an external reference
                if (uri.startsWith("/")) {
                    uri = uri.substring(1);
                }

                // Resolve the target component and service
                ComponentService targetComponentService = componentServices.get(uri);
                Component targetComponent = getComponentFromTargetName( components, uri );

                // If the binding URI matches a component in the composite, configure an endpoint reference with
                // this component as the target.
                // If not, the binding URI is assumed to reference an external service
                if (targetComponentService != null) {

                    // Check that the target component service provides
                    // a superset of the component reference interface
                    if (reference.getInterfaceContract() == null ||
                        interfaceContractMapper.isCompatible(reference.getInterfaceContract(),
                                                             targetComponentService.getInterfaceContract())) {
                        // create endpoint reference with dummy endpoint which will be replaced when policies
                        // are matched and bindings are configured later
                        EndpointReference endpointRef = createEndpointRef( component, reference, binding, null, false  );
                        endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true));
                        reference.getEndpointReferences().add(endpointRef);
                    } else {
                        warning(monitor, "ReferenceIncompatibleInterface",
                                composite,
                                composite.getName().toString(),
                                reference.getName(),
                                uri);
                    }
                } else {
                    // create endpoint reference for manually configured bindings with resolved endpoint
                  // to signify that this reference is pointing at some unwired endpoint
                    EndpointReference endpointRef = createEndpointRef( component, reference, binding, null, false  );
                    endpointRef.setTargetEndpoint(createEndpoint( false ));
                    endpointRef.setIsRemoteReference(true);
                    reference.getEndpointReferences().add(endpointRef);
                } // end if
            }
        }
    } // end method
View Full Code Here

              unresolved = true;
            } else {
              unresolved = false;
            } // end if
            // Create an EndpointReference pointing at the endpoint
            EndpointReference endRef =  createEndpointRef( leafComponent, leafReference,
                                       endpoint.getBinding(), endpoint, unresolved);
            // Add the EndpointReference to the top level AND the leaf level reference, if not the same!!
            if( useNew ) {
              leafReference.getEndpointReferences().add( endRef );
              if( leafReference != reference ) {
View Full Code Here

     * @param unresolved
     * @return the endpoint reference
     */
    private EndpointReference createEndpointRef( Component component, ComponentReference reference,
        Binding binding, Endpoint endpoint, boolean unresolved  ) {
      EndpointReference endpointRef = createEndpointRef( component, reference, unresolved  );
        endpointRef.setBinding(binding);
        endpointRef.setTargetEndpoint(endpoint);
        return endpointRef;
    } // end method
View Full Code Here

     * @param reference
     * @param unresolved
     * @return the endpoint reference
     */
    private EndpointReference createEndpointRef( Component component, ComponentReference reference, boolean unresolved  ) {
      EndpointReference endpointRef = assemblyFactory.createEndpointReference();
      endpointRef.setComponent(component);
      endpointRef.setReference(reference);
      endpointRef.setUnresolved(unresolved);
      return endpointRef;
    } // end method createEndpointRef
View Full Code Here

TOP

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

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.