Search in sources :

Example 1 with ModellingManagerImpl

use of org.apache.aries.application.modelling.impl.ModellingManagerImpl in project aries by apache.

the class ModellerTest method getDifferentModelledResourceManagers.

@Parameters
public static List<Object[]> getDifferentModelledResourceManagers() {
    ModelledResourceManagerImpl manager = new ModelledResourceManagerImpl();
    manager.setModellingManager(new ModellingManagerImpl());
    manager.setParserProxy(ParserProxyTest.getMockParserServiceProxy());
    manager.setModellingPlugins(Collections.<ServiceModeller>emptyList());
    return Arrays.asList(new Object[][] { { OfflineModellingFactory.getModelledResourceManager() }, { manager } });
}
Also used : ModelledResourceManagerImpl(org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl) ModellingManagerImpl(org.apache.aries.application.modelling.impl.ModellingManagerImpl) Parameters(org.junit.runners.Parameterized.Parameters)

Example 2 with ModellingManagerImpl

use of org.apache.aries.application.modelling.impl.ModellingManagerImpl in project aries by apache.

the class OfflineModellingFactory method getOfflineParserProxy.

public static ParserProxy getOfflineParserProxy() {
    ModellingManagerImpl modellingManager = new ModellingManagerImpl();
    OfflineParserProxy parserProxy = new OfflineParserProxy();
    parserProxy.setModellingManager(modellingManager);
    return parserProxy;
}
Also used : ModellingManagerImpl(org.apache.aries.application.modelling.impl.ModellingManagerImpl)

Example 3 with ModellingManagerImpl

use of org.apache.aries.application.modelling.impl.ModellingManagerImpl 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)

Example 4 with ModellingManagerImpl

use of org.apache.aries.application.modelling.impl.ModellingManagerImpl in project aries by apache.

the class ApplicationStandaloneModellerTest method setup.

@Before
public void setup() {
    mrm = OfflineModellingFactory.getModelledResourceManager();
    mm = new ModellingManagerImpl();
}
Also used : ModellingManagerImpl(org.apache.aries.application.modelling.impl.ModellingManagerImpl) Before(org.junit.Before)

Example 5 with ModellingManagerImpl

use of org.apache.aries.application.modelling.impl.ModellingManagerImpl in project aries by apache.

the class DeploymentGeneratorTest method createModelledResource.

public static ModelledResource createModelledResource(String bundleName, String bundleVersion, Collection<String> importedPackages, Collection<String> exportedPackages) throws InvalidAttributeException {
    Attributes att = new Attributes();
    att.put(new Attributes.Name(Constants.BUNDLE_SYMBOLICNAME), bundleName);
    att.put(new Attributes.Name(Constants.BUNDLE_VERSION), bundleVersion);
    att.put(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION), "2");
    StringBuilder builder = new StringBuilder();
    for (String iPackage : importedPackages) {
        builder.append(iPackage).append(",");
    }
    if (builder.length() > 0) {
        builder.deleteCharAt(builder.length() - 1);
        att.put(new Attributes.Name(Constants.IMPORT_PACKAGE), builder.toString());
    }
    builder = new StringBuilder();
    for (String ePackage : exportedPackages) {
        builder.append(ePackage).append(",");
    }
    if (builder.length() > 0) {
        builder.deleteCharAt(builder.length() - 1);
        att.put(new Attributes.Name(Constants.EXPORT_PACKAGE), builder.toString());
    }
    return new ModellingManagerImpl().getModelledResource(null, att, null, null);
}
Also used : Attributes(java.util.jar.Attributes) ModellingManagerImpl(org.apache.aries.application.modelling.impl.ModellingManagerImpl)

Aggregations

ModellingManagerImpl (org.apache.aries.application.modelling.impl.ModellingManagerImpl)5 ModelledResourceManagerImpl (org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Attributes (java.util.jar.Attributes)1 ServiceModeller (org.apache.aries.application.modelling.ServiceModeller)1 Before (org.junit.Before)1 Parameters (org.junit.runners.Parameterized.Parameters)1 SAXException (org.xml.sax.SAXException)1