private static ComponentMetadata decorateServiceType(final Attr attr, final ComponentMetadata component, final ParserContext context) { if (!(component instanceof MutableServiceMetadata)) { throw new ComponentDefinitionException("Expected an instanceof MutableServiceMetadata"); } MutableServiceMetadata service = (MutableServiceMetadata)component; LOG.debug("decorateServiceType for {} - adding type property {}", service.getId(), attr.getValue()); service.addServiceProperty(createValue(context, TYPE_ATTR), createValue(context, attr.getValue())); return component; }
/** * Create an Aries-specific mutable instance of the standard ServiceMetadata interface. * * @param serviceInterfaces the interfaces for the service * * @return a new reflect instance */ public static MutableServiceMetadata create(String id, Class... serviceInterfaces) { MutableServiceMetadata metadata = create(); metadata.setId(id); if (serviceInterfaces != null && serviceInterfaces.length > 0) { for (Class serviceInterface : serviceInterfaces) { metadata.addInterface(serviceInterface.getName()); } } return metadata; }
/** * Create an Aries-specific mutable instance of the standard ServiceMetadata interface. * * @return a new reflect instance */ public static MutableServiceMetadata create() { MutableServiceMetadata metadata = MetadataUtil.createMetadata(MutableServiceMetadata.class); metadata.setActivation(ComponentMetadata.ACTIVATION_LAZY); return metadata; }
service.setId(name); service.setServiceComponent(bean); service.addInterface(JaasRealm.class.getName()); service.addServiceProperty(createValue(context, ProxyLoginModule.PROPERTY_MODULE), createValue(context, name)); return service;
commandService.setActivation(MutableServiceMetadata.ACTIVATION_LAZY); commandService.setId(getName()); commandService.setAutoExport(ServiceMetadata.AUTO_EXPORT_INTERFACES); commandService.setServiceComponent(command); commandService.addServiceProperty(createStringValue(context, "osgi.command.scope"), createStringValue(context, scope)); commandService.addServiceProperty(createStringValue(context, "osgi.command.function"), createStringValue(context, function));
service.setId(name); service.setServiceComponent(bean); service.addInterface(KeystoreInstance.class.getName()); return service;
if(component instanceof MutableServiceMetadata) { processingStack.add("Service Component->"); ((MutableServiceMetadata) component).setServiceComponent( (Target) processMetadata(component.getServiceComponent())); } else { msm.removeServiceProperty(entry); msm.addServiceProperty(entry);
/** * Create an Aries-specific mutable instance of the standard ServiceMetadata interface. * * @param serviceMetadata the MutableServiceMetadata for the service * @param serviceProperties the service properties to add */ public static void addServiceProperties(MutableServiceMetadata serviceMetadata, Map<String, String> serviceProperties) { for (Map.Entry<String, String> serviceProperty : serviceProperties.entrySet()) { serviceMetadata.addServiceProperty(ValueMetadataUtil.create(serviceProperty.getKey()), ValueMetadataUtil.create(serviceProperty.getValue())); } } }
/** * Create an Aries-specific mutable instance of the standard ServiceMetadata interface. * * @param serviceInterfaces the interfaces for the service * * @return a new reflect instance */ public static MutableServiceMetadata create(Class... serviceInterfaces) { MutableServiceMetadata metadata = create(); if (serviceInterfaces != null && serviceInterfaces.length > 0) { for (Class serviceInterface : serviceInterfaces) { metadata.addInterface(serviceInterface.getName()); } } return metadata; }
commandService.setActivation(MutableServiceMetadata.ACTIVATION_LAZY); commandService.setId(getName()); commandService.addInterface(Function.class.getName()); commandService.addInterface(CompletableFunction.class.getName()); commandService.setServiceComponent(command); commandService.addServiceProperty(createStringValue(context, "osgi.command.scope"), createStringValue(context, scope)); commandService.addServiceProperty(createStringValue(context, "osgi.command.function"), createStringValue(context, function)); context.getComponentDefinitionRegistry().registerComponentDefinition(commandService);
private void createSubShell(ParserContext context, String scope, String subShellName) { if (context.getComponentDefinitionRegistry().containsComponentDefinition(subShellName)) { return; } MutableBeanMetadata subShellAction = context.createMetadata(MutableBeanMetadata.class); subShellAction.setRuntimeClass(SubShellAction.class); subShellAction.setActivation(MutableBeanMetadata.ACTIVATION_LAZY); subShellAction.setScope(MutableBeanMetadata.SCOPE_PROTOTYPE); subShellAction.setId(getName()); subShellAction.addProperty("subShell", createStringValue(context, scope)); context.getComponentDefinitionRegistry().registerComponentDefinition(subShellAction); // generate the sub-shell command MutableBeanMetadata subShellCommand = context.createMetadata(MutableBeanMetadata.class); subShellCommand.setId(getName()); subShellCommand.setRuntimeClass(BlueprintCommand.class); subShellCommand.addProperty(BLUEPRINT_CONTAINER, createRef(context, BLUEPRINT_CONTAINER)); subShellCommand.addProperty(BLUEPRINT_CONVERTER, createRef(context, BLUEPRINT_CONVERTER)); subShellCommand.addProperty(ACTION_ID, createIdRef(context, subShellAction.getId())); context.getComponentDefinitionRegistry().registerComponentDefinition(subShellCommand); // generate the sub-shell OSGi service MutableServiceMetadata subShellCommandService = context.createMetadata(MutableServiceMetadata.class); subShellCommandService.setActivation(MutableServiceMetadata.ACTIVATION_LAZY); subShellCommandService.setId(subShellName); subShellCommandService.setAutoExport(ServiceMetadata.AUTO_EXPORT_INTERFACES); subShellCommandService.setServiceComponent(subShellCommand); subShellCommandService.addServiceProperty(createStringValue(context, "osgi.command.scope"), createStringValue(context, "*")); subShellCommandService.addServiceProperty(createStringValue(context, "osgi.command.function"), createStringValue(context, scope)); context.getComponentDefinitionRegistry().registerComponentDefinition(subShellCommandService); }
service.setId(name); service.setServiceComponent(bean); service.addInterface(KeystoreInstance.class.getName()); return service;
if(component instanceof MutableServiceMetadata) { processingStack.add("Service Component->"); ((MutableServiceMetadata) component).setServiceComponent( (Target) processMetadata(component.getServiceComponent())); } else { msm.removeServiceProperty(entry); msm.addServiceProperty(entry);
/** * Create an Aries-specific mutable instance of the standard ServiceMetadata interface. * * @param serviceMetadata the MutableServiceMetadata for the service * @param serviceProperty the service property to add * @param servicePropertyValue the service property value to add */ public static void addServiceProperty(MutableServiceMetadata serviceMetadata, String serviceProperty, String servicePropertyValue) { if (serviceMetadata == null) { LOG.warn("Ignoring call to null addServiceProperties - MutableServiceMetadata argument is null"); } else if (serviceProperty == null || serviceProperty.isEmpty()) { LOG.warn("Ignoring call to null addServiceProperties - service property name argument is null"); } else if (servicePropertyValue == null || servicePropertyValue.isEmpty()) { LOG.warn("Ignoring call to null addServiceProperties - service property value argument is null"); } else { serviceMetadata.addServiceProperty(ValueMetadataUtil.create(serviceProperty), ValueMetadataUtil.create(servicePropertyValue)); } }
service.setId(name); service.setServiceComponent(bean); service.addInterface(JaasRealm.class.getName()); service.addServiceProperty(createValue(context, ProxyLoginModule.PROPERTY_MODULE), createValue(context, name)); return service;
private ComponentMetadata decorateServiceType(Attr attr, ComponentMetadata component, ParserContext context) { if (!(component instanceof MutableServiceMetadata)) { throw new ComponentDefinitionException("Expected an instanceof MutableServiceMetadata"); } MutableServiceMetadata service = (MutableServiceMetadata)component; LOG.debug("decorateServiceType for {} - adding type property {}", service.getId(), attr.getValue()); service.addServiceProperty(createValue(context, TYPE_ATTR), createValue(context, attr.getValue())); return component; }