private String generateId(ParserContext context) { String id; do { id = ".cm-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private String getName(String name) { if (name == null) { do { name = "#recipe-" + recipeIdSpace.nextId(); } while (names.contains(name) || registry.containsComponentDefinition(name)); } names.add(name); return name; }
private String generateId(ParserContext context) { String id; do { id = ".cm-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private String getName(String name) { if (name == null) { do { name = "#recipe-" + recipeIdSpace.nextId(); } while (names.contains(name) || registry.containsComponentDefinition(name)); } names.add(name); return name; }
private String generateId(ParserContext context) { String id; do { id = ".jaas-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private String generateId(ParserContext context) { String id; do { id = ".cm-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private String generateId(ParserContext context) { String id; do { id = ".drools-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; } private int idCounter;
private String generateId(ParserContext context) { String id; do { id = ".ext-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private String generateId(ParserContext context) { String id; do { id = ".drools-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; } private int idCounter;
private String generateId(ParserContext context) { String id; do { id = ".cm-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private String generateId(ParserContext context) { String id; do { id = ".ext-" + ++idCounter; } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id)); return id; }
private void parseElement(Element elt, ParserContext pc) { LOGGER.debug("parser asked to parse element {} ", elt.getNodeName()); ComponentDefinitionRegistry cdr = pc.getComponentDefinitionRegistry(); if ("enable".equals(elt.getLocalName())) { Node n = elt.getChildNodes().item(0); if ((n == null || Boolean.parseBoolean(n.getNodeValue())) && !cdr.containsComponentDefinition(ANNOTATION_PARSER_BEAN_NAME)) { LOGGER.debug("Enabling annotation based transactions"); MutableBeanMetadata meta = createAnnotationParserBean(pc, cdr); cdr.registerComponentDefinition(meta); } } }
private void parseElement(Element elt, ParserContext pc) { ComponentDefinitionRegistry cdr = pc.getComponentDefinitionRegistry(); if ("enable".equals(elt.getLocalName()) && !cdr.containsComponentDefinition(JpaComponentProcessor.class.getSimpleName())) { MutableBeanMetadata meta = pc.createMetadata(MutableBeanMetadata.class); meta.setId(JpaComponentProcessor.class.getSimpleName()); meta.setRuntimeClass(JpaComponentProcessor.class); meta.setProcessor(true); meta.addProperty("pc", passThrough(pc, pc)); cdr.registerComponentDefinition(meta); } }
private void registerConverters(ParserContext context) { String converterName = "." + NumberToStringConverter.class.getName(); if (!context.getComponentDefinitionRegistry().containsComponentDefinition(converterName)) { MutablePassThroughMetadata cnv = context.createMetadata(MutablePassThroughMetadata.class); cnv.setId(converterName); cnv.setObject(new NumberToStringConverter()); context.getComponentDefinitionRegistry().registerTypeConverter(cnv); } }
public Metadata parse(Element element, ParserContext context) { if (!context.getComponentDefinitionRegistry() .containsComponentDefinition(SoapVersionTypeConverter.class.getName())) { MutablePassThroughMetadata md = context.createMetadata(MutablePassThroughMetadata.class); md.setObject(new SoapVersionTypeConverter()); md.setId(SoapVersionTypeConverter.class.getName()); context.getComponentDefinitionRegistry().registerTypeConverter(md); } MutableBeanMetadata cxfBean = context.createMetadata(MutableBeanMetadata.class); cxfBean.setRuntimeClass(SoapBindingConfiguration.class); parseAttributes(element, context, cxfBean); parseChildElements(element, context, cxfBean); return cxfBean; }
public Metadata parse(Element element, ParserContext context) { if (!context.getComponentDefinitionRegistry() .containsComponentDefinition(SoapVersionTypeConverter.class.getName())) { MutablePassThroughMetadata md = context.createMetadata(MutablePassThroughMetadata.class); md.setObject(new SoapVersionTypeConverter()); md.setId(SoapVersionTypeConverter.class.getName()); context.getComponentDefinitionRegistry().registerTypeConverter(md); } MutableBeanMetadata cxfBean = context.createMetadata(MutableBeanMetadata.class); cxfBean.setRuntimeClass(SoapBindingConfiguration.class); parseAttributes(element, context, cxfBean); parseChildElements(element, context, cxfBean); return cxfBean; }
protected MutableBeanMetadata getBus(ParserContext context, String name) { ComponentDefinitionRegistry cdr = context.getComponentDefinitionRegistry(); ComponentMetadata meta = cdr.getComponentDefinition("blueprintBundle"); if (!cdr.containsComponentDefinition(InterceptorTypeConverter.class.getName())) { MutablePassThroughMetadata md = context.createMetadata(MutablePassThroughMetadata.class); md.setObject(new InterceptorTypeConverter()); md.setId(InterceptorTypeConverter.class.getName()); context.getComponentDefinitionRegistry().registerTypeConverter(md); } if (!cdr.containsComponentDefinition(name)) { //Create a bus MutableBeanMetadata bus = context.createMetadata(MutableBeanMetadata.class); bus.setId(name); bus.setRuntimeClass(BlueprintBus.class); if (meta != null) { //blueprint-no-osgi does not provide a bundleContext bus.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); } bus.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); bus.setDestroyMethod("shutdown"); bus.setInitMethod("initialize"); context.getComponentDefinitionRegistry().registerComponentDefinition(bus); return bus; } return (MutableBeanMetadata) cdr.getComponentDefinition(name); }
protected MutableBeanMetadata getBus(ParserContext context, String name) { ComponentDefinitionRegistry cdr = context.getComponentDefinitionRegistry(); ComponentMetadata meta = cdr.getComponentDefinition("blueprintBundle"); Bundle blueprintBundle = null; if (meta instanceof PassThroughMetadata) { blueprintBundle = (Bundle) ((PassThroughMetadata) meta).getObject(); } if (!cdr.containsComponentDefinition(InterceptorTypeConverter.class.getName())) { MutablePassThroughMetadata md = context.createMetadata(MutablePassThroughMetadata.class); md.setObject(new InterceptorTypeConverter()); md.setId(InterceptorTypeConverter.class.getName()); context.getComponentDefinitionRegistry().registerTypeConverter(md); } if (blueprintBundle != null && !cdr.containsComponentDefinition(name)) { //Create a bus MutableBeanMetadata bus = context.createMetadata(MutableBeanMetadata.class); bus.setId(name); bus.setRuntimeClass(BlueprintBus.class); bus.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); bus.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); bus.setDestroyMethod("shutdown"); bus.setInitMethod("initialize"); context.getComponentDefinitionRegistry().registerComponentDefinition(bus); return bus; } return (MutableBeanMetadata) cdr.getComponentDefinition(name); }
protected MutableBeanMetadata getBus(ParserContext context, String name) { ComponentDefinitionRegistry cdr = context.getComponentDefinitionRegistry(); ComponentMetadata meta = cdr.getComponentDefinition("blueprintBundle"); if (!cdr.containsComponentDefinition(InterceptorTypeConverter.class.getName())) { MutablePassThroughMetadata md = context.createMetadata(MutablePassThroughMetadata.class); md.setObject(new InterceptorTypeConverter()); md.setId(InterceptorTypeConverter.class.getName()); context.getComponentDefinitionRegistry().registerTypeConverter(md); } if (!cdr.containsComponentDefinition(name)) { //Create a bus MutableBeanMetadata bus = context.createMetadata(MutableBeanMetadata.class); bus.setId(name); bus.setRuntimeClass(BlueprintBus.class); if (meta != null) { //blueprint-no-osgi does not provide a bundleContext bus.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); } bus.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); bus.setDestroyMethod("shutdown"); bus.setInitMethod("initialize"); context.getComponentDefinitionRegistry().registerComponentDefinition(bus); return bus; } return (MutableBeanMetadata) cdr.getComponentDefinition(name); }
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); }