|
From: <tr...@us...> - 2003-08-06 03:23:53
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv29205/src/com/babeldoc/core/pipeline/simple
Modified Files:
SimplePipelineStageResolver.java
Log Message:
Changed the ad-hoc configuration scanning code with the csv reader code.
Index: SimplePipelineStageResolver.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple/SimplePipelineStageResolver.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SimplePipelineStageResolver.java 19 Jul 2003 15:32:27 -0000 1.6
--- SimplePipelineStageResolver.java 6 Aug 2003 03:23:41 -0000 1.7
***************
*** 72,77 ****
--- 72,80 ----
import com.babeldoc.core.pipeline.PipelineStageConfig;
import com.babeldoc.core.pipeline.PipelineStageResolver;
+ import com.mindprod.csv.CSVReader;
import java.util.Iterator;
+ import java.io.StringReader;
+ import java.io.IOException;
***************
*** 132,137 ****
// Also handle connections
else if (key.endsWith(NEXT_STAGE)) {
! String source = key.substring(0, key.length() - NEXT_STAGE.length() -
! 1);
setupNextStages(source, value);
} else if (key.equals(ENTRY_STAGE)) {
--- 135,139 ----
// Also handle connections
else if (key.endsWith(NEXT_STAGE)) {
! String source = key.substring(0, key.length() - NEXT_STAGE.length() - 1);
setupNextStages(source, value);
} else if (key.equals(ENTRY_STAGE)) {
***************
*** 143,164 ****
// point the working hashtable to the newly created map. If the last
// token is reached map the value to the name in the map.
! StringTokenizer st = new StringTokenizer(key, ".");
! int numTokens = st.countTokens();
! PipelineStageConfig working = stageConfig;
!
! int i = 1;
! while (st.hasMoreTokens()) {
! String token = st.nextToken();
! if (working.get(token) == null) {
! working.put(token, new PipelineStageConfig(token));
! }
! working = working.get(token);
! if (i++ == numTokens) {
! working.setValue(value);
}
}
}
--- 145,169 ----
// point the working hashtable to the newly created map. If the last
// token is reached map the value to the name in the map.
! CSVReader csvReader = new CSVReader(new StringReader(key), '.', '"', false, true);
! try {
! String [] tokens = csvReader.getAllFieldsInLine();
! int numTokens = tokens.length;
! PipelineStageConfig working = stageConfig;
! for (int j = 0; j < tokens.length; j++) {
! String token = tokens[j];
! if (working.get(token) == null) {
! working.put(token, new PipelineStageConfig(token));
! }
! working = working.get(token);
! if (j == numTokens-1) {
! working.setValue(value);
! }
}
+ } catch (IOException e) {
+ // This should never happen
}
}
|