|
From: <tr...@us...> - 2003-09-17 16:43:37
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline
In directory sc8-pr-cvs1:/tmp/cvs-serv26113
Modified Files:
PipelineStage.java
Log Message:
extracted method 'splitAttributes' from the two processHelper methods that shared the identical code.
Index: PipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/PipelineStage.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** PipelineStage.java 16 Sep 2003 05:19:00 -0000 1.21
--- PipelineStage.java 17 Sep 2003 16:43:34 -0000 1.22
***************
*** 542,551 ****
/**
! * Do the hard work and then return each of the pipeline stage results. This really
! * is the heart of what each pipeline stage must do.
*
! * @return array of pipeline stage results.
*
! * @throws PipelineException for any processing issues
*/
public abstract PipelineStageResult[] process() throws PipelineException;
--- 542,552 ----
/**
! * Heart of the pipeline stage process - each actual pipeline stage
! * must provide implementation for this class to be concrete and,
! * indeed, to do useful work.
*
! * @return DOCUMENT ME!
*
! * @throws PipelineException DOCUMENT ME!
*/
public abstract PipelineStageResult[] process() throws PipelineException;
***************
*** 722,740 ****
new PipelineDocument(results[i].getBytes());
newDoc.setMimeType(mimeType);
! if ("true".equalsIgnoreCase(getOptions(SPLIT_ATTRIBUTES))) {
! // copy the attributes from the old document to the new document, minus NAME, MIME_TYPE, and DOM_KEY
! PipelineDocument oldDoc = getDocument();
! Set oldKeys = oldDoc.keys();
! for (Iterator j = oldKeys.iterator(); j.hasNext();) {
! String key = (String) j.next();
! if (!PipelineDocument.NAME.equals(key)
! && !PipelineDocument.MIME_TYPE.equals(key)
! && !DomifyPipelineStage.DOM_KEY.equals(key)) {
! Object value = oldDoc.get(key);
! newDoc.put(key, value);
! }
! }
! }
! psresults[i] = new PipelineStageResult(name, newDoc, newTicket);
}
--- 723,728 ----
new PipelineDocument(results[i].getBytes());
newDoc.setMimeType(mimeType);
! splitAttributes(newDoc);
! psresults[i] = new PipelineStageResult(name, newDoc, newTicket);
}
***************
*** 742,746 ****
}
! /**
* Another helper for the process methods. Convert a set of results into a
* an array of Pipeline Stage Result objects.
--- 730,756 ----
}
! /**
! * Copy the necessary attrbiutes from the old document to new document
! *
! * @param newDoc
! */
! private void splitAttributes(PipelineDocument newDoc) {
! if ("true".equalsIgnoreCase(getOptions(SPLIT_ATTRIBUTES))) {
! // copy the attributes from the old document to the new document, minus NAME, MIME_TYPE, and DOM_KEY
! PipelineDocument oldDoc = getDocument();
! Set oldKeys = oldDoc.keys();
! for (Iterator j = oldKeys.iterator(); j.hasNext();) {
! String key = (String) j.next();
! if (!PipelineDocument.NAME.equals(key)
! && !PipelineDocument.MIME_TYPE.equals(key)
! && !DomifyPipelineStage.DOM_KEY.equals(key)) {
! Object value = oldDoc.get(key);
! newDoc.put(key, value);
! }
! }
! }
! }
!
! /**
* Another helper for the process methods. Convert a set of results into a
* an array of Pipeline Stage Result objects.
***************
*** 765,782 ****
PipelineDocument newDoc =
new PipelineDocument(results[i].getBytes());
! if ("true".equalsIgnoreCase(getOptions(SPLIT_ATTRIBUTES))) {
! // copy the attributes from the old document to the new document, minus NAME, MIME_TYPE, and DOM_KEY
! PipelineDocument oldDoc = getDocument();
! Set oldKeys = oldDoc.keys();
! for (Iterator j = oldKeys.iterator(); j.hasNext();) {
! String key = (String) j.next();
! if (!PipelineDocument.NAME.equals(key)
! && !PipelineDocument.MIME_TYPE.equals(key)
! && !DomifyPipelineStage.DOM_KEY.equals(key)) {
! Object value = oldDoc.get(key);
! newDoc.put(key, value);
! }
! }
! }
psresults[i] = new PipelineStageResult(name, newDoc, newTicket);
}
--- 775,779 ----
PipelineDocument newDoc =
new PipelineDocument(results[i].getBytes());
! splitAttributes(newDoc);
psresults[i] = new PipelineStageResult(name, newDoc, newTicket);
}
***************
*** 835,841 ****
/**
* Get error handler defined specified for this stage. If no handler provided
! * or wrong class name set, then use default one.
! *
! * TODO: Should we throw Exception to indicate that configuration is wrong?
*
* @return
--- 832,837 ----
/**
* Get error handler defined specified for this stage. If no handler provided
! * or wrong class name set, then use default one. TODO: Should we throw
! * Exception to indicate that configuration is wrong?
*
* @return
|