private ProcessDefinition parseProcessArchive(File processFile) throws IOException { log("parsing process archive " + processFile); ZipInputStream processStream = new ZipInputStream(new FileInputStream(processFile)); try { return ProcessDefinition.parseParZipInputStream(processStream); } finally { processStream.close(); } }
private ProcessDefinition parseProcessArchive(File processFile) throws IOException { log("parsing process archive " + processFile); ZipInputStream processStream = null; try { processStream = new ZipInputStream(new java.io.BufferedInputStream(java.nio.file.Files.newInputStream(processFile.toPath()))); return ProcessDefinition.parseParZipInputStream(processStream); } finally { if (processStream != null) { processStream.close(); } } }
/** * parse a process definition from a process archive resource. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseParResource(String parResource) throws IOException { return parseParZipInputStream(new ZipInputStream(ClassLoaderUtil.getStream(parResource))); }
/** * parse a process definition from a process archive resource. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseParResource(String parResource) throws IOException { return parseParZipInputStream(new ZipInputStream(ClassLoaderUtil.getStream(parResource))); }
/** * @return deployed ProcessDefinition */ public Object execute(JbpmContext jbpmContext) throws Exception { if (par == null && xml == null) { throw new JbpmException("either xml string or process archive must be given."); } ProcessDefinition processDefinition; boolean debug = log.isDebugEnabled(); if (par != null) { if (debug) log.debug("parsing process from archive"); // Thanks to George Mournos who helped to improve this: ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(par)); processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream); } else { if (debug) log.debug("parsing process from string"); processDefinition = ProcessDefinition.parseXmlString(xml); } jbpmContext.deployProcessDefinition(processDefinition); if (debug) log.debug(processDefinition + " deployed successfully"); return retrieveProcessDefinition(processDefinition); }
/** * @return deployed ProcessDefinition */ public Object execute(JbpmContext jbpmContext) throws Exception { if (par == null && xml == null) { throw new JbpmException("either xml string or process archive must be given."); } ProcessDefinition processDefinition; boolean debug = log.isDebugEnabled(); if (par != null) { if (debug) log.debug("parsing process from archive"); // Thanks to George Mournos who helped to improve this: ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(par)); processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream); } else { if (debug) log.debug("parsing process from string"); processDefinition = ProcessDefinition.parseXmlString(xml); } jbpmContext.deployProcessDefinition(processDefinition); if (debug) log.debug(processDefinition + " deployed successfully"); return retrieveProcessDefinition(processDefinition); }
ZipInputStream zis = new ZipInputStream(inputStream); try { processDefinition = ProcessDefinition.parseParZipInputStream(zis); final JbpmContext jbpmContext = context.getJbpmContext(); jbpmContext.deployProcessDefinition(processDefinition);