private void build(EndpointReference endpointReference) { BindingBuilder builder = builders.getBindingBuilder(endpointReference.getBinding().getType()); if (builder != null) { builder.build(endpointReference.getComponent(), endpointReference.getReference(), endpointReference.getBinding(), new BuilderContext(extensionPoints), false); } }
public boolean isOutOfDate(EndpointReference endpointReference) { return ! findEndpoint(endpointReference).contains(endpointReference.getTargetEndpoint()); }
private RuntimeEndpointReference clone_bind(RuntimeComponentReference reference, org.apache.tuscany.sca.assembly.Endpoint callbackEndpoint) { try { // clone the callback reference ready to configure it for this callback endpoint RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone(); ref.getTargets().clear(); ref.getBindings().clear(); ref.getEndpointReferences().clear(); // clone epr EndpointReference callbackEndpointReference = (EndpointReference)reference.getEndpointReferences().get(0).clone(); callbackEndpointReference.setReference(ref); callbackEndpointReference.setTargetEndpoint(callbackEndpoint); callbackEndpointReference.setUnresolved(true); // The callback endpoint will be resolved when the wire chains are created ref.getEndpointReferences().add(callbackEndpointReference); return (RuntimeEndpointReference) ref.getEndpointReferences().get(0); } catch ( CloneNotSupportedException e ) { return null; } // end try clone_bind } // end method
public RMIReferenceBindingProvider(EndpointReference endpointReference, RMIHost rmiHost) { this.reference = (RuntimeComponentReference)endpointReference.getReference(); this.binding = (RMIBinding)endpointReference.getBinding(); this.rmiHost = rmiHost; }
/** * Helper method to create an Endpoint Reference * @param component * @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
/** * Helper method to create an Endpoint Reference * @param component * @param reference * @param binding * @param endpoint * @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
ComponentReference reference = component.getReferences().get(0); Binding binding = reference.getBindings().get(0); endpointReference.setComponent(component); endpointReference.setReference(reference); reference.getEndpointReferences().add(endpointReference); endpointReference.setBinding(binding); endpointReference.setTargetEndpoint(endpoint); endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); endpointReference.setUnresolved(true); } else { endpoint.setUnresolved(false); endpoint.setBinding(reference.getBindings().get(0)); endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING); endpointReference.setUnresolved(false);
if (endpointReference.getStatus() == EndpointReference.Status.AUTOWIRE_PLACEHOLDER){ Multiplicity multiplicity = endpointReference.getReference().getMultiplicity(); for (Endpoint endpoint : domainRegistry.getEndpoints()){ (endpointReference.getReference().getEndpointReferences().size() > 1)) { break; if (endpointReference.getComponent() == endpoint.getComponent()) { continue; for (EndpointReference epr : endpointReference.getReference().getEndpointReferences()){ if (epr.getTargetEndpoint() == endpoint){ autowireEndpoint = endpoint; break; autowireEndpointRefrence = (EndpointReference)endpointReference.clone(); } catch (Exception ex){ autowireEndpointRefrence.setTargetEndpoint(endpoint); autowireEndpointRefrence.setBinding(endpoint.getBinding()); autowireEndpointRefrence.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); endpointReference.getReference().getEndpointReferences().add(autowireEndpointRefrence); if (endpointReference.getReference().getEndpointReferences().size() == 1) { Monitor.error(monitor, this, "endpoint-validation-messages",
if (endpointReference.getReference().getName().startsWith("$self$.")){ if (endpointReference.getTargetEndpoint() != null && !endpointReference.getTargetEndpoint().isUnresolved()) { matchedEndpoint = endpointReference.getTargetEndpoint(); } else { matchedEndpoint = endpoints.get(0); if (endpointReference.getTargetEndpoint().getService() == null && endpointReference.getTargetEndpoint().getBinding() == null && matchedEndpoints.size() > 1 ) { "TooManyTargetServices", endpointReference.toString(), endpointReference.getTargetEndpoint().toString(), matchAudit); throw new ServiceRuntimeException("Unable to bind " + "TooManyTargetServices", endpointReference.toString(), endpointReference.getTargetEndpoint().toString()); return; if (endpointReference.getBinding() != null && endpointReference.getBinding() instanceof SCABinding ){ for (Endpoint endpoint : matchedEndpoints){ if (endpoint.getBinding() instanceof SCABinding){ return; } else {
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }
CompositeContext compositeContext = ((RuntimeComponent)epr.getComponent()).getComponentContext().getCompositeContext(); Composite domainComposite = compositeContext.getDomainComposite(); Definitions systemDefinitions = compositeContext.getSystemDefinitions(); epr.getReference().getBindings().add(epr.getTargetEndpoint().getBinding()); epr.getReference().getBindings().remove(epr.getTargetEndpoint().getBinding()); for (PolicySet ps : new ArrayList<PolicySet>(epr.getPolicySets()) ) { if ( epr.getBinding() instanceof PolicySubject ) { if (isApplicableToSubject(document, appliesToSubjects, domainComposite, (PolicySubject)epr.getBinding(), ps)) continue; if (isApplicableToSubject(document, appliesToSubjects, domainComposite, epr.getReference(), ps)) continue; else if ( (epr.getReference().getInterfaceContract() != null) && (isApplicableToSubject(document, appliesToSubjects, domainComposite, epr.getReference().getInterfaceContract().getInterface(), ps))) continue; else if ( isApplicableToSubject(document, appliesToSubjects, domainComposite, epr.getComponent(), ps)) continue; else if ( isApplicableToSubject(document, appliesToSubjects, domainComposite, domainComposite, ps)) continue; else epr.getPolicySets().remove(ps);
private void processUnknownEndpoint(EndpointReference endpointReference, Audit matchAudit){ Binding b = null; if (unknownEndpointHandler != null) { b = unknownEndpointHandler.handleUnknownEndpoint(endpointReference); } if (b != null) { Endpoint matchedEndpoint = new RuntimeEndpointImpl(extensionPoints); matchedEndpoint.setBinding(b); matchedEndpoint.setRemote(true); endpointReference.setTargetEndpoint(matchedEndpoint); endpointReference.setBinding(b); endpointReference.setUnresolved(false); endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); matchAudit.append("Match because the UnknownEndpointHandler provided a binding: " + b.getType() + " uri: " + b.getURI()); matchAudit.appendSeperator(); } }
if(loopCallbackEndpoint.getBinding().getType().equals(endpointReference.getBinding().getType())){ callbackEndpoint = (RuntimeEndpoint)loopCallbackEndpoint; break match1; callbackEndpoint.setComponent(endpointReference.getComponent()); callbackEndpoint.setService(callbackService); Binding forwardBinding = endpointReference.getBinding(); Binding callbackBinding = null; Callback serviceCallback = endpointReference.getTargetEndpoint().getService().getCallback(); if(loopCallbackBinding.getType().equals(endpointReference.getBinding().getType())){ callbackBinding = loopCallbackBinding; break; ComponentReference callbackReference = endpointReference.getTargetEndpoint().getService().getCallbackReference(); if (loopEndpointReference.getBinding().getType().equals(endpointReference.getBinding().getType())){ callbackBinding = loopEndpointReference.getBinding(); break; endpointReference.setCallbackEndpoint(callbackEndpoint);
endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true)); endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); endpointRef.setTargetEndpoint(createEndpoint(component, target.getName())); endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); Binding binding = reference.getBindings().get(0); if ((binding instanceof SCABinding) && (binding.getURI() == null)){ endpointRef.setBinding(binding); endpointRef.setTargetEndpoint(createEndpoint(true)); endpointRef.setStatus(EndpointReference.Status.NOT_CONFIGURED); } else { endpointRef.setTargetEndpoint(createEndpoint(false)); endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); endpointRef.setTargetEndpoint(createEndpoint(false)); endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); reference.getEndpointReferences().add(endpointRef); continue; endpointRef.setBinding(binding); endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI); } else {
/** * If there is a callback address, create an EPR for the callback with a referenced endpoint that contains * the binding and the target callback address * @param callbackAddress - the callback address - may be null * @param inMC - the Axis incoming message context * @param msg - the Tuscany message * @throws AxisFault - if the callback address has any of the disallowed forms of callback address */ private void createCallbackEPR( String callbackAddress, MessageContext inMC, Message msg ) throws AxisFault { if (callbackAddress != null ) { // Check for special (& not allowed!) WS_Addressing values checkCallbackAddress( callbackAddress, inMC ); // EndpointReference from = assemblyFactory.createEndpointReference(); Endpoint fromEndpoint = assemblyFactory.createEndpoint(); from.setTargetEndpoint(fromEndpoint); from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); msg.setFrom(from); RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint(); // WebServiceBinding cbBinding = webServiceBindingFactory.createWebServiceBinding(); cbBinding.setURI(callbackAddress); callbackEndpoint.setBinding(cbBinding); // callbackEndpoint.setURI(callbackAddress); callbackEndpoint.setUnresolved(true); from.setCallbackEndpoint(callbackEndpoint); } // end if } // end method createCallbackEPR
public Message invokeRequest(Message msg) { EndpointReference from = assemblyFactory.createEndpointReference(); Endpoint fromEndpoint = assemblyFactory.createEndpoint(); from.setTargetEndpoint(fromEndpoint); from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); msg.setFrom(from); return msg; } // end method invokeRequest
/** * Copy a higher level EndpointReference down to a lower level reference which it promotes * @param epRef - the endpoint reference * @param promotedReference - the promoted reference * @return - a copy of the EndpointReference with data merged from the promoted reference */ private EndpointReference copyHigherReference(EndpointReference epRef, ComponentReference promotedReference) { EndpointReference epRefClone = null; try { epRefClone = (EndpointReference)epRef.clone(); } catch (Exception e) { throw new ServiceRuntimeException(e); } // end try // Copy across details of the inner reference //ComponentReference ref = epRefClone.getReference(); //FIXME epRefClone.setReference(promotedReference); return epRefClone; }
public List<Endpoint> findEndpoint(EndpointReference endpointReference) { logger.fine("Find endpoint for reference - " + endpointReference); if (endpointReference.getReference() != null) { Endpoint targetEndpoint = endpointReference.getTargetEndpoint(); String uri = targetEndpoint.getURI(); // [rfeng] This is a workaround to deal with the case that the endpoint URI doesn't have the // service name to avoid confusion between structural URIs and service URIs if (uri.indexOf('#') == -1) { uri = uri + "#service()"; } return findEndpoint(uri); } return new ArrayList<Endpoint>(); }
for ( ComponentReference reference : component.getReferences() ) { for ( EndpointReference epr : reference.getEndpointReferences() ) { for ( Intent eprIntent : epr.getRequiredIntents() ) { if ( Constants.TRANSACTED_ONE_WAY_INTENT.equals(eprIntent.getName())) { error(context.getMonitor(), this, "reference", epr.getComponent().getName(), epr.getReference().getName()); } else if ( Constants.PROPAGATES_TRANSACTION_INTENT.equals(eprIntent.getName())) { error(context.getMonitor(), this, "reference", epr.getComponent().getName(), epr.getReference().getName()); for ( Intent eprIntent : epr.getRequiredIntents() ) { if ( Constants.PROPAGATES_TRANSACTION_INTENT.equals(eprIntent.getName())) { error(context.getMonitor(), this, "reference", epr.getComponent().getName(), epr.getReference().getName()); for ( Intent eprIntent : epr.getRequiredIntents() ) { if ( Constants.TRANSACTED_ONE_WAY_INTENT.equals(eprIntent.getName()) ) {
@Override public InterfaceContract getBindingInterfaceContract() { return endpoint.getReference().getInterfaceContract(); }