KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > par > BpelArchiveParser


1 package org.jbpm.bpel.par;
2
3 import org.jbpm.bpel.def.BpelDefinition;
4 import org.jbpm.bpel.xml.BpelReader;
5 import org.jbpm.bpel.xml.ProblemCollector;
6 import org.jbpm.graph.def.ProcessDefinition;
7 import org.jbpm.jpdl.par.ProcessArchive;
8 import org.jbpm.jpdl.par.ProcessArchiveParser;
9
10 /**
11  * @author Alejandro Guízar
12  * @version $Revision: 1.10 $ $Date: 2005/06/23 20:45:05 $
13  */

14 public class BpelArchiveParser implements ProcessArchiveParser {
15   
16   /** {@inheritDoc} */
17   public ProcessDefinition readFromArchive(ProcessArchive archive, ProcessDefinition definition) {
18     //get a bpel reader
19
BpelReader reader = BpelReader.getInstance();
20     BpelDefinition bpelDefinition = (BpelDefinition) definition;
21     //set a problems collector
22
ProblemCollector readerProblems = new ProblemCollector(bpelDefinition.getLocation());
23     reader.setProblemHandler(readerProblems);
24     //read the process definition
25
reader.read((BpelDefinition) definition, archive);
26     //pump the problems from the bpel reader over to the processArchive
27
archive.getProblems().addAll(readerProblems.getProblems());
28     return definition;
29   }
30 }
31
Popular Tags