ServiceReference[] refs = context.getAllServiceReferences(
"javax.jbi.component.Component", "(&(NAME=OdeBpelEngine))");
if (refs == null || refs.length != 1) {
throw new RuntimeException("no appropriate service :(");
}
ServiceUnitManager suM = ((Component) context.getService(refs[0]))
.getServiceUnitManager();
ClassLoader l = Thread.currentThread().getContextClassLoader();
try {
ClassLoader suL = suM.getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(new BundleClassLoader(suL, context.getBundle()));
suM.deploy(generatedName, rootDir.getAbsolutePath());
suM.init(generatedName, rootDir.getAbsolutePath());
suM.start(generatedName);
} finally {
Thread.currentThread().setContextClassLoader(l);
}
}