private <S extends LogicalComponent<?>> URI generateCallbackUri(S source, ServiceContract contract, String referenceName) { LogicalService candidate = null; for (LogicalService entry : source.getServices()) { MatchResult result = matcher.isAssignableFrom(contract, entry.getServiceContract(), false); if (result.isAssignable()) { candidate = entry; break; } } if (candidate == null) { String name = contract.getInterfaceName(); URI uri = source.getUri(); throw new Fabric3Exception("Callback service not found: " + name + " on component: " + uri + " originating from reference :" + referenceName); } return URI.create(source.getUri().toString() + "#" + candidate.getDefinition().getName()); }
private <S extends LogicalComponent<?>> URI generateCallbackUri(S source, ServiceContract contract, String referenceName) { LogicalService candidate = null; for (LogicalService entry : source.getServices()) { MatchResult result = matcher.isAssignableFrom(contract, entry.getServiceContract(), false); if (result.isAssignable()) { candidate = entry; break; } } if (candidate == null) { String name = contract.getInterfaceName(); URI uri = source.getUri(); throw new Fabric3Exception("Callback service not found: " + name + " on component: " + uri + " originating from reference :" + referenceName); } return URI.create(source.getUri().toString() + "#" + candidate.getDefinition().getName()); }
private <S extends LogicalComponent<?>> URI generateCallbackUri(S source, ServiceContract contract, String referenceName) throws GenerationException { LogicalService candidate = null; for (LogicalService entry : source.getServices()) { MatchResult result = matcher.isAssignableFrom(contract, entry.getServiceContract(), false); if (result.isAssignable()) { candidate = entry; break; } } if (candidate == null) { String name = contract.getInterfaceName(); URI uri = source.getUri(); throw new CallbackServiceNotFoundException("Callback service not found: " + name + " on component: " + uri + " originating from reference :" + referenceName, name); } return URI.create(source.getUri().toString() + "#" + candidate.getDefinition().getName()); }
ServiceContract targetContract = service.getServiceContract(); if (targetContract == null) {
ServiceContract targetContract = service.getServiceContract(); if (targetContract == null) {
/** * Validates the reference and service contracts match. * * @param reference the reference * @param service the service * @param context the logical context */ private void validateContracts(LogicalReference reference, LogicalService service, InstantiationContext context) { ServiceContract referenceContract = reference.getServiceContract(); ServiceContract serviceContract = service.getServiceContract(); MatchResult result = matcher.isAssignableFrom(referenceContract, serviceContract, true); if (!result.isAssignable()) { URI serviceUri = service.getUri(); String message = result.getError(); IncompatibleContracts error = new IncompatibleContracts(reference, serviceUri, message); context.addError(error); } }
/** * Validates the reference and service contracts match. * * @param reference the reference * @param service the service * @param context the logical context */ private void validateContracts(LogicalReference reference, LogicalService service, InstantiationContext context) { ServiceContract referenceContract = reference.getServiceContract(); ServiceContract serviceContract = service.getServiceContract(); MatchResult result = matcher.isAssignableFrom(referenceContract, serviceContract, true); if (!result.isAssignable()) { URI serviceUri = service.getUri(); String message = result.getError(); IncompatibleContracts error = new IncompatibleContracts(reference, serviceUri, message); context.addError(error); } }
/** * Validates the reference and service contracts match. * * @param reference the reference * @param service the service * @param context the logical context */ private void validateContracts(LogicalReference reference, LogicalService service, InstantiationContext context) { ServiceContract referenceContract = reference.getServiceContract(); ServiceContract serviceContract = service.getServiceContract(); MatchResult result = matcher.isAssignableFrom(referenceContract, serviceContract, true); if (!result.isAssignable()) { URI serviceUri = service.getUri(); String message = result.getError(); IncompatibleContracts error = new IncompatibleContracts(reference, serviceUri, message); context.addError(error); } }
} else { for (LogicalService service : targetComponent.getServices()) { if (matcher.isAssignableFrom(reference.getServiceContract(), service.getServiceContract(), false).isAssignable()) { return service;
} else { for (LogicalService service : targetComponent.getServices()) { if (matcher.isAssignableFrom(reference.getServiceContract(), service.getServiceContract(), false).isAssignable()) { return service;
continue; ServiceContract callbackContract = service.getServiceContract().getCallbackContract(); LogicalBinding<?> callbackBinding = null; URI callbackUri = null;
ServiceContract callbackContract = service.getServiceContract().getCallbackContract(); if (referenceCallbackContract.getClass().equals(callbackContract.getClass())) { List<LogicalOperation> operations = service.getCallbackOperations();
public <T extends Binding> PhysicalWire generateServiceCallback(LogicalBinding<T> binding) { checkService(binding); LogicalService service = (LogicalService) binding.getParent(); LogicalComponent<?> component = service.getParent(); ServiceContract contract = service.getServiceContract(); ServiceContract callbackContract = contract.getCallbackContract(); List<LogicalOperation> operations = service.getCallbackOperations(); // generate the metadata used to attach the physical callback wire to the source component ComponentGenerator sourceGenerator = getGenerator(component); PhysicalWireSource source = sourceGenerator.generateCallbackSource(service); URI sourceUri = component.getDefinition().getContributionUri(); source.setClassLoader(classLoaderRegistry.getClassLoader(sourceUri)); // generate the metadata used to attach the physical callback wire to the target transport WireBindingGenerator<T> bindingGenerator = getGenerator(binding); PhysicalWireTarget target = bindingGenerator.generateTarget(binding, callbackContract, operations); target.setCallback(true); URI targetUri = binding.getParent().getParent().getDefinition().getContributionUri(); target.setClassLoader(classLoaderRegistry.getClassLoader(targetUri)); // generate the metadata for interceptors that are attached to wire invocation chains, e.g. policy implemented by an interceptor Set<PhysicalOperation> physicalOperations = operationGenerator.generateOperations(operations); return new PhysicalWire(source, target, physicalOperations); }
public <T extends Binding> PhysicalWire generateServiceCallback(LogicalBinding<T> binding) { checkService(binding); LogicalService service = (LogicalService) binding.getParent(); LogicalComponent<?> component = service.getParent(); ServiceContract contract = service.getServiceContract(); ServiceContract callbackContract = contract.getCallbackContract(); List<LogicalOperation> operations = service.getCallbackOperations(); // generate the metadata used to attach the physical callback wire to the source component ComponentGenerator sourceGenerator = getGenerator(component); PhysicalWireSource source = sourceGenerator.generateCallbackSource(service); URI sourceUri = component.getDefinition().getContributionUri(); source.setClassLoader(classLoaderRegistry.getClassLoader(sourceUri)); // generate the metadata used to attach the physical callback wire to the target transport WireBindingGenerator<T> bindingGenerator = getGenerator(binding); PhysicalWireTarget target = bindingGenerator.generateTarget(binding, callbackContract, operations); target.setCallback(true); URI targetUri = binding.getParent().getParent().getDefinition().getContributionUri(); target.setClassLoader(classLoaderRegistry.getClassLoader(targetUri)); // generate the metadata for interceptors that are attached to wire invocation chains, e.g. policy implemented by an interceptor Set<PhysicalOperation> physicalOperations = operationGenerator.generateOperations(operations); return new PhysicalWire(source, target, physicalOperations); }
public <T extends Binding> PhysicalWire generateService(LogicalBinding<T> binding, URI callbackUri) { checkService(binding); LogicalService service = (LogicalService) binding.getParent(); LogicalComponent<?> component = service.getParent(); ServiceContract contract = service.getServiceContract(); List<LogicalOperation> operations = service.getOperations(); // generate the metadata used to attach the physical wire to the target component ComponentGenerator targetGenerator = getGenerator(component); PhysicalWireTarget target = targetGenerator.generateTarget(service); URI targetUri = service.getParent().getDefinition().getContributionUri(); target.setClassLoader(classLoaderRegistry.getClassLoader(targetUri)); target.setCallbackUri(callbackUri); // generate the metadata used to attach the physical wire to the source transport WireBindingGenerator<T> sourceGenerator = getGenerator(binding); PhysicalWireSource source = sourceGenerator.generateSource(binding, contract, operations); URI sourceUri = service.getParent().getDefinition().getContributionUri(); source.setClassLoader(classLoaderRegistry.getClassLoader(sourceUri)); // generate the metadata for interceptors that are attached to wire invocation chains, e.g. policy implemented by an interceptor Set<PhysicalOperation> physicalOperations = operationGenerator.generateOperations(operations); PhysicalWire physicalWire = new PhysicalWire(source, target, physicalOperations); boolean optimizable = source.isOptimizable() && target.isOptimizable() && checkOptimization(contract, physicalOperations); physicalWire.setOptimizable(optimizable); return physicalWire; }
public <T extends BindingDefinition> PhysicalWireDefinition generateBoundServiceCallback(LogicalBinding<T> binding) throws GenerationException { checkService(binding); LogicalService service = (LogicalService) binding.getParent(); LogicalComponent<?> component = service.getLeafComponent(); ServiceContract contract = service.getLeafService().getServiceContract(); ServiceContract callbackContract = contract.getCallbackContract(); List<LogicalOperation> operations = service.getCallbackOperations(); // resolve callback policies PolicyResult policyResult = policyResolver.resolveCallbackPolicies(binding); EffectivePolicy sourcePolicy = policyResult.getSourcePolicy(); EffectivePolicy targetPolicy = policyResult.getTargetPolicy(); // generate the metadata used to attach the physical callback wire to the source component ComponentGenerator sourceGenerator = getGenerator(component); PhysicalSourceDefinition sourceDefinition = sourceGenerator.generateCallbackSource(service, sourcePolicy); sourceDefinition.setClassLoaderId(component.getDefinition().getContributionUri()); // generate the metadata used to attach the physical callback wire to the target transport BindingGenerator<T> bindingGenerator = getGenerator(binding); PhysicalTargetDefinition targetDefinition = bindingGenerator.generateTarget(binding, callbackContract, operations, targetPolicy); targetDefinition.setCallback(true); targetDefinition.setClassLoaderId(binding.getParent().getParent().getDefinition().getContributionUri()); // generate the metadata for interceptors that are attached to wire invocation chains, e.g. policy implemented by an interceptor Set<PhysicalOperationDefinition> physicalOperations = operationGenerator.generateOperations(operations, true, policyResult); return new PhysicalWireDefinition(sourceDefinition, targetDefinition, physicalOperations); }
public <T extends Binding> PhysicalWire generateService(LogicalBinding<T> binding, URI callbackUri) { checkService(binding); LogicalService service = (LogicalService) binding.getParent(); LogicalComponent<?> component = service.getParent(); ServiceContract contract = service.getServiceContract(); List<LogicalOperation> operations = service.getOperations(); // generate the metadata used to attach the physical wire to the target component ComponentGenerator targetGenerator = getGenerator(component); PhysicalWireTarget target = targetGenerator.generateTarget(service); URI targetUri = service.getParent().getDefinition().getContributionUri(); target.setClassLoader(classLoaderRegistry.getClassLoader(targetUri)); target.setCallbackUri(callbackUri); // generate the metadata used to attach the physical wire to the source transport WireBindingGenerator<T> sourceGenerator = getGenerator(binding); PhysicalWireSource source = sourceGenerator.generateSource(binding, contract, operations); URI sourceUri = service.getParent().getDefinition().getContributionUri(); source.setClassLoader(classLoaderRegistry.getClassLoader(sourceUri)); // generate the metadata for interceptors that are attached to wire invocation chains, e.g. policy implemented by an interceptor Set<PhysicalOperation> physicalOperations = operationGenerator.generateOperations(operations); PhysicalWire physicalWire = new PhysicalWire(source, target, physicalOperations); boolean optimizable = source.isOptimizable() && target.isOptimizable() && checkOptimization(contract, physicalOperations); physicalWire.setOptimizable(optimizable); return physicalWire; }
ServiceContract contract = service.getLeafService().getServiceContract();
URI targetUri = targetComponent.getDefinition().getContributionUri(); target.setClassLoader(classLoaderRegistry.getClassLoader(targetUri)); ServiceContract serviceContract = service.getServiceContract(); ServiceContract callbackContract = serviceContract.getCallbackContract(); if (callbackContract != null) {
URI targetUri = targetComponent.getDefinition().getContributionUri(); target.setClassLoader(classLoaderRegistry.getClassLoader(targetUri)); ServiceContract serviceContract = service.getServiceContract(); ServiceContract callbackContract = serviceContract.getCallbackContract(); if (callbackContract != null) {