PsToPDFTransactionCallback.java
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.pdfg.common.AESProperties
* com.adobe.pdfg.common.Utils
* com.adobe.pdfg.exception.PDFGError
* com.adobe.pdfg.exception.PDFGRuntimeException
* com.adobe.pdfg.logging.PDFGLogger
* com.adobe.ps2pdf.PsToPdfFailureException
* com.adobe.ps2pdf.PsToPdfFilePaths
* com.adobe.ps2pdf.PsToPdfFontPaths
* com.adobe.ps2pdf.PsToPdfService
* com.adobe.ps2pdf.PsToPdfServiceHelper
* com.adobe.service.ConnectionFactory
*/
package com.adobe.pdfg.callbacks;
import com.adobe.pdfg.common.AESProperties;
import com.adobe.pdfg.common.Utils;
import com.adobe.pdfg.exception.PDFGError;
import com.adobe.pdfg.exception.PDFGRuntimeException;
import com.adobe.pdfg.logging.PDFGLogger;
import com.adobe.pdfg.transaction.TransactionCallback;
import com.adobe.ps2pdf.PsToPdfFailureException;
import com.adobe.ps2pdf.PsToPdfFilePaths;
import com.adobe.ps2pdf.PsToPdfFontPaths;
import com.adobe.ps2pdf.PsToPdfService;
import com.adobe.ps2pdf.PsToPdfServiceHelper;
import com.adobe.service.ConnectionFactory;
import org.omg.CORBA.Object;
public class PsToPDFTransactionCallback
implements TransactionCallback {
private final ConnectionFactory psToPdfFactory;
private static final int MAX_RETRY_COUNT = 5;
private static final long WAIT_TIME = 60000;
private PsToPdfFilePaths m_filePaths;
private PsToPdfFontPaths m_fontPaths;
private boolean m_bUsePrologue;
private long m_ltimeout;
private PDFGLogger pdfgLogger = PDFGLogger.getPDFGLogger(PsToPDFTransactionCallback.class);
public PsToPDFTransactionCallback(ConnectionFactory psToPdfFactory) {
this.psToPdfFactory = psToPdfFactory;
this.psToPdfFactory.setServiceTimeout((long)AESProperties.getGlobalTimeout());
}
public java.lang.Object doInTransaction() {
String jobIdentityId = (String)Utils.threadLocalValue.get();
StringBuilder debugMsgs = new StringBuilder();
boolean debugMsgsLogged = false;
try {
debugMsgs.append("\nInside PsToPDFTransactionCallback.doInTransaction() for job=" + jobIdentityId);
Object connection = (Object)this.psToPdfFactory.getConnection();
debugMsgs.append("\nafter psToPdfFactory.getConnection() for job=" + jobIdentityId);
PsToPdfService service = PsToPdfServiceHelper.narrow((Object)connection);
debugMsgs.append("\nbefore service.convertToPdf() for job=" + jobIdentityId);
this.pdfgLogger.debug(debugMsgs.toString());
debugMsgsLogged = true;
service.convertToPdf(this.m_filePaths, this.m_fontPaths, this.m_bUsePrologue, this.m_ltimeout);
Boolean bl = Boolean.TRUE;
return bl;
}
catch (PsToPdfFailureException pfe) {
this.pdfgLogger.trace(pfe.getMessage(), null, (Throwable)pfe);
PDFGError error = new PDFGError(pfe.errorCode, (java.lang.Object)pfe.getMessage());
throw new PDFGRuntimeException(error);
}
finally {
if (!debugMsgsLogged) {
this.pdfgLogger.debug(debugMsgs.toString());
}
}
}
public void setUsePrologue(boolean usePrologue) {
this.m_bUsePrologue = usePrologue;
}
public void setFilePaths(PsToPdfFilePaths paths) {
this.m_filePaths = paths;
}
public void setFontPaths(PsToPdfFontPaths paths) {
this.m_fontPaths = paths;
}
public void setTimeout(int timeout) {
this.m_ltimeout = (long)timeout * 1000;
}
}