Search in sources :

Example 1 with ExtendedServiceReferenceMetadata

use of org.apache.aries.blueprint.ExtendedServiceReferenceMetadata in project aries by apache.

the class RecipeBuilder method createReferenceListRecipe.

private Recipe createReferenceListRecipe(ReferenceListMetadata metadata) {
    ValueRecipe filterRecipe = null;
    if (metadata instanceof ExtendedReferenceMetadata) {
        ValueMetadata filterMetadata = ((ExtendedServiceReferenceMetadata) metadata).getExtendedFilter();
        if (filterMetadata != null) {
            filterRecipe = (ValueRecipe) getValue(filterMetadata, null);
        }
    }
    CollectionRecipe listenersRecipe = null;
    if (metadata.getReferenceListeners() != null) {
        listenersRecipe = new CollectionRecipe(getName(null), ArrayList.class, Object.class.getName());
        for (ReferenceListener listener : metadata.getReferenceListeners()) {
            listenersRecipe.add(createRecipe(listener));
        }
    }
    ReferenceListRecipe recipe = new ReferenceListRecipe(getName(metadata.getId()), blueprintContainer, metadata, filterRecipe, listenersRecipe, getDependencies(metadata));
    return recipe;
}
Also used : ExtendedReferenceMetadata(org.apache.aries.blueprint.ExtendedReferenceMetadata) ValueMetadata(org.osgi.service.blueprint.reflect.ValueMetadata) ArrayList(java.util.ArrayList) ReferenceListener(org.osgi.service.blueprint.reflect.ReferenceListener) ExtendedServiceReferenceMetadata(org.apache.aries.blueprint.ExtendedServiceReferenceMetadata) ValueRecipe(org.apache.aries.blueprint.di.ValueRecipe) CollectionRecipe(org.apache.aries.blueprint.di.CollectionRecipe)

Example 2 with ExtendedServiceReferenceMetadata

use of org.apache.aries.blueprint.ExtendedServiceReferenceMetadata in project aries by apache.

the class RecipeBuilder method createReferenceRecipe.

private ReferenceRecipe createReferenceRecipe(ReferenceMetadata metadata) {
    ValueRecipe filterRecipe = null;
    if (metadata instanceof ExtendedReferenceMetadata) {
        ValueMetadata filterMetadata = ((ExtendedServiceReferenceMetadata) metadata).getExtendedFilter();
        if (filterMetadata != null) {
            filterRecipe = (ValueRecipe) getValue(filterMetadata, null);
        }
    }
    CollectionRecipe listenersRecipe = null;
    if (metadata.getReferenceListeners() != null) {
        listenersRecipe = new CollectionRecipe(getName(null), ArrayList.class, Object.class.getName());
        for (ReferenceListener listener : metadata.getReferenceListeners()) {
            listenersRecipe.add(createRecipe(listener));
        }
    }
    ReferenceRecipe recipe = new ReferenceRecipe(getName(metadata.getId()), blueprintContainer, metadata, filterRecipe, listenersRecipe, getDependencies(metadata));
    return recipe;
}
Also used : ExtendedReferenceMetadata(org.apache.aries.blueprint.ExtendedReferenceMetadata) ValueMetadata(org.osgi.service.blueprint.reflect.ValueMetadata) ArrayList(java.util.ArrayList) ReferenceListener(org.osgi.service.blueprint.reflect.ReferenceListener) ExtendedServiceReferenceMetadata(org.apache.aries.blueprint.ExtendedServiceReferenceMetadata) ValueRecipe(org.apache.aries.blueprint.di.ValueRecipe) CollectionRecipe(org.apache.aries.blueprint.di.CollectionRecipe)

Aggregations

ArrayList (java.util.ArrayList)2 ExtendedReferenceMetadata (org.apache.aries.blueprint.ExtendedReferenceMetadata)2 ExtendedServiceReferenceMetadata (org.apache.aries.blueprint.ExtendedServiceReferenceMetadata)2 CollectionRecipe (org.apache.aries.blueprint.di.CollectionRecipe)2 ValueRecipe (org.apache.aries.blueprint.di.ValueRecipe)2 ReferenceListener (org.osgi.service.blueprint.reflect.ReferenceListener)2 ValueMetadata (org.osgi.service.blueprint.reflect.ValueMetadata)2