public Binding getBinding(String name) { for (Binding binding : bindings) { if (binding.getName().equals(name)) { return binding; } } return null; }
public Binding getBinding(String name) { for (Binding binding : bindings) { if (binding.getName().equals(name)) { return binding; } } return null; }
public Binding getBinding(String name) { for (Binding binding : bindings) { if (binding.getName().equals(name)) { return binding; } } return null; }
public Binding getBinding(String name) { for (Binding binding : bindings) { if (binding.getName().equals(name)) { return binding; } } return null; }
private void configureBindings(Contract componentContract, Contract componentTypeContract, BuilderContext context) { if (componentTypeContract == null) { return; } Map<String, Binding> componentTypeContractBindings = new HashMap<String, Binding>(); for (Binding binding : componentTypeContract.getBindings()) { componentTypeContractBindings.put(binding.getName(), binding); } for (Binding binding : componentContract.getBindings()) { Binding componentTypeBinding = componentTypeContractBindings.get(binding.getName()); if (binding instanceof PolicySubject && componentTypeBinding instanceof PolicySubject) { configure((PolicySubject)binding, (PolicySubject)componentTypeBinding, Intent.Type.interaction, context); } } }
private void configureBindings(Contract componentContract, Contract componentTypeContract, BuilderContext context) { if (componentTypeContract == null) { return; } Map<String, Binding> componentTypeContractBindings = new HashMap<String, Binding>(); for (Binding binding : componentTypeContract.getBindings()) { componentTypeContractBindings.put(binding.getName(), binding); } for (Binding binding : componentContract.getBindings()) { Binding componentTypeBinding = componentTypeContractBindings.get(binding.getName()); if (binding instanceof PolicySubject && componentTypeBinding instanceof PolicySubject) { configure((PolicySubject)binding, (PolicySubject)componentTypeBinding, Intent.Type.interaction, context); } } }
/** * Select an endpoint reference from the component reference * @param ref * @return */ private Endpoint getEndpoint(ComponentService service, String bindingName) { if (bindingName == null) { // The default binding name is the name of the promoted service bindingName = getPromotedService(service).getName(); } Endpoint returnEp = null; List<Endpoint> eps = service.getEndpoints(); for (Endpoint ep : eps) { Binding binding = ep.getBinding(); if (bindingName.equals(binding.getName()) || binding.getName() == null) { returnEp = ep; break; } } //TUSCANY-3543 if (returnEp == null) { returnEp = eps.get(0); } return returnEp; }
protected Binding getBinding(Contract contract, String name, boolean isCallback) { List<Binding> bindings = null; if ( isCallback ) { bindings = contract.getCallback().getBindings(); } else { bindings = contract.getBindings(); } for (Binding binding : bindings) { if (name.equals(binding.getName())) { return binding; } } return null; }
protected Binding getBinding(Contract contract, String name, boolean isCallback) { List<Binding> bindings = null; if ( isCallback ) { bindings = contract.getCallback().getBindings(); } else { bindings = contract.getBindings(); } for (Binding binding : bindings) { if (name.equals(binding.getName())) { return binding; } } return null; }
private RuntimeEndpointReference selectCallbackWire( org.apache.tuscany.sca.assembly.Endpoint endpoint, RuntimeComponentReference componentReference) { // Look for callback binding with same name as service binding if (endpoint == null) { throw new RuntimeException("Destination for forward call is not available"); } for (EndpointReference epr : componentReference.getEndpointReferences()) { if (epr.getBinding().getName().equals(endpoint.getBinding().getName())) { return (RuntimeEndpointReference) epr; } } // if no match, look for callback binding with same type as service binding for (EndpointReference epr : componentReference.getEndpointReferences()) { if (epr.getBinding().getType().equals(endpoint.getBinding().getType())) { return (RuntimeEndpointReference) epr; } } // no suitable callback wire was found return null; } // end method selectCallbackWire
public synchronized Endpoint getEndpoint(String uri) { for (Endpoint ep : endpoints) { String epURI = ep.getComponent().getURI() + "#" + ep.getService().getName() + "/" + ep.getBinding().getName(); if (epURI.equals(uri)) { return ep; } if (ep.getBinding().getName() == null || ep.getBinding().getName().equals(ep.getService().getName())) { epURI = ep.getComponent().getURI() + "#" + ep.getService().getName(); if (epURI.equals(uri)) { return ep; } } } return null; }
private RuntimeEndpointReference selectCallbackEPR(Message msgContext) { // look for callback binding with same name as service binding Endpoint to = msgContext.getTo(); if (to == null) { //FIXME: need better exception throw new ServiceRuntimeException("Destination for forward call is not available"); } for (EndpointReference epr : callbackEPRs) { if (epr.getBinding().getName().equals(to.getBinding().getName())) { return (RuntimeEndpointReference) epr; } } // if no match, look for callback binding with same type as service binding for (EndpointReference epr : callbackEPRs) { if (epr.getBinding().getType().equals(to.getBinding().getType())) { return (RuntimeEndpointReference) epr; } } // no suitable callback wire was found return null; }
if (bindingName == null || bindingName.equals(ep.getBinding().getName())) { return ep.getDeployedURI();
public String getURI() { if (uri == null) { if (component != null && reference != null && binding != null) { String bindingName = binding.getName(); if (bindingName == null) { bindingName = reference.getName(); } uri = component.getURI() + "#reference-binding(" + reference.getName() + "/" + bindingName + ")"; } else if (component != null && reference != null) { uri = component.getURI() + "#reference(" + reference.getName() + ")"; } else if (component != null) { uri = component.getURI(); } } return uri; }
public String getURI() { if (uri == null) { if (component != null && service != null && binding != null) { String bindingName = binding.getName(); if (bindingName == null) { bindingName = service.getName(); } uri = component.getURI() + "#service-binding(" + service.getName() + "/" + bindingName + ")"; } else if (component != null && service != null) { uri = component.getURI() + "#service(" + service.getName() + ")"; } else if (component != null) { uri = component.getURI(); } } return uri; }
public String getURI() { if (uri == null) { if (component != null && reference != null && binding != null) { String bindingName = binding.getName(); if (bindingName == null) { bindingName = reference.getName(); } uri = component.getURI() + "#reference-binding(" + reference.getName() + "/" + bindingName + ")"; } else if (component != null && reference != null) { uri = component.getURI() + "#reference(" + reference.getName() + ")"; } else if (component != null) { uri = component.getURI(); } } return uri; }
public String getURI() { if (uri == null) { if (component != null && service != null && binding != null) { String bindingName = binding.getName(); if (bindingName == null) { bindingName = service.getName(); } uri = component.getURI() + "#service-binding(" + service.getName() + "/" + bindingName + ")"; } else if (component != null && service != null) { uri = component.getURI() + "#service(" + service.getName() + ")"; } else if (component != null) { uri = component.getURI(); } } return uri; }
Endpoint ep = endpointFinder.findEndpoint(domainRegistry, serviceURI); if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { String serviceName = ep.getService().getName() + '/' + ep.getBinding().getName(); return ((RuntimeComponent)ep.getComponent()).getServiceReference(serviceInterface, serviceName).getService();
protected Binding map(Binding scaBinding, QName newBindingType) { try { Binding binding = createDelegatingBinding(newBindingType); binding.setName(scaBinding.getName()); if (((SCABinding)scaBinding).getDelegateBindingURI() != null){ // if this is an SCA binding that's been resolved via the registry then // the URI of the target service is delegate specific and is stored // in this new slot in the binding model binding.setURI(((SCABinding)scaBinding).getDelegateBindingURI()); } else { binding.setURI(scaBinding.getURI()); } binding.setOperationSelector(scaBinding.getOperationSelector()); binding.setRequestWireFormat(scaBinding.getRequestWireFormat()); binding.setResponseWireFormat(scaBinding.getResponseWireFormat()); if (binding instanceof PolicySubject && scaBinding instanceof PolicySubject) { PolicySubject subject1 = (PolicySubject)binding; PolicySubject subject2 = (PolicySubject)scaBinding; subject1.getPolicySets().addAll(subject2.getPolicySets()); subject1.getRequiredIntents().addAll(subject2.getRequiredIntents()); } return binding; } catch (Throwable e) { throw new ServiceRuntimeException(e); } }
protected Binding map(Binding scaBinding, QName newBindingType) { try { Binding binding = createDelegatingBinding(newBindingType); binding.setName(scaBinding.getName()); if (((SCABinding)scaBinding).getDelegateBindingURI() != null){ // if this is an SCA binding that's been resolved via the registry then // the URI of the target service is delegate specific and is stored // in this new slot in the binding model binding.setURI(((SCABinding)scaBinding).getDelegateBindingURI()); } else { binding.setURI(scaBinding.getURI()); } binding.setOperationSelector(scaBinding.getOperationSelector()); binding.setRequestWireFormat(scaBinding.getRequestWireFormat()); binding.setResponseWireFormat(scaBinding.getResponseWireFormat()); if (binding instanceof PolicySubject && scaBinding instanceof PolicySubject) { PolicySubject subject1 = (PolicySubject)binding; PolicySubject subject2 = (PolicySubject)scaBinding; subject1.getPolicySets().addAll(subject2.getPolicySets()); subject1.getRequiredIntents().addAll(subject2.getRequiredIntents()); } return binding; } catch (Throwable e) { throw new ServiceRuntimeException(e); } }