Search in sources :

Example 1 with MutableComponentMetadata

use of org.apache.aries.blueprint.mutable.MutableComponentMetadata in project aries by apache.

the class CmNamespaceHandler method decorateCmProperties.

private ComponentMetadata decorateCmProperties(ParserContext context, Element element, ComponentMetadata component) {
    generateIdIfNeeded(context, ((MutableComponentMetadata) component));
    MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
    metadata.setProcessor(true);
    metadata.setId(getId(context, element));
    metadata.setRuntimeClass(CmProperties.class);
    String persistentId = element.getAttribute(PERSISTENT_ID_ATTRIBUTE);
    // ManagedService if the persistentId is not an empty string.
    if (persistentId.length() > 0) {
        metadata.setInitMethod("init");
        metadata.setDestroyMethod("destroy");
    }
    metadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
    metadata.addProperty("configAdmin", createConfigurationAdminRef(context));
    metadata.addProperty("managedObjectManager", createRef(context, MANAGED_OBJECT_MANAGER_NAME));
    metadata.addProperty("persistentId", createValue(context, persistentId));
    if (element.hasAttribute(UPDATE_ATTRIBUTE)) {
        metadata.addProperty("update", createValue(context, element.getAttribute(UPDATE_ATTRIBUTE)));
    }
    metadata.addProperty("serviceId", createIdRef(context, component.getId()));
    context.getComponentDefinitionRegistry().registerComponentDefinition(metadata);
    return component;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) MutableComponentMetadata(org.apache.aries.blueprint.mutable.MutableComponentMetadata)

Aggregations

MutableBeanMetadata (org.apache.aries.blueprint.mutable.MutableBeanMetadata)1 MutableComponentMetadata (org.apache.aries.blueprint.mutable.MutableComponentMetadata)1