public static KnowledgeSessionFactory newSessionFactory(KnowledgeComponentImplementationModel model, ClassLoader loader, ServiceDomain domain, Properties propertyOverrides) {
// XXX: how bad is this???
// make sure we can load jbpm classes in osgi environment
final ClassLoader origTCCL = Classes.setTCCL(loader);
try {
ManifestModel manifestModel = model.getManifest();
if (manifestModel != null) {
if (manifestModel.getContainer() == null) {
ResourcesModel resourcesModel = manifestModel.getResources();
if (resourcesModel != null) {
return new KnowledgeBuilderSessionFactory(model, loader, domain, propertyOverrides);
}
RemoteModel remoteModel = manifestModel.getRemote();
if (remoteModel != null) {
return new KnowledgeRemoteSessionFactory(model, loader, domain, propertyOverrides);
}
}
}