Search in sources :

Example 6 with ParsedServiceElements

use of org.apache.aries.application.modelling.ParsedServiceElements in project aries by apache.

the class ModelledResourceManagerImpl method getModelledResource.

public ModelledResource getModelledResource(String uri, IDirectory bundle) throws ModellerException {
    _logger.debug(LOG_ENTRY, "getModelledResource", new Object[] { uri, bundle });
    if (bundle != null) {
        BundleManifest bm = BundleManifest.fromBundle(bundle);
        ParsedServiceElements pse = getServiceElements(bm, bundle);
        return model(uri, bm, pse);
    } else {
        // The bundle does not exist
        ModellerException me = new ModellerException(MessageUtil.getMessage("INVALID_BUNDLE_LOCATION", bundle));
        _logger.debug(LOG_EXIT, "getModelledResource", me);
        throw me;
    }
}
Also used : BundleManifest(org.apache.aries.util.manifest.BundleManifest) ModellerException(org.apache.aries.application.modelling.ModellerException) ParsedServiceElements(org.apache.aries.application.modelling.ParsedServiceElements)

Example 7 with ParsedServiceElements

use of org.apache.aries.application.modelling.ParsedServiceElements in project aries by apache.

the class ModelledResourceManagerImpl method getBlueprintServiceElements.

private ParsedServiceElements getBlueprintServiceElements(BundleManifest bundleMf, Iterable<InputStream> blueprints) throws ModellerException {
    _logger.debug(LOG_ENTRY, "getServiceElements", new Object[] { bundleMf, blueprints });
    Set<ExportedService> services = new HashSet<ExportedService>();
    Set<ImportedService> references = new HashSet<ImportedService>();
    try {
        for (InputStream is : blueprints) {
            try {
                ParsedServiceElements pse = getParserProxy().parseAllServiceElements(is);
                services.addAll(pse.getServices());
                references.addAll(pse.getReferences());
            } finally {
                IOUtils.close(is);
            }
        }
    } catch (Exception e) {
        ModellerException m = new ModellerException(e);
        _logger.debug(LOG_EXIT, "getServiceElements", m);
        throw m;
    }
    ParsedServiceElements result = _modellingManager.getParsedServiceElements(services, references);
    _logger.debug(LOG_EXIT, "getServiceElements", result);
    return result;
}
Also used : ExportedService(org.apache.aries.application.modelling.ExportedService) ZipInputStream(java.util.zip.ZipInputStream) InputStream(java.io.InputStream) ModellerException(org.apache.aries.application.modelling.ModellerException) ImportedService(org.apache.aries.application.modelling.ImportedService) URISyntaxException(java.net.URISyntaxException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) InvalidAttributeException(org.apache.aries.application.InvalidAttributeException) ModellerException(org.apache.aries.application.modelling.ModellerException) HashSet(java.util.HashSet) ParsedServiceElements(org.apache.aries.application.modelling.ParsedServiceElements)

Aggregations

ParsedServiceElements (org.apache.aries.application.modelling.ParsedServiceElements)7 ExportedService (org.apache.aries.application.modelling.ExportedService)4 ImportedService (org.apache.aries.application.modelling.ImportedService)4 ModellerException (org.apache.aries.application.modelling.ModellerException)4 HashSet (java.util.HashSet)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 URISyntaxException (java.net.URISyntaxException)2 ArrayList (java.util.ArrayList)2 InvalidAttributeException (org.apache.aries.application.InvalidAttributeException)2 WrappedServiceMetadata (org.apache.aries.application.modelling.WrappedServiceMetadata)2 Test (org.junit.Test)2 InputStream (java.io.InputStream)1 LinkedHashSet (java.util.LinkedHashSet)1 ZipInputStream (java.util.zip.ZipInputStream)1 ServiceModeller (org.apache.aries.application.modelling.ServiceModeller)1 WrappedReferenceMetadata (org.apache.aries.application.modelling.WrappedReferenceMetadata)1 ComponentDefinitionRegistry (org.apache.aries.blueprint.ComponentDefinitionRegistry)1