private ServiceEndpointDefinition synthesizeEndpointFromWsdlInterface(LogicalBinding<WsBindingDefinition> binding, WsdlServiceContract wsdlContract) throws EndpointResolutionException { URI targetUri; Definition wsdl = wsdlContract.getDefinition(); QName portType = wsdlContract.getPortType().getQName(); QName serviceName = new QName(portType.getNamespaceURI(), portType.getLocalPart() + "Service"); QName portName = new QName(portType.getNamespaceURI(), portType.getLocalPart() + "Port"); Bindable service = binding.getParent(); targetUri = URI.create(service.getUri().getFragment()); String serializedWsdl = endpointResolver.serializeWsdl(wsdl); return new ServiceEndpointDefinition(serviceName, portName, targetUri, serializedWsdl); }
public ZeroMQTargetDefinition generateServiceBindingTarget(LogicalBinding<ZeroMQBindingDefinition> binding, ServiceContract contract, List<LogicalOperation> operations, EffectivePolicy policy) throws GenerationException { URI targetUri = binding.getParent().getUri(); ZeroMQMetadata metadata = binding.getDefinition().getZeroMQMetadata(); return generateTarget(contract, targetUri, metadata); }
public PromotedComponentNotFound(Bindable bindable, URI promotedComponentUri) { super(bindable.getParent().getUri(), bindable.getParent().getDefinition().getContributionUri(), Collections.singletonList(bindable)); this.bindableUri = bindable.getUri(); this.promotedComponentUri = promotedComponentUri; }
private ServiceEndpointDefinition synthesizeEndpointFromClass(LogicalBinding<WsBindingDefinition> binding, JavaServiceContract contract, Class<?> serviceClass) throws GenerationException { URI targetUri; Bindable service = binding.getParent(); for (LogicalBinding<?> otherBinding : service.getBindings()) { if (binding == otherBinding) { continue; } if (WsBindingDefinition.BINDING_QNAME.equals(otherBinding.getDefinition().getType())) { // check to see if other WS bindings also use a default WsBindingDefinition wsDefinition = (WsBindingDefinition) otherBinding.getDefinition(); if (wsDefinition.getTargetUri() == null && wsDefinition.getWsdlElement() == null) { throw new GenerationException("If there is more than one web service binding, one must provide a URI or WSDLElement:" + service.getUri()); } } } targetUri = URI.create(service.getUri().getFragment()); return synthesizer.synthesizeServiceEndpoint(contract, serviceClass, targetUri); }
private void validateIntents(LogicalBinding<?> binding) throws PolicyResolutionException { Set<Intent> intents = policyRegistry.getDefinitions(binding.getIntents(), Intent.class); for (Intent current : intents) { for (Intent intent : intents) { if (current.getExcludes().contains(intent.getName())) { throw new PolicyResolutionException("Mutually exclusive intents specified on binding: " + binding.getParent().getUri()); } } } }
private void validateIntents(Bindable bindable, InstantiationContext context) { if (registry == null) { // don't validate intents during bootstrap return; } Set<QName> intents = bindable.getIntents(); if (intents.isEmpty()) { return; } Set<Intent> resolved = registry.getDefinitions(intents, Intent.class); // check for mutually exclusive intents for (Intent intent : resolved) { for (QName exclude : intent.getExcludes()) { if (intents.contains(exclude)) { String prefix = bindable instanceof LogicalReference ? "Reference " : "Service "; MutuallyExclusiveIntents error = new MutuallyExclusiveIntents(prefix + bindable.getUri() + " is configured with mutually exclusive intents: " + intent.getName() + "," + exclude, bindable); context.addError(error); } } } }
public URL resolveUrl(LogicalBinding<WsBindingDefinition> serviceBinding, EffectivePolicy policy) throws GenerationException { try { URL targetUrl; String path = serviceBinding.getDefinition().getTargetUri().toString(); if (path == null) { path = serviceBinding.getParent().getUri().getFragment(); } boolean https = requiresHttps(policy); if (RuntimeMode.VM == hostInfo.getRuntimeMode()) { // single VM if (https) { targetUrl = new URL("https://localhost:" + servletHost.getHttpsPort() + "/" + path); } else { targetUrl = new URL("http://localhost:" + servletHost.getHttpPort() + "/" + path); } } else { throw new GenerationException("Resolve URL not supported in distributed configuration"); } return targetUrl; } catch (MalformedURLException e) { throw new GenerationException(e); } }
public MetroWireTargetDefinition generateTarget(LogicalBinding<WsBindingDefinition> binding, JavaServiceContract contract, EffectivePolicy policy) throws GenerationException { URL targetUrl = null; WsBindingDefinition definition = binding.getDefinition(); URI targetUri = definition.getTargetUri(); if (binding.isCallback() && targetUri != null) { throw new GenerationException("A web services callback binding cannot be used with a binding URI on a service: " + binding.getParent().getUri()); } if (targetUri != null) { if (!targetUri.isAbsolute() && !binding.isCallback()) { throw new GenerationException("Web service binding URI must be absolute on reference: " + binding.getParent().getUri()); } try { targetUrl = targetUri.toURL(); } catch (MalformedURLException e) { throw new GenerationException(e); } } else if (definition.getWsdlElement() == null && definition.getWsdlLocation() == null && !binding.isCallback()) { throw new GenerationException("A web service binding URI must be specified: " + binding.getParent().getUri()); } return generateTarget(binding, targetUrl, contract, policy); }
if (bindingTargetUri == null) { return URI.create("f3synthetic://" + binding.getParent().getUri() + "/" + binding.getDefinition().getName());
for (LogicalOperation operation : operations) { if (!operation.getIntents().contains(ONEWAY)) { throw new PolicyResolutionException("Cannot specify transacted one-way for a request-response operation: " + parent.getUri()); for (LogicalOperation operation : operations) { if (!operation.getIntents().contains(ONEWAY)) { throw new PolicyResolutionException("Cannot specify immediate one-way for a request-response operation: " + parent.getUri());
WsdlElement wsdlElement = GenerationHelper.parseWsdlElement(wsdlElementString); if (wsdlElement.getType() == WsdlElement.Type.SERVICE) { throw new GenerationException("Services cannot specify a wsdl.service in the web service binding: " + binding.getParent().getUri()); targetUri = URI.create(service.getUri().getFragment()); ConcreteWsdlResult result = wsdlSynthesizer.synthesize(binding, REPLACEABLE_ADDRESS, contract, policy, wsdl, targetUri); wsdl = result.getDefiniton(); URI serviceUri = binding.getParent().getUri(); return new MetroWsdlWireSourceDefinition(serviceUri, endpointDefinition, serializedWsdl, intentNames, binding.isCallback(), handlers);
handlers); if (binding.isCallback()) { targetDefinition.setUri(binding.getParent().getUri());
serviceUri = binding.getParent().getUri();
URI bindableUri = binding.getParent().getUri(); throw new GenerationException("Either a uri or wsdlElement must be specified for the web service binding on " + bindableUri);
SOAPBinding soapBinding = (SOAPBinding) element; if (!SOAP_HTTP_TRANSPORT.equals(soapBinding.getTransportURI())) { throw new EndpointValidationException("Invalid SOAP binding transport specified for: " + binding.getParent().getUri());
String localName = logicalBinding.getParent().getUri().getFragment();
throw new GenerationException("Services cannot specify a wsdl.service in the web service binding: " + binding.getParent().getUri());