private void build(Endpoint endpoint) { BindingBuilder builder = builders.getBindingBuilder(endpoint.getBinding().getType()); if (builder != null) { builder.build(endpoint.getComponent(), endpoint.getService(), endpoint.getBinding(), new BuilderContext(extensionPoints), true); } }
public synchronized void addEndpoint(Endpoint endpoint) { endpoints.add(endpoint); for (EndpointListener listener : listeners) { listener.endpointAdded(endpoint); } if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { String uri = null; Binding b = endpoint.getBinding(); if (b != null) { uri = b.getURI(); if (uri != null && uri.startsWith("/")) { uri = uri.substring(1); } } String msg = "Add endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - " + uri); if (quietLogging) { logger.fine(msg); } else { logger.info(msg); } } }
ComponentService service = component.getServices().get(0); Binding binding = service.getBindings().isEmpty() ? null : service.getBindings().get(0); endpoint.setComponent(component); endpoint.setService(service); endpoint.setBinding(binding); endpoint.getRequiredIntents().addAll(component.getRequiredIntents()); endpoint.getPolicySets().addAll(component.getPolicySets());
/** * 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; }
if (endpoint.getService() != null && endpoint.getService().isForCallback()){ composite.setName(CALLBACK_ENDPOINT_QNAME); } else { if (endpoint.getComponent() != null) { Component component = (Component)endpoint.getComponent().clone(); component.setImplementation(null); composite.getComponents().add(component); component.getRequiredIntents().addAll(endpoint.getRequiredIntents()); component.getPolicySets().clear(); component.getPolicySets().addAll(endpoint.getPolicySets()); if (endpoint.getService() != null) { ComponentService service = (ComponentService)endpoint.getService().clone(); component.getServices().add(service); service.getBindings().clear(); service.setInterfaceContract(endpoint.getComponentServiceInterfaceContract()); if (endpoint.getBinding() != null) { Binding binding = (Binding)endpoint.getBinding().clone(); service.getBindings().add(binding);
private static Class<?> findInterface(Endpoint endpoint, DomainRegistry domainRegistry) throws MalformedURLException, ClassNotFoundException { Interface iface = endpoint.getService().getInterfaceContract().getInterface(); if (iface instanceof JavaInterface) { String curi = domainRegistry.getContainingCompositesContributionURI(endpoint.getComponent().getName()); if (curi != null) { ContributionDescription ic = domainRegistry.getInstalledContribution(curi); ClassLoader cl = new URLClassLoader(new URL[]{new URL(ic.getURL())}, Remotable.class.getClassLoader()); return cl.loadClass(((JavaInterface)iface).getName()); } } return null; } }
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 + "\")"; }
endpoint.getComponent()) { continue; autowireEndpointRefrence.setBinding(endpoint.getBinding()); autowireEndpointRefrence.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); endpointReference.getReference().getEndpointReferences().add(autowireEndpointRefrence); || endpointReference.getCallbackEndpoint().isUnresolved())) { selectCallbackEndpoint(endpointReference, endpointReference.getReference().getCallbackService(), endpointReference.getTargetEndpoint().getService().getEndpoints(), matchAudit, builderContext, endpointReference.getTargetEndpoint().setBinding(endpointReference.getBinding()); endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING); } else { if (endpointReference.getTargetEndpoint().getBinding() == null) { endpointReference.getTargetEndpoint().setBinding(endpointReference.getBinding());
private RuntimeEndpoint getEndpoint(Binding targetBinding) { for(Endpoint ep: service.getEndpoints()) { if(ep.getBinding() == targetBinding) { return (RuntimeEndpoint) ep; } } return endpoint; }
while (iterator.hasNext()){ Endpoint ep = iterator.next(); if (ep.getService().isForCallback()){ iterator.remove(); ComponentService firstService = eps.get(0).getService(); for (int i=1; i<eps.size(); i++) { if (firstService != eps.get(i).getService()) throw new ServiceRuntimeException("More than one service is declared on component " + serviceName + ". Service name is required to get the service."); if (SCABinding.TYPE.equals(ep.getBinding().getType())) { return ep;
if (endpointReference.getTargetEndpoint() != null && !endpointReference.getTargetEndpoint().isUnresolved()) { matchedEndpoint = endpointReference.getTargetEndpoint(); } else { if (endpointReference.getTargetEndpoint().getService() == null && endpointReference.getTargetEndpoint().getBinding() == null && matchedEndpoints.size() > 1 ) { !endpoint.getService().getName().equals("default")){ serviceName = endpoint.getService().getName(); !endpoint.getService().getName().equals("default") && !endpoint.getService().getName().equals(serviceName)){ if (runtime){ Monitor.error(monitor, endpointReference.getBinding() instanceof SCABinding ){ for (Endpoint endpoint : matchedEndpoints){ if (endpoint.getBinding() instanceof SCABinding){ matchedEndpoint = endpoint; break; } else { endpointReference.setTargetEndpoint(matchedEndpoint); Binding binding = matchedEndpoint.getBinding(); try { endpointReference.setBinding((Binding)binding.clone()); endpointReference.getPolicySets().addAll(matchedEndpoint.getPolicySets());
public void addEndpoint(Endpoint endpoint) { map.put(endpoint.getURI(), endpoint); logger.info("Add endpoint - " + endpoint); }
private String getToAddress(Message msg) throws ServiceRuntimeException { String address = null; // if target endpoint was not specified when this invoker was created, // use dynamically specified target endpoint passed in with the message String to = getPortLocation(); if (to == null) { Endpoint ep = msg.getTo(); if (ep != null && ep.getBinding() != null) { address = ep.getDeployedURI(); } else { throw new ServiceRuntimeException( "[BWS20025] Unable to determine destination endpoint for endpoint reference " + endpointReference); } } else { address = to; } return address; } // end method getToAddress
for ( Intent epIntent : ep.getRequiredIntents() ) { if ( Constants.TRANSACTED_ONE_WAY_INTENT.equals(epIntent.getName())) { error(context.getMonitor(), this, "service", ep.getComponent().getName(), ep.getService().getName()); } else if ( Constants.PROPAGATES_TRANSACTION_INTENT.equals(epIntent.getName())) { error(context.getMonitor(), this, "service", ep.getComponent().getName(), ep.getService().getName()); for ( ComponentService service : component.getServices() ) { for ( Endpoint ep : service.getEndpoints() ) { for ( Intent epIntent : ep.getRequiredIntents() ) { if ( Constants.PROPAGATES_TRANSACTION_INTENT.equals(epIntent.getName())) { error(context.getMonitor(), this, "service", ep.getComponent().getName(), ep.getService().getName());
for (Intent intent : endpoint.getRequiredIntents()){ Intent resolvedIntent = PolicyHelper.getIntent(systemDefinitions, intent.getName()); } else { BindingType bindingType = systemDefinitions.getBindingType(endpoint.getBinding().getType()); endpoint.getRequiredIntents().clear(); endpoint.getRequiredIntents().addAll(intents); for (PolicySet policySet : endpoint.getPolicySets()){ PolicySet resolvedPolicySet = PolicyHelper.getPolicySet(systemDefinitions, policySet.getName()); if (resolvedPolicySet != null){ endpoint.getPolicySets().clear(); endpoint.getPolicySets().addAll(policySets);
if (!endpoint.getSpecVersion().equals(Base.SCA11_NS)){ endpoint.getSpecVersion()); matchAudit.appendSeperator(); return false; endpoint.getSpecVersion()); matchAudit.appendSeperator(); return true; binding = endpoint.getBinding(); } else { binding = endpointReference.getBinding(); for (Intent epIntent : endpoint.getRequiredIntents()){ if (eprIntent.getExcludedIntents().contains(epIntent) || epIntent.getExcludedIntents().contains(eprIntent) || for (PolicySet policySet : endpoint.getPolicySets()){ PolicyBuilder policyBuilder = null; for (PolicySet policySet : endpoint.getPolicySets()){ if (policySet.getPolicies().size() > 0){ noEndpointPolicies = false; (endpoint.getRequiredIntents().size() == 0) && (noEndpointReferencePolicies) && (noEndpointPolicies)) {
for ( PolicySet ps : new ArrayList<PolicySet>(ep.getPolicySets()) ) { if ( ep.getBinding() instanceof PolicySubject ) { if (isApplicableToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getBinding(), ps)) continue; continue; else ep.getPolicySets().remove(ps);
for(Endpoint callbackEndpoint : callbackEndpoints){ if((endpointReference.getBinding() != null) && (callbackEndpoint.getBinding() != null) && (callbackEndpoint.getBinding().getType().equals(endpointReference.getBinding().getType()))){ endpointReference.setCallbackEndpoint(callbackEndpoint); break; for (Endpoint endpoint : service.getEndpoints()) { for ( EndpointReference callbackEndpointReference : reference.getEndpointReferences()){ if((endpoint.getBinding() == null) && (callbackEndpointReference.getBinding() == null) && (callbackEndpointReference.getBinding().getType().equals(endpoint.getBinding().getType()))){ endpoint.getCallbackEndpointReferences().add(callbackEndpointReference); break;
public static <T> T getService(Class<T> interfaze, String serviceURI, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, Deployer deployer) throws NoSuchServiceException { List<Endpoint> endpoints = domainRegistry.findEndpoint(serviceURI); if (endpoints.size() < 1) { throw new NoSuchServiceException(serviceURI); } String serviceName = null; if (serviceURI.contains("/")) { int i = serviceURI.indexOf("/"); if (i < serviceURI.length() - 1) { serviceName = serviceURI.substring(i + 1); } } Endpoint ep = endpoints.get(0); if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { return ((RuntimeComponent)ep.getComponent()).getServiceReference(interfaze, serviceName).getService(); } else { return getRemoteProxy(interfaze, ep, domainRegistry, extensionPointRegistry, deployer); } }
public String getServiceName() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext != null && msgContext.getTo() != null){ return msgContext.getTo().getService().getName(); } else { // message in thread context could be null (or the default message where to == null) // if the user has spun up a new thread inside their component implementation return null; } }