|
From: <jon...@us...> - 2003-07-15 15:07:58
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv8139/pipeline/stage
Modified Files:
RouterPipelineStage.java
Log Message:
Threading via the 'threaded' and 'maxThreads' attributes. 'splitAttributes'
copies document attributes to split pipeline stages.
Index: RouterPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/RouterPipelineStage.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** RouterPipelineStage.java 27 Jun 2003 02:19:59 -0000 1.9
--- RouterPipelineStage.java 15 Jul 2003 15:07:53 -0000 1.10
***************
*** 74,79 ****
import java.util.ArrayList;
import java.util.Collection;
! import java.util.Vector;
!
/**
--- 74,80 ----
import java.util.ArrayList;
import java.util.Collection;
! import java.util.TreeMap;
! import java.util.Iterator;
! import java.util.HashMap;
/**
***************
*** 99,102 ****
--- 100,104 ----
public static final String NEXTSTAGE = "nextStage";
private static final String NEXT_STAGE_NAME = "nextStageName";
+ private static final String ORDER = "order";
/**
***************
*** 145,149 ****
throws com.babeldoc.core.pipeline.PipelineException {
com.babeldoc.core.NameValuePair[] stages = this.getOptionList(new String[] { NEXTSTAGE });
! Vector vec = new Vector();
// Now templatize and enrich the document
--- 147,169 ----
throws com.babeldoc.core.pipeline.PipelineException {
com.babeldoc.core.NameValuePair[] stages = this.getOptionList(new String[] { NEXTSTAGE });
! com.babeldoc.core.NameValuePair[] orders = this.getOptionList(new String[]{ORDER});
!
! HashMap orderByStageName = new HashMap();
! if (orders != null) {
! for (int i = 0; i < orders.length; i++) {
! String stage = orders[i].getName();
! String orderStr = orders[i].getValue();
! Integer order = null;
! try {
! order = new Integer(orderStr);
! }
! catch (NumberFormatException nfe) {
! order = new Integer(stage.hashCode());
! }
! orderByStageName.put(stage, order);
! }
! }
!
! TreeMap tm = new TreeMap();
// Now templatize and enrich the document
***************
*** 154,159 ****
if (Boolean.valueOf(script).booleanValue()) {
! vec.addElement(new com.babeldoc.core.pipeline.PipelineStageResult(
! stage, getDocument(), getTicket()));
}
}
--- 174,183 ----
if (Boolean.valueOf(script).booleanValue()) {
! Integer order = (Integer)orderByStageName.get(stage);
! if (order == null) {
! order = new Integer(stage.hashCode());
! }
! com.babeldoc.core.pipeline.PipelineStageResult psr = new com.babeldoc.core.pipeline.PipelineStageResult(stage, getDocument(), getTicket());
! tm.put(order, psr);
}
}
***************
*** 161,168 ****
// If one or more routes where selected, then build the array
! if (vec.size() > 0) {
! com.babeldoc.core.pipeline.PipelineStageResult[] results = new com.babeldoc.core.pipeline.PipelineStageResult[vec.size()];
! vec.copyInto(results);
!
return results;
} else {
--- 185,196 ----
// If one or more routes where selected, then build the array
! if (tm.size() > 0) {
! int index = 0;
! com.babeldoc.core.pipeline.PipelineStageResult[] results = new com.babeldoc.core.pipeline.PipelineStageResult[tm.size()];
! for (Iterator i = tm.keySet().iterator(); i.hasNext(); ) {
! Object key = i.next();
! results[index++] = (com.babeldoc.core.pipeline.PipelineStageResult)tm.get(key);
! }
!
return results;
} else {
|