* a <component> so something is missing/wrong. Also this doesn't seem to be picking up composites
* located in META-INF/deployables or specified in the sca-deployables.xml. Maybe the EmbeddedSCADomain
* and ContributionService APIs should make all this easier?
*/
protected void initContributions(EmbeddedSCADomain scaDomain, ClassLoader cl, URL[] contributionJars) {
ModelResolverImpl modelResolver = new ModelResolverImpl(cl);
ContributionService contributionService = scaDomain.getContributionService();
for (URL jar : contributionJars) {
InputStream is = null;
try {
is = jar.openStream();
contributionService.contribute(jar.toString(), jar, is , modelResolver);
} catch (Exception e) {
System.err.println("exception adding contribution: " + jar);
e.printStackTrace();
}
if (is != null) {
try {
is.close();
} catch (IOException e) {
// ignore
}
}
}
try {
for (Object m : modelResolver.getModels()) {
if (m instanceof Composite) {
Composite composite = (Composite)m;
scaDomain.getDomainComposite().getIncludes().add(composite);
scaDomain.getCompositeBuilder().build(composite);
scaDomain.getCompositeActivator().activate(composite);
}
}
for (Object m : modelResolver.getModels()) {
if (m instanceof Composite) {
Composite composite = (Composite)m;
scaDomain.getCompositeActivator().start(composite);
}
}