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);
}
}
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;
}
Aggregations