Ejemplo n.º 1
0
 private void addProcessesFromConsoleDirectory(KnowledgeBase kbase, Properties consoleProperties) {
   String directory =
       System.getProperty("jbpm.console.directory") == null
           ? consoleProperties.getProperty("jbpm.console.directory")
           : System.getProperty("jbpm.console.directory");
   if (directory == null || directory.length() < 1) {
     logger.info(
         "jbpm.console.directory property not found - processes from local file system will not be loaded");
   } else {
     File file = new File(directory);
     if (!file.exists()) {
       throw new IllegalArgumentException("Could not find " + directory);
     }
     if (!file.isDirectory()) {
       throw new IllegalArgumentException(directory + " is not a directory");
     }
     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");
               }
             })) {
       logger.info("Loading process from file system: " + subfile.getName());
       kbuilder.add(ResourceFactory.newFileResource(subfile), ResourceType.BPMN2);
     }
     kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
   }
 }
Ejemplo n.º 2
0
 static {
   ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());
 }