Author: ningjiang
Date: Wed Feb 22 03:33:01 2012
New Revision: 1292116

URL: http://svn.apache.org/viewvc?rev=1292116&view=rev
Log:
Merged revisions 1292114 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1292114 | ningjiang | 2012-02-22 11:19:44 +0800 (Wed, 22 Feb 2012) | 1 line
  
  CAMEL-5023 Fixed the issue that Printer endpoint can only print a single job.
........

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterOperations.java
    
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 22 03:33:01 2012
@@ -1 +1 @@
-/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864
+/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterOperations.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterOperations.java?rev=1292116&r1=1292115&r2=1292116&view=diff
==============================================================================
--- 
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterOperations.java
 (original)
+++ 
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterOperations.java
 Wed Feb 22 03:33:01 2012
@@ -39,7 +39,6 @@ import org.slf4j.LoggerFactory;
 public class PrinterOperations implements PrinterOperationsInterface {
     private static final transient Logger LOG = 
LoggerFactory.getLogger(PrinterOperations.class);
     private PrintService printService;
-    private DocPrintJob job;
     private DocFlavor flavor;
     private PrintRequestAttributeSet printRequestAttributeSet;
     private Doc doc;
@@ -49,7 +48,6 @@ public class PrinterOperations implement
         if (printService == null) {
             throw new PrintException("Printer lookup failure. No default 
printer set up for this host");
         }
-        job = printService.createPrintJob(); 
         flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
         printRequestAttributeSet = new HashPrintRequestAttributeSet();
         printRequestAttributeSet.add(new Copies(1));
@@ -57,10 +55,9 @@ public class PrinterOperations implement
         printRequestAttributeSet.add(Sides.ONE_SIDED);
     }
 
-    public PrinterOperations(PrintService printService, DocPrintJob job, 
DocFlavor flavor, PrintRequestAttributeSet printRequestAttributeSet) throws 
PrintException {
+    public PrinterOperations(PrintService printService, DocFlavor flavor, 
PrintRequestAttributeSet printRequestAttributeSet) throws PrintException {
         this();
         this.setPrintService(printService);
-        this.setJob(job);
         this.setFlavor(flavor);
         this.setPrintRequestAttributeSet(printRequestAttributeSet);
     }
@@ -104,6 +101,8 @@ public class PrinterOperations implement
     }
         
     public void print(Doc doc) throws PrintException {
+        // we need create a new job for each print 
+        DocPrintJob job = getPrintService().createPrintJob();
         job.print(doc, printRequestAttributeSet);
     }
 
@@ -114,15 +113,7 @@ public class PrinterOperations implement
     public void setPrintService(PrintService printService) {
         this.printService = printService;
     }
-
-    public DocPrintJob getJob() {
-        return job;
-    }
-
-    public void setJob(DocPrintJob job) {
-        this.job = job;
-    }
-
+    
     public DocFlavor getFlavor() {
         return flavor;
     }

Modified: 
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java?rev=1292116&r1=1292115&r2=1292116&view=diff
==============================================================================
--- 
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
 (original)
+++ 
camel/branches/camel-2.9.x/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
 Wed Feb 22 03:33:01 2012
@@ -150,7 +150,7 @@ public class PrinterProducer extends Def
         ObjectHelper.notNull(printService, "PrintService", this);
 
         if (printerOperations == null) {
-            printerOperations = new PrinterOperations(printService, 
assignPrintJob(printService), assignDocFlavor(), assignPrintAttributes());
+            printerOperations = new PrinterOperations(printService, 
assignDocFlavor(), assignPrintAttributes());
         }
         super.doStart();
     }


Reply via email to