private void addComponents() { _componentServices = new LinkedHashMap<QName, ComponentService>(); if (getConfig().getComposite().getComponents() == null) { return; } for (ComponentModel component : getConfig().getComposite().getComponents()) { // TODO: we need a separate node for components, to support cases // where the component implements no services. Should also consider // multiple services per component. if (component.getServices().size() > 0) { ComponentServiceModel service = component.getServices().get(0); if (service.getInterface() == null || EsbInterfaceModel.ESB.equals(service.getInterface().getType())) { _componentServices.put(service.getQName(), new BaseNoopComponentService(service, component, this)); } else if (InterfaceModel.JAVA.equals(service.getInterface().getType())) { _componentServices.put(service.getQName(), new BaseJavaComponentService(service, component, this)); } else if (InterfaceModel.WSDL.equals(service.getInterface().getType())) { _componentServices.put(service.getQName(), new BaseWsdlComponentService(service, component, this)); } } } }
/** * Retrieve the component service config for the specified service name. * @param name component service name * @return component service config fragment, or null if the service does not exist */ public ComponentServiceModel getComponentService(String name) { for (ComponentModel component : getMergedSwitchYardConfig().getComposite().getComponents()) { for (ComponentServiceModel service : component.getServices()) { if (service.getName().equals(name)) { return service; } } } // no matching service return null; }
InterfaceModel csiModel = new V1InterfaceModel(InterfaceModel.JAVA); Class<?> serviceInterface = routeClass.getAnnotation(Route.class).value(); serviceModel.setName(getServiceName(routeClass)); csiModel.setInterface(serviceInterface.getName()); serviceModel.setInterface(csiModel); componentModel.addService(serviceModel);
serviceModel.setName(name); serviceModel.setInterface(csiModel); csiModel.setInterface(iface.getName()); serviceModel.addPolicyRequirement(secPolicy.getQName()); } else if (secPolicy.supports(PolicyType.IMPLEMENTATION)) { beanModel.addPolicyRequirement(secPolicy.getQName()); serviceModel.addPolicyRequirement(txPolicy.getQName()); } else if (txPolicy.supports(PolicyType.IMPLEMENTATION)) { beanModel.addPolicyRequirement(txPolicy.getQName()); if (serviceModel.hasPolicyRequirement(ptx) && serviceModel.hasPolicyRequirement(stx)) { throw BeanMessages.MESSAGES.transactionPoliciesCannotCoexistService(ptx, stx, name);
} else if (component.getServices().size() == 1) { ComponentServiceModel service = component.getServices().get(0); _log.debug("Registering service " + service.getQName() + " for component " + component.getImplementation().getType() + " for deployment " + getName()); List<Model> models = service.getModelChildren(); for (Model model : models) { if (BindingModel.class.isAssignableFrom(model.getClass())) { ServiceHandler handler = activator.activateService(service.getQName(), component); Activation activation = new Activation(activator, component.getQName(), null, handler); ServiceInterface serviceIntf = getComponentServiceInterface(service); ServiceMetadata metadata = ServiceMetadataBuilder.create() .security(getDomain().getServiceSecurity(service.getSecurity())) .requiredPolicies(requires) .registrant(impl) .build(); Service svc = getDomain().registerService(service.getQName(), serviceIntf, handler, metadata); activation.addService(svc); activation.addReferences(references); if (componentService != null && componentService.equals(service)) { if (!service.getQName().equals(compositeService.getQName())) { validateServiceRegistration(compositeService.getQName()); Service promotedService = getDomain().registerService(
private boolean hasComponentServiceInterface(ComponentServiceModel componentService) { return componentService != null && componentService.getInterface() != null; }
for (ComponentServiceModel service : component.getServices()) { out.print(out.renderColor(ShellColor.BOLD, " service: ")); out.println(service.getName()); out.print(out.renderColor(ShellColor.BOLD, " interface: ")); if (service.getInterface() != null) { out.println(service.getInterface().getInterface()); } else { out.println(out.renderColor(ShellColor.RED, "unspecified"));
service.addPolicyRequirement(p.getName()); target = service.getName();
private ComponentService getPromotedService(Application application, CompositeServiceModel compositeService) { ComponentServiceModel componentServiceModel = compositeService.getComponentService(); if (componentServiceModel == null) { return null; } return application.getComponentService(componentServiceModel.getQName()); }
domain.getServiceSecurity(bindingModel.getService().getComponentService().getSecurity()).getSecurityDomain(), ep.getSecurityDomainContext()));
InterfaceModel interfaceModel = new V1InterfaceModel(InterfaceModel.JAVA); interfaceModel.setInterface(rulesInterface.getName()); componentServiceModel.setInterface(interfaceModel); componentServiceModel.setName(rulesName); componentModel.addService(componentServiceModel); return componentModel;
serviceModel.setName(name); serviceModel.setInterface(csiModel); csiModel.setInterface(iface.getName()); serviceModel.addPolicyRequirement(secPolicy.getQName()); } else if (secPolicy.supports(PolicyType.IMPLEMENTATION)) { beanModel.addPolicyRequirement(secPolicy.getQName()); serviceModel.addPolicyRequirement(txPolicy.getQName()); } else if (txPolicy.supports(PolicyType.IMPLEMENTATION)) { beanModel.addPolicyRequirement(txPolicy.getQName()); if (serviceModel.hasPolicyRequirement(ptx) && serviceModel.hasPolicyRequirement(stx)) { throw BeanMessages.MESSAGES.transactionPoliciesCannotCoexistService(ptx, stx, name);
private ServiceInterface getComponentServiceInterface(ComponentServiceModel service) { ServiceInterface serviceInterface = null; if (service != null && service.getInterface() != null) { serviceInterface = loadServiceInterface(service.getInterface()); } return serviceInterface; }
private void validateServiceRegistration(QName name) { if (getConfig().getComposite() == null) { return; } for (ComponentModel component : getConfig().getComposite().getComponents()) { for (ComponentServiceModel service : component.getServices()) { if (service.getQName().equals(name)) { throw BaseDeployMessages.MESSAGES.serviceRegHidesService(name.toString(), service.toString()); } } } } }
domain.getServiceSecurity(bindingModel.getService().getComponentService().getSecurity()).getSecurityDomain(), ep.getSecurityDomainContext()));
InterfaceModel interfaceModel = new V1InterfaceModel(InterfaceModel.JAVA); interfaceModel.setInterface(bpmInterface.getName()); componentServiceModel.setInterface(interfaceModel); componentServiceModel.setName(bpmName); componentModel.addService(componentServiceModel); return componentModel;
/** * Create a new BaseComponentService from a config model. * * @param serviceConfig the component service configuration * @param componentConfig the component configuration * @param application the switchyard application */ public BaseComponentService(ComponentServiceModel serviceConfig, ComponentModel componentConfig, Application application) { _name = serviceConfig.getQName(); _implementation = getComponentImplementationType(componentConfig); _interface = getInterfaceName(serviceConfig.getInterface()); _application = application; _references = new LinkedList<ComponentReference>(); _implementationConfiguration = getComponentImplementationConfiguration(componentConfig); for (ComponentReferenceModel referenceModel : componentConfig.getReferences()) { _references.add(new BaseComponentReference(referenceModel.getQName(), getInterfaceName(referenceModel.getInterface()))); } }
/** * Create a new BaseComponentService from a config model. * * @param serviceConfig the component service configuration * @param componentConfig the component configuration * @param application the switchyard application */ public ComponentServiceWithOperations(ComponentServiceModel serviceConfig, ComponentModel componentConfig, Application application) { super(serviceConfig, componentConfig, application); _operations = new LinkedList<ServiceOperation>(); for (org.switchyard.metadata.ServiceOperation so : getInterfaceOperations(serviceConfig.getInterface())) { _operations.add(new BaseServiceOperation(so.getName(), so.getExchangePattern().name(), so.getInputType(), so.getOutputType(), so.getFaultType())); } }
@Override public ServiceHandler activateService(QName serviceName, ComponentModel config) { ServiceHandler handler = null; // add switchyard property parser to camel PropertiesComponent PropertiesComponent propertiesComponent = getCamelContext().getComponent("properties", PropertiesComponent.class); PropertyResolver pr = config.getModelConfiguration().getPropertyResolver(); propertiesComponent.setPropertiesParser(new SwitchYardPropertiesParser(pr)); // process service for (ComponentServiceModel service : config.getServices()) { if (service.getQName().equals(serviceName)) { handler = handleImplementation(service, serviceName); break; } } return handler; }
if (componentServiceName.equals(componentService.getName())) { return componentService;