1 package org.jbpm.jpdl.par; 2 3 import java.io.*; 4 5 import org.jbpm.graph.def.*; 6 import org.jbpm.jpdl.*; 7 import org.jbpm.jpdl.xml.*; 8 9 public class JpdlArchiveParser implements ProcessArchiveParser { 10 11 public ProcessDefinition readFromArchive(ProcessArchive processArchive, ProcessDefinition processDefinition) { 12 try { 13 byte[] processBytes = processArchive.removeEntry("processdefinition.xml"); 15 16 if (processBytes==null) { 17 throw new JpdlException("no processdefinition.xml inside process archive"); 18 } 19 20 InputStream processInputStream = new ByteArrayInputStream(processBytes); 22 Reader processReader = new InputStreamReader(processInputStream); 23 JpdlXmlReader jpdlReader = new JpdlXmlReader(processReader); 24 25 try { 26 processDefinition = jpdlReader.readProcessDefinition(); 28 } catch (JpdlException e) { 29 e.printStackTrace(); 30 processArchive.getProblems().addAll(e.getProblems()); 32 } 33 34 jpdlReader.close(); 36 processReader.close(); 37 processInputStream.close(); 38 39 } catch (IOException e) { 40 processArchive.addWarning("io problem while reading processdefinition.xml: "+e.getMessage() ); 41 } 42 43 return processDefinition; 44 } 45 } 46 | Popular Tags |