ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());
ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());
ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());
BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
for (File subfile: file.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".bpmn") || name.endsWith("bpmn2");
}})) {
kbuilder.add(ResourceFactory.newFileResource(subfile), ResourceType.BPMN2);
}