Search in sources :

Example 1 with ReferenceListMetadata

use of org.osgi.service.blueprint.reflect.ReferenceListMetadata in project aries by apache.

the class AbstractParserProxy method parseCDRForReferences.

/**
	   * Extract References metadata from a ComponentDefinitionRegistry. 
	   * @param cdr                       ComponentDefinitionRegistry
	   * @return List<WrappedReferenceMetadata>
	   * @throws InvalidAttributeException 
	   */
private List<ImportedService> parseCDRForReferences(ComponentDefinitionRegistry cdr) throws InvalidAttributeException {
    _logger.debug(LOG_ENTRY, "parseCDRForReferences", new Object[] { cdr });
    List<ImportedService> result = new ArrayList<ImportedService>();
    for (ComponentMetadata compMetadata : findAllComponents(cdr)) {
        if (compMetadata instanceof ServiceReferenceMetadata) {
            ServiceReferenceMetadata referenceMetadata = (ServiceReferenceMetadata) compMetadata;
            boolean optional = referenceMetadata.getAvailability() == ServiceReferenceMetadata.AVAILABILITY_OPTIONAL;
            String iface = referenceMetadata.getInterface();
            String compName = referenceMetadata.getComponentName();
            String blueprintFilter = referenceMetadata.getFilter();
            String id = referenceMetadata.getId();
            boolean isMultiple = (referenceMetadata instanceof ReferenceListMetadata);
            // For now we blacklist certain objectClasses and filters - this is a pretty dreadful thing to do. 
            if (!isBlacklisted(iface, blueprintFilter)) {
                ImportedService ref = _modellingManager.getImportedService(optional, iface, compName, blueprintFilter, id, isMultiple);
                result.add(ref);
            }
        }
    }
    _logger.debug(LOG_EXIT, "parseCDRForReferences", new Object[] { result });
    return result;
}
Also used : ReferenceListMetadata(org.osgi.service.blueprint.reflect.ReferenceListMetadata) ArrayList(java.util.ArrayList) ImportedService(org.apache.aries.application.modelling.ImportedService) ComponentMetadata(org.osgi.service.blueprint.reflect.ComponentMetadata) ServiceReferenceMetadata(org.osgi.service.blueprint.reflect.ServiceReferenceMetadata)

Aggregations

ArrayList (java.util.ArrayList)1 ImportedService (org.apache.aries.application.modelling.ImportedService)1 ComponentMetadata (org.osgi.service.blueprint.reflect.ComponentMetadata)1 ReferenceListMetadata (org.osgi.service.blueprint.reflect.ReferenceListMetadata)1 ServiceReferenceMetadata (org.osgi.service.blueprint.reflect.ServiceReferenceMetadata)1