/** * Adds a the resolved service * * @param service the service to add */ public void addService(LogicalService service) { services.put(service.getUri().getFragment(), service); }
private void raiseServiceBindingNotFound(LogicalService service, String name, InstantiationContext context) { BindingNotFound error = new BindingNotFound("The binding " + name + " for service " + service.getUri() + " was not found", service); context.addError(error); }
public PhysicalTargetDefinition generateTarget(LogicalService service, EffectivePolicy policy) throws GenerationException { JUnitTargetDefinition wireDefinition = new JUnitTargetDefinition(); wireDefinition.setUri(service.getUri()); return wireDefinition; } }
private void raiseServiceBindingNotFound(LogicalService service, String name, InstantiationContext context) { BindingNotFound error = new BindingNotFound("The binding " + name + " for service " + service.getUri() + " was not found", service); context.addError(error); }
private void raiseServiceNotFoundError(LogicalService service, URI uri, String name, InstantiationContext context) { String message = "Service " + name + " promoted from " + service.getUri() + " not found on component " + uri; ServiceNotFound error = new ServiceNotFound(message, service); context.addError(error); }
private void raiseAmbiguousServiceError(LogicalService service, URI uri, InstantiationContext context) { String msg = "The promoted service " + service.getUri() + " must explicitly specify the service it is promoting on component " + uri + " as the component has more than one service"; AmbiguousService error = new AmbiguousService(msg, service); context.addError(error); }
private void raiseServiceBindingNotFound(LogicalService service, String name, InstantiationContext context) { BindingNotFound error = new BindingNotFound("The binding " + name + " for service " + service.getUri() + " was not found", service); context.addError(error); }
private void raiseIncompatibleBindings(LogicalReference reference, LogicalService service, String name, InstantiationContext context) { BindingNotFound error = new BindingNotFound( "The binding " + name + " for reference " + reference.getUri() + " and service " + service.getUri() + " are not compatible", reference); context.addError(error); }
private void raiseIncompatibleBindings(LogicalReference reference, LogicalService service, String name, InstantiationContext context) { BindingNotFound error = new BindingNotFound("The binding " + name + " for reference " + reference.getUri() + " and service " + service.getUri() + " are not compatible", reference); context.addError(error); }
public PhysicalWireTarget generateTarget(LogicalService service) throws Fabric3Exception { SingletonWireTarget target = new SingletonWireTarget(); URI uri = service.getUri(); target.setUri(uri); target.setOptimizable(true); return target; }
public PhysicalWireTarget generateTarget(LogicalService service) throws Fabric3Exception { SystemWireTarget target = new SystemWireTarget(); target.setOptimizable(true); target.setUri(service.getUri()); return target; }
private void raiseIncompatibleBindings(LogicalReference reference, LogicalService service, String name, InstantiationContext context) { BindingNotFound error = new BindingNotFound( "The binding " + name + " for reference " + reference.getUri() + " and service " + service.getUri() + " are not compatible", reference); context.addError(error); }
public PhysicalWireTarget generateTarget(LogicalService service) throws Fabric3Exception { if (!(service.getDefinition() instanceof SpringService)) { // programming error throw new Fabric3Exception("Expected service type: " + service.getDefinition().getClass().getName()); } SpringService springService = (SpringService) service.getDefinition(); ServiceContract contract = springService.getServiceContract(); if (!(contract instanceof JavaServiceContract)) { // Spring service contracts are always defined by Java interfaces throw new Fabric3Exception("Unexpected interface type for " + service.getUri() + ": " + contract.getClass().getName()); } String target = springService.getTarget(); String interfaceName = contract.getQualifiedInterfaceName(); URI uri = service.getUri(); return new SpringWireTarget(target, interfaceName, uri); }
public PhysicalWireTarget generateTarget(LogicalService service) throws Fabric3Exception { if (!(service.getDefinition() instanceof SpringService)) { // programming error throw new Fabric3Exception("Expected service type: " + service.getDefinition().getClass().getName()); } SpringService springService = (SpringService) service.getDefinition(); ServiceContract contract = springService.getServiceContract(); if (!(contract instanceof JavaServiceContract)) { // Spring service contracts are always defined by Java interfaces throw new Fabric3Exception("Unexpected interface type for " + service.getUri() + ": " + contract.getClass().getName()); } String target = springService.getTarget(); String interfaceName = contract.getQualifiedInterfaceName(); URI uri = service.getUri(); return new SpringWireTarget(target, interfaceName, uri); }
public PhysicalTargetDefinition generateTarget(LogicalService service, EffectivePolicy policy) throws GenerationException { if (!(service.getLeafService().getDefinition() instanceof SpringService)) { // programming error throw new GenerationException("Expected service type: " + service.getDefinition().getClass().getName()); } SpringService springService = (SpringService) service.getLeafService().getDefinition(); ServiceContract contract = springService.getServiceContract(); if (!(contract instanceof JavaServiceContract)) { // Spring service contracts are always defined by Java interfaces throw new GenerationException("Unexpected interface type for " + service.getUri() + ": " + contract.getClass().getName()); } String target = springService.getTarget(); String interfaceName = contract.getQualifiedInterfaceName(); URI uri = service.getUri(); return new SpringTargetDefinition(target, interfaceName, uri); }
@SuppressWarnings({"unchecked"}) public void generateWireTarget(JavaWireTarget target, LogicalService service) { LogicalComponent<JavaImplementation> component = (LogicalComponent<JavaImplementation>) service.getParent(); URI uri = URI.create(component.getUri().toString() + "#" + service.getUri().getFragment()); target.setUri(uri); // assume only wires to composite scope components can be optimized Component<JavaImplementation> componentDefinition = component.getDefinition(); JavaImplementation implementation = componentDefinition.getImplementation(); InjectingComponentType componentType = implementation.getComponentType(); Scope scope = componentType.getScope(); target.setOptimizable(scope.isSingleton()); }
/** * Updates the list of services with the promotion hierarchy for the given service. The list is populated in reverse order so that the leaf * (promoted) service is stored last. * * @param service the current service to ascend from * @param services the list */ private void getPromotionHierarchy(LogicalService service, LinkedList<LogicalService> services) { LogicalComponent<CompositeImplementation> parent = service.getParent().getParent(); URI serviceUri = service.getUri(); for (LogicalService promotion : parent.getServices()) { URI targetUri = promotion.getPromotedUri(); if (targetUri.getFragment() == null) { // no service specified if (targetUri.equals(UriHelper.getDefragmentedName(serviceUri))) { services.addFirst(promotion); if (parent.getParent() != null) { getPromotionHierarchy(promotion, services); } } } else { if (targetUri.equals(serviceUri)) { services.addFirst(promotion); if (parent.getParent() != null) { getPromotionHierarchy(promotion, services); } } } } }
/** * 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); } }