public boolean isOutOfDate(EndpointReference endpointReference) { return ! findEndpoint(endpointReference).contains(endpointReference.getTargetEndpoint()); }
public boolean isOutOfDate(EndpointReference endpointReference) { return ! findEndpoint(endpointReference).contains(endpointReference.getTargetEndpoint()); }
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>(); }
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>(); }
public String createJavascriptReference(ComponentReference componentReference) throws IOException { EndpointReference epr = componentReference.getEndpointReferences().get(0); Endpoint targetEndpoint = epr.getTargetEndpoint(); if (targetEndpoint.isUnresolved()) { //force resolution and targetEndpoint binding calculations //by calling the getInvocationChain ((RuntimeEndpointReference) epr).getInvocationChains(); targetEndpoint = epr.getTargetEndpoint(); } Binding binding = targetEndpoint.getBinding(); URI targetURI = URI.create(binding.getURI()); String targetPath = targetURI.getPath(); return "tuscany.AtomService(\"" + targetPath + "\")"; }
public String createJavascriptReference(ComponentReference componentReference) throws IOException { EndpointReference epr = componentReference.getEndpointReferences().get(0); Endpoint targetEndpoint = epr.getTargetEndpoint(); if (targetEndpoint.isUnresolved()) { //force resolution and targetEndpoint binding calculations //by calling the getInvocationChain ((RuntimeEndpointReference) epr).getInvocationChains(); targetEndpoint = epr.getTargetEndpoint(); } Binding binding = targetEndpoint.getBinding(); URI targetURI = URI.create(binding.getURI()); String targetPath = targetURI.getPath(); return "tuscany.RestService(\"" + targetPath + "\")"; }
Endpoint targetEndpoint = epr.getTargetEndpoint(); if (targetEndpoint.isUnresolved()) { targetEndpoint = epr.getTargetEndpoint();
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
for(ComponentReference reference : component.getReferences()) { for(EndpointReference epr : reference.getEndpointReferences()) { Endpoint targetEndpoint = epr.getTargetEndpoint(); if (targetEndpoint.isUnresolved()) { targetEndpoint = epr.getTargetEndpoint();
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
protected Destination getRequestDestination(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Session session) throws JMSBindingException, NamingException, JMSException { Destination requestDestination = null; if (endpointReference.getReference().isForCallback()) { // Check if the CallbackDestinationInterceptor set a callback destination from the request msg if (tuscanyMsg.getFrom().getTargetEndpoint() != null) { if (tuscanyMsg.getFrom().getTargetEndpoint().getBinding() != null) { this.jmsBinding = (JMSBinding)tuscanyMsg.getFrom().getTargetEndpoint().getBinding(); /* TUSCANY-4011 - we could delay until this point until setting the callback destination CallbackHandler callbackHandler = (CallbackHandler)tuscanyMsg.getHeaders().get(Constants.CALLBACK); if (callbackHandler != null && callbackHandler.getCallbackTargetURI() != null){ this.jmsBinding.setDestinationName(callbackHandler.getCallbackTargetURI()); } */ requestDestination = lookupDestination(); } } } if (requestDestination == null) { requestDestination = bindingRequestDest; } return requestDestination; }
/** * Checks to see if the registry has been updated since the reference was last matched * * @return true is the registry has changed */ public boolean isOutOfDate(DomainRegistry domainRegistry, EndpointReference endpointReference) { Endpoint te = endpointReference.getTargetEndpoint(); if (te != null && !te.isUnresolved() && te.getURI() != null && endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING) { return domainRegistry.isOutOfDate(endpointReference); } return false; }
public boolean build(EndpointReference endpointReference, BuilderContext context) { boolean ok = checkMutualExclusion(endpointReference, context); if(!ok) { return false; } Endpoint endpoint = endpointReference.getTargetEndpoint(); if (endpoint == null) { return true; } ok = checkMutualExclusion(endpointReference, endpoint, context); List<Intent> intentList1 = endpointReference.getRequiredIntents(); List<Intent> intentList2 = endpoint.getRequiredIntents(); return ok; }
public boolean build(EndpointReference endpointReference, BuilderContext context) { boolean ok = checkMutualExclusion(endpointReference, context); if(!ok) { return false; } Endpoint endpoint = endpointReference.getTargetEndpoint(); if (endpoint == null) { return true; } ok = checkMutualExclusion(endpointReference, endpoint, context); List<Intent> intentList1 = endpointReference.getRequiredIntents(); List<Intent> intentList2 = endpoint.getRequiredIntents(); return ok; }
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; } }
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; } }
/** * Get the Runtime Wire for the supplied reference * @param componentReference - the reference * @return - the RuntimeWire - null if it cannot be found */ private RuntimeEndpointReference getEndpointReference( RuntimeComponentReference componentReference, PartnerRoleMessageExchange mex) { if( componentReference.isForCallback() ) { // Where there is a callback, it is necessary to create a specialized wire, based on callback information // present on the forward call // Get the callbackEPR for the callback using the BPEL Process ID and the Reference name // - which is the same name as the service name for a callback Long processID = _server.getProcessIDFromMex(mex.getMessageExchangeId()); org.apache.tuscany.sca.assembly.EndpointReference callbackEPR = _server.getCallbackMetadata(processID, componentReference.getName()); RuntimeEndpointReference wire = selectCallbackWire( callbackEPR.getTargetEndpoint(), componentReference ); wire = clone_bind( componentReference, callbackEPR.getCallbackEndpoint() ); return wire; } else { // No callback case... //TODO - fix the x..n multiplicity case, which needs to select the correct ONE of multiple // EndpointReferences here return (RuntimeEndpointReference) componentReference.getEndpointReferences().get(0); } // end if } // end method getEndpointReference