Search in sources :

Example 1 with ServiceModeller

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

the class ModelledResourceManagerImpl method getServiceElements.

private ParsedServiceElements getServiceElements(BundleManifest bundleMf, IDirectory archive) throws ModellerException {
    Set<ExportedService> services = new HashSet<ExportedService>();
    Set<ImportedService> references = new HashSet<ImportedService>();
    try {
        ParsedServiceElements pse = getBlueprintServiceElements(bundleMf, findBlueprints(bundleMf, archive));
        services.addAll(pse.getServices());
        references.addAll(pse.getReferences());
        for (ServiceModeller sm : modellingPlugins) {
            pse = sm.modelServices(bundleMf, archive);
            services.addAll(pse.getServices());
            references.addAll(pse.getReferences());
        }
        return new ParsedServiceElementsImpl(services, references);
    } catch (Exception e) {
        throw new ModellerException(e);
    }
}
Also used : ServiceModeller(org.apache.aries.application.modelling.ServiceModeller) ExportedService(org.apache.aries.application.modelling.ExportedService) 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)

Example 2 with ServiceModeller

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

the class OfflineModellingFactory method getModelledResourceManager.

public static ModelledResourceManager getModelledResourceManager() {
    ModellingManagerImpl modellingManager = new ModellingManagerImpl();
    OfflineParserProxy parserProxy = new OfflineParserProxy();
    parserProxy.setModellingManager(modellingManager);
    ModelledResourceManagerImpl result = new ModelledResourceManagerImpl();
    result.setModellingManager(modellingManager);
    result.setParserProxy(parserProxy);
    List<ServiceModeller> plugins = new ArrayList<ServiceModeller>();
    ClassLoader cl = OfflineModellingFactory.class.getClassLoader();
    try {
        Enumeration<URL> e = cl.getResources("META-INF/services/" + ServiceModeller.class.getName());
        while (e.hasMoreElements()) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(e.nextElement().openStream()));
            try {
                plugins.add((ServiceModeller) Class.forName(reader.readLine(), true, cl).newInstance());
            } catch (Exception e1) {
                e1.printStackTrace(System.err);
            }
        }
    } catch (IOException e) {
        e.printStackTrace(System.err);
    }
    result.setModellingPlugins(plugins);
    return result;
}
Also used : ServiceModeller(org.apache.aries.application.modelling.ServiceModeller) ModelledResourceManagerImpl(org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl) InputStreamReader(java.io.InputStreamReader) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ModellingManagerImpl(org.apache.aries.application.modelling.impl.ModellingManagerImpl) URL(java.net.URL) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException) BufferedReader(java.io.BufferedReader)

Aggregations

IOException (java.io.IOException)2 ServiceModeller (org.apache.aries.application.modelling.ServiceModeller)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 InvalidAttributeException (org.apache.aries.application.InvalidAttributeException)1 ExportedService (org.apache.aries.application.modelling.ExportedService)1 ImportedService (org.apache.aries.application.modelling.ImportedService)1 ModellerException (org.apache.aries.application.modelling.ModellerException)1 ParsedServiceElements (org.apache.aries.application.modelling.ParsedServiceElements)1 ModelledResourceManagerImpl (org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl)1 ModellingManagerImpl (org.apache.aries.application.modelling.impl.ModellingManagerImpl)1 SAXException (org.xml.sax.SAXException)1