From: Santi B. <san...@us...> - 2007-08-04 11:37:56
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1742/modules/core/src/com/babeldoc/core/pipeline Modified Files: PipelineStage.java PipelineDocument.java Log Message: 2007-08-04 Added readme/doc with javadoc generation 2007-03-15 Many changes: - MailboxScanner can filter by field TO - Can debug MailboxScanner - Add timeout connection parameter to MailboxScanner - MailboxScanner obtain the value of the properties: 'to', 'from' and 'reply to' - Add three parameters that they allowed to deny a regular expression from filters (to,from and reply) - Add encoding parameter to Pipeline Writefile - Pipeline HttpClient save cookie information - Add parameter to pipeline HttpClient. It indicates if we want copy attributes in the new document - Pipeline HttpClient can send files in the parameters of POST method. To Manage the MIME types automatically (from the extension of the file) when adding attached files - Names of attached files in SmtpWriterPipelineStage don't contains absolute path - When decompressing a file in DecompressionPipeline, the name and the extension of the decompressed file it's original name Index: PipelineDocument.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/PipelineDocument.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** PipelineDocument.java 30 Jul 2004 01:33:02 -0000 1.23 --- PipelineDocument.java 4 Aug 2007 11:37:26 -0000 1.24 *************** *** 67,70 **** --- 67,71 ---- import com.babeldoc.core.INamed; + import com.babeldoc.core.LogService; import com.babeldoc.core.config.ConfigService; import com.babeldoc.core.config.IConfig; *************** *** 507,512 **** --- 508,519 ---- public String getEncoding() { if (encoding != null) { + if (LogService.getInstance().isDebugEnabled()) { + LogService.getInstance().logDebug("PipelineDocument.getEncoding():" + encoding); + } return encoding; } else { + if (LogService.getInstance().isDebugEnabled()) { + LogService.getInstance().logDebug("PipelineDocument.getEncoding() NULL Encoding return:" + System.getProperty("file.encoding")); + } return System.getProperty("file.encoding"); } Index: PipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/PipelineStage.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PipelineStage.java 30 Jul 2004 01:33:02 -0000 1.25 --- PipelineStage.java 4 Aug 2007 11:37:26 -0000 1.26 *************** *** 167,171 **** this.resolver = null; this.document = null; ! this.ticket = null; } --- 167,171 ---- this.resolver = null; this.document = null; ! this.ticket = null; } *************** *** 604,607 **** --- 604,610 ---- this.getDocument().setName(this.getOptions(DOCUMENT_NAME)); + LogService.getInstance().logDebug("PipelineStage.processStage document:" + this.getOptions(DOCUMENT_NAME)); + + //set mime-type this.getDocument().setMimeType(this.getOptions(INPUT_TYPE)); *************** *** 613,617 **** String outputType = this.getOptions(OUTPUT_TYPE); String encoding = this.getOptions(ENCODING); - for (int i = 0; i < psResults.length; i++) { psResults[i].document.setMimeType(outputType); --- 616,619 ---- *************** *** 727,730 **** --- 729,777 ---- } + /** + * Another helper for the process methods. Convert a set of results into a + * an array of Pipeline Stage Result objects. + * + * @param mimeType type of all of the results + * @param result the data for each result + * @param alAtr arrayList of Pair's Objects with atributes + * + * @return the array of results + * + * @throws PipelineException + * @throws JournalException + */ + protected PipelineStageResult[] processHelper(String mimeType,String result,ArrayList alAtr) + throws PipelineException, JournalException { + + LogService.getInstance().logDebug("PipelineStage.processHelper.debug"); + + IJournal journal = JournalFactory.getJournal(); + PipelineStageResult[] psresults = new PipelineStageResult[1]; + String name = this.getNextPipelineStageName(); + + IJournalTicket newTicket = journal.forkTicket(ticket); + PipelineDocument newDoc = new PipelineDocument(result.getBytes()); + newDoc.setMimeType(mimeType); + + LogService.getInstance().logDebug("PipelineStage.processHelper.debug create newDoc "); + + //Copy old atributes + splitAttributes(newDoc); + + LogService.getInstance().logDebug("PipelineStage.processHelper.debug add old atributes"); + + //Add new atributes + for (int i=0; i< alAtr.size(); i++){ + Pair atr = (Pair) alAtr.get(i); + newDoc.put(atr.getFirst().toString(), atr.getSecond()); + LogService.getInstance().logDebug("PipelineStage.processHelper.debug add new atributes, name:" + atr.getFirst().toString() + " value: " + atr.getSecond() ); + } + + psresults[0] = new PipelineStageResult(name, newDoc, newTicket); + + return psresults; + } + /** * Copy the necessary attrbiutes from the old document to new document. *************** *** 733,736 **** --- 780,785 ---- */ private void splitAttributes(PipelineDocument newDoc) { + LogService.getInstance().logDebug("PipelineStage.splitAttributes.debug SPLIT_ATTRIBUTES:" + getOptions(SPLIT_ATTRIBUTES) ); + if ("true".equalsIgnoreCase(getOptions(SPLIT_ATTRIBUTES))) { // copy the attributes from the old document to the new document, minus NAME, MIME_TYPE, and DOM_KEY |