Native2PdfCaller.java
82.8 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.aemfd.docmanager.Document
* com.adobe.aemfd.docmanager.TempFileManager
* com.adobe.native2pdf.bmc.AppMonData
* com.adobe.native2pdf.bmc.ResultStruct
* com.adobe.native2pdf.xml.FiletypeSettings
* com.adobe.native2pdf.xml.FiletypeSettings$Settings
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$Acrobat
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$AdobeFlash
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$AutoCAD
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$GenericApp
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$Html2Pdf
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$Image
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$MSExcel
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$MSPowerpoint
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$MSProject
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$MSPublisher
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$MSVisio
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$MSWord
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$Optimizer
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$PDFExport
* com.adobe.native2pdf.xml.FiletypeSettings$Settings$XPS
* com.adobe.native2pdf.xml.InitialView
* com.adobe.native2pdf.xml.JobOptions
* com.adobe.native2pdf.xml.JobOptions$JobOption
* com.adobe.native2pdf.xml.PDFMaker
* com.adobe.native2pdf.xml.SecuritySettings
* com.adobe.native2pdf.xml.SecuritySettings$Settings
* com.adobe.pdfg.common.AESProperties
* com.adobe.pdfg.common.Constants
* com.adobe.pdfg.common.FileTypeAnalyzer
* com.adobe.pdfg.common.FileUtilities
* com.adobe.pdfg.common.Guid
* com.adobe.pdfg.common.JobConfiguration
* com.adobe.pdfg.common.PDFGGlobalCache
* com.adobe.pdfg.common.Utils
* com.adobe.pdfg.config.PDFGConfigUtility
* com.adobe.pdfg.exception.ConversionException
* com.adobe.pdfg.exception.FileFormatNotSupportedException
* com.adobe.pdfg.exception.InvalidParameterException
* com.adobe.pdfg.logging.PDFGLogger
* com.adobe.pdfg.service.api.PDFGConfigService
* com.adobe.service.ConnectionFactory
* org.apache.commons.io.FileUtils
*/
package com.adobe.pdfg.impl;
import com.adobe.aemfd.docmanager.Document;
import com.adobe.aemfd.docmanager.TempFileManager;
import com.adobe.native2pdf.bmc.AppMonData;
import com.adobe.native2pdf.bmc.ResultStruct;
import com.adobe.native2pdf.xml.FiletypeSettings;
import com.adobe.native2pdf.xml.InitialView;
import com.adobe.native2pdf.xml.JobOptions;
import com.adobe.native2pdf.xml.PDFMaker;
import com.adobe.native2pdf.xml.SecuritySettings;
import com.adobe.pdfg.callbacks.ImageToPDFTransactionCallback;
import com.adobe.pdfg.callbacks.NativeToPDFTransactionCallback;
import com.adobe.pdfg.callbacks.SwfToPDFTransactionCallback;
import com.adobe.pdfg.common.AESProperties;
import com.adobe.pdfg.common.Constants;
import com.adobe.pdfg.common.FileTypeAnalyzer;
import com.adobe.pdfg.common.FileUtilities;
import com.adobe.pdfg.common.Guid;
import com.adobe.pdfg.common.JobConfiguration;
import com.adobe.pdfg.common.PDFGGlobalCache;
import com.adobe.pdfg.common.Utils;
import com.adobe.pdfg.config.PDFGConfigUtility;
import com.adobe.pdfg.exception.ConversionException;
import com.adobe.pdfg.exception.FileFormatNotSupportedException;
import com.adobe.pdfg.exception.InvalidParameterException;
import com.adobe.pdfg.impl.BMCCaller;
import com.adobe.pdfg.impl.GeneratePDFServiceImpl;
import com.adobe.pdfg.impl.GeneratePDFUtil;
import com.adobe.pdfg.logging.PDFGLogger;
import com.adobe.pdfg.postprocess.PdfPostProcessorUtilities;
import com.adobe.pdfg.postprocess.PostProcessFileInfo;
import com.adobe.pdfg.service.api.PDFGConfigService;
import com.adobe.pdfg.transaction.TransactionCallback;
import com.adobe.service.ConnectionFactory;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Semaphore;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import org.apache.commons.io.FileUtils;
import org.omg.CORBA.COMM_FAILURE;
public class Native2PdfCaller
extends BMCCaller {
static final long serialVersionUID = 2301;
static int IMAGE_TO_PDF_POOL_SIZE = 3;
static int SWF_TO_PDF_POOL_SIZE = 3;
static int NATIVE_TO_PDF_POOL_SIZE = 1;
static int pdfm_pool_size = 1;
private static final String ExportContentDir = "pdfg_export";
private static final boolean debugAppMon = System.getenv("PDFG_APPMON_DEBUG") != null;
private static final String APPMON_SCRIPT_DIR = "C:/temp/";
private static final String PDF_TO_PDF = "PDF-To-PDF";
private static final String ConvertedDocKey = "ConvertedDoc";
private static final int FILE_PATH_LENGTH_LIMIT = 217;
private static final long MIN_SECONDS_TO_ALLOW_CONVERSION = 15;
private static Map<String, String> m_ExportTypeMapping = new HashMap<String, String>();
private static Set<String> m_OptimizeTypeSet = new HashSet<String>();
private static Map<String, String> m_ExportContentTypeMapping = new HashMap<String, String>();
private static String m_AppmonLocale = "en_US";
private static Boolean isMSOffice2003 = null;
private static boolean isWindows64bitOs = false;
private static String osName = System.getProperty("os.name").toLowerCase();
private static Boolean isSingleThreaded = null;
private static RetryLogic retryLogic = RetryLogic.RETRY;
private static JAXBContext appMonJAXBContext = null;
private static Hashtable<String, AppMonData> m_appMonData = new Hashtable();
private static Semaphore imageConversionLock = null;
private static Semaphore nativeConversionLock = null;
private static Semaphore pdfmConversionLock = null;
private static Semaphore swfToPDFLock = null;
private String NATIVE_IN_XMP_FILENAME = "xmp-in.xmp";
/*
* Unable to fully structure code
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
public Map exportPDF(GeneratePDFServiceImpl coreSvcImpl, Document sourceFileDoc, String inputFileName, String formatType, Document jobConfigDoc) throws ConversionException, FileFormatNotSupportedException, InvalidParameterException {
settingsDoc = jobConfigDoc;
format = null;
v0 = isCurrentOSWindows = Native2PdfCaller.osName.indexOf("windows") > -1;
if (!isCurrentOSWindows) {
throw new ConversionException(11035);
}
if ((formatType == null || "".equals(formatType)) && settingsDoc == null) {
format = "HTML32";
try {
defaultFileTypeSetting = (String)coreSvcImpl.getConfigService().getDefaultSettingsNames().get("filetypesettings");
formatType = (String)((Map)coreSvcImpl.getConfigService().getFiletypeSettingByName(defaultFileTypeSetting).get("pdfexportmap")).get("exportto");
if (Native2PdfCaller.m_ExportTypeMapping.get(formatType) == null) ** GOTO lbl33
format = formatType;
}
catch (Exception e) {
if (e instanceof InvalidParameterException != false) throw (InvalidParameterException)e;
throw new ConversionException(11015, (Throwable)e);
}
} else if (formatType != null && !"".equals(formatType)) {
if (Native2PdfCaller.m_ExportTypeMapping.get(formatType) == null) {
throw new InvalidParameterException(80011, formatType);
}
format = formatType;
} else {
jobConfig = null;
try {
jobConfigurationString = GeneratePDFUtil.getJobConfigurationString(coreSvcImpl.getConfigService(), settingsDoc, null, null, null);
jobConfig = PDFGGlobalCache.getJobConfiguration((String)jobConfigurationString);
}
catch (JAXBException e) {
throw new InvalidParameterException(1001, (Throwable)e);
}
formatType = jobConfig.getFiletypeSettings().getPDFExport().getExportTo();
if (Native2PdfCaller.m_ExportTypeMapping.get(formatType) == null) {
throw new InvalidParameterException(80011, formatType);
}
format = formatType;
}
lbl33: // 4 sources:
if (settingsDoc != null) return this.callNativeBMC(coreSvcImpl, sourceFileDoc, inputFileName, formatType, settingsDoc, null, null, false, true, false, false);
try {
xml = coreSvcImpl.getConfigService().getPDFExportXML(format, this.timeoutSeconds);
settingsDoc = new Document(xml.getBytes("UTF-8"));
return this.callNativeBMC(coreSvcImpl, sourceFileDoc, inputFileName, formatType, settingsDoc, null, null, false, true, false, false);
}
catch (Exception e) {
if (e instanceof InvalidParameterException != false) throw (InvalidParameterException)e;
throw new ConversionException(11015, (Throwable)e);
}
}
public Map optimizePDF(GeneratePDFServiceImpl coreSvcImpl, Document sourceFileDoc, String inputFileName, String jobConfigurationString, Document jobConfigDoc) throws ConversionException, FileFormatNotSupportedException, InvalidParameterException {
boolean isCurrentOSWindows;
Document settingsDoc = jobConfigDoc;
boolean bl = isCurrentOSWindows = osName.indexOf("windows") > -1;
if (!isCurrentOSWindows) {
throw new ConversionException(11039);
}
String outputPDFVersion = null;
try {
if (jobConfigurationString == null) {
jobConfigurationString = GeneratePDFUtil.getJobConfigurationString(coreSvcImpl.getConfigService(), jobConfigDoc, null, null, null);
}
this.config = PDFGGlobalCache.getJobConfiguration((String)jobConfigurationString);
FiletypeSettings.Settings.Optimizer optimizerConfig = this.config.getFiletypeSettings().getOptimizer();
if (optimizerConfig == null) {
throw new InvalidParameterException(80025);
}
outputPDFVersion = optimizerConfig.getTargetPDFVersion();
if (outputPDFVersion == null || "".equals(outputPDFVersion.trim())) {
throw new InvalidParameterException(11038);
}
}
catch (JAXBException e) {
throw new InvalidParameterException(1001, (Throwable)e);
}
if (!m_OptimizeTypeSet.contains(outputPDFVersion)) {
throw new InvalidParameterException(80024, outputPDFVersion);
}
Map returnMap = this.callNativeBMC(coreSvcImpl, sourceFileDoc, inputFileName, outputPDFVersion, settingsDoc, jobConfigurationString, null, false, false, true, false);
return returnMap;
}
public Map createPDF(GeneratePDFServiceImpl coreSvcImpl, Document sourceFileDoc, String inputFileName, boolean isHtmlToPDF, String formatType, Document jobConfigDoc, String jobConfigurationString, Document xmpFileDoc, boolean fallbackRoute) throws ConversionException, FileFormatNotSupportedException, InvalidParameterException {
return this.callNativeBMC(coreSvcImpl, sourceFileDoc, inputFileName, formatType, jobConfigDoc, jobConfigurationString, xmpFileDoc, isHtmlToPDF, false, false, fallbackRoute);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Unable to fully structure code
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Converted monitor instructions to comments
* Lifted jumps to return sites
*/
public Map callNativeBMC(GeneratePDFServiceImpl coreSvcImpl, Document sourceFileDoc, String inputFileName, String formatType, Document jobConfigDoc, String jobConfigurationString, Document xmpFileDoc, boolean isHtmlToPDF, boolean doExport, boolean doOptimize, boolean isfallbackRoute) throws ConversionException, FileFormatNotSupportedException, InvalidParameterException {
debugMsgsLogged = false;
jobIdentityId = (String)Utils.threadLocalValue.get();
debugMsgs = new StringBuilder();
success = true;
agent = null;
jobOptionFile = null;
startTime = 0;
waitStartTime = 0;
waitEndTime = 0;
appName = null;
pdfgTmpDir = null;
inputFile = null;
startTime = System.currentTimeMillis();
try {
try {
debugMsgs.append("\nInside Native2PdfCaller.callNativeBMC for job=" + jobIdentityId);
if (sourceFileDoc == null) {
throw new InvalidParameterException(11025);
}
sourceFile = null;
extension = null;
inFileName = inputFileName;
if (isHtmlToPDF) {
inFileName = "WebCapture.html";
extension = "html";
} else {
extStartsAt = inputFileName.lastIndexOf(46);
if (extStartsAt != -1) {
extension = inputFileName.substring(extStartsAt + 1);
}
inputFile = PDFGConfigUtility.getFile((Document)sourceFileDoc, (File)coreSvcImpl.getTempFileManager().getTempFile());
if (extension == null) {
extension = this.getExtOfUnknownFileType(inputFile);
if (extension == null) {
contentType = sourceFileDoc.getContentType();
if (contentType.equals("text/html")) {
extension = "html";
} else if (contentType.equals("text/plain")) {
extension = "txt";
} else if (contentType.equals("text/enriched") || contentType.equals("text/richtext")) {
extension = "rtf";
} else if (contentType.equals("image/gif")) {
extension = "gif";
} else if (contentType.equals("image/jpeg")) {
extension = "jpeg";
} else if (contentType.equals("image/tiff")) {
extension = "tiff";
} else if (contentType.equals("image/x-png")) {
extension = "png";
} else if (contentType.equals("image/vnd.dwg")) {
extension = "dwg";
} else if (contentType.equals("application/postscript")) {
extension = "ps";
} else if (contentType.equals("application/rtf")) {
extension = "rtf";
} else if (contentType.equals("application/pdf")) {
extension = "pdf";
} else if (contentType.equals("application/msword")) {
extension = "docx";
} else if (contentType.equals("application/zip")) {
extension = "zip";
} else if (contentType.equals("application/mspowerpoint") || contentType.equals("application/vnd ms-powerpoint") || contentType.equals("application/ms-powerpoint")) {
extension = "pptx";
} else if (contentType.equals("application/ms-excel") || contentType.equals("application/msexcel") || contentType.equals("application/vnd ms-excel") || contentType.equals("application/x-msexcel")) {
extension = "xlsx";
}
if (extension == null) throw new InvalidParameterException(80002);
inFileName = inputFileName + "." + extension;
} else {
inFileName = inputFileName + "." + extension;
}
}
}
extension = extension.toLowerCase();
extensionPlusDotLength = extension.length() + 1;
guidString = new Guid().toString();
try {
pdfgTmpDir = FileUtilities.createGuidDir((String)guidString);
}
catch (IOException ioe) {
throw new ConversionException(1003, (Throwable)ioe);
}
debugMsgs.append("\ncreated pdfgTmpDir for job=" + jobIdentityId);
if (Native2PdfCaller.osName.contains("win") && Native2PdfCaller.isMSOffice2003 == null && (processorArch = System.getenv("PROCESSOR_ARCHITECTURE")) != null && processorArch.contains("64")) {
Native2PdfCaller.isWindows64bitOs = true;
Native2PdfCaller.isMSOffice2003 = this.isMSOffice2003(pdfgTmpDir.getAbsolutePath());
}
if (Native2PdfCaller.osName.contains("win")) {
debugMsgs.append("\nOS is " + System.getProperty("os.name") + " for job=" + jobIdentityId);
fileNameLength = inFileName.length();
tempDirPathLength = pdfgTmpDir.getAbsolutePath().length();
if (tempDirPathLength + fileNameLength > 217 && (fileLocaPathLength = 217 - tempDirPathLength - extensionPlusDotLength) > 0 && !isHtmlToPDF) {
inFileName = inputFileName.substring(0, fileLocaPathLength);
index = inFileName.lastIndexOf(".");
if (index != -1) {
inFileName = inFileName.substring(0, index);
}
inFileName = inFileName + "." + extension;
}
}
debugMsgs.append("\ninFileName=" + inFileName + " for job=" + jobIdentityId);
sourceFile = new File(pdfgTmpDir, inFileName);
sourceFileDoc.copyToFile(sourceFile);
sourceFileDoc = null;
this.pdfgLogger.info("001-024", new Object[]{inputFileName, new Date(startTime), jobIdentityId});
if (!doExport) {
this.pdfgLogger.info("001-016", new Object[]{inputFileName, "Convert to PDF"});
} else {
this.pdfgLogger.info("001-016", new Object[]{inputFileName, "PDF Export"});
}
errorCode = 1001;
errorCode = this.initializeConfiguration(coreSvcImpl, jobConfigDoc, jobConfigurationString, errorCode);
if (isHtmlToPDF && (html2pdf = this.config.getFiletypeSettings().getHtml2Pdf()) != null) {
this.initialViewConfig = html2pdf.getInitialView();
}
debugMsgs.append("\nAfter calling initializeConfiguration.errorCode=" + errorCode + " for job=" + jobIdentityId);
this.pdfgLogger.info("001-022", new Object[]{inputFileName, this.config.getSecuritySettings().getName()});
this.pdfgLogger.info("001-023", new Object[]{inputFileName, this.config.getFiletypeSettings().getName()});
xmpFile = null;
if (xmpFileDoc != null) {
xmpFile = new File(pdfgTmpDir, this.NATIVE_IN_XMP_FILENAME);
xmpFileDoc.copyToFile(xmpFile);
this.pdfgLogger.info("001-020", new Object[]{inputFileName, xmpFile.getName()});
}
pdfProducerString = null;
bCallImage2PdfBmc = false;
bCallSwf2PdfBmc = false;
appMonBaseName = null;
serviceName = null;
destinationPath = null;
sourcePathOrURL = sourceFile.getCanonicalPath();
if (doOptimize) {
debugMsgs.append("\nsetting targetPDFVersion for job=" + jobIdentityId);
this.appConfig = this.filetypeSettings.getOptimizer();
((FiletypeSettings.Settings.Optimizer)this.appConfig).setTargetPDFVersion(formatType);
} else if (extension.equalsIgnoreCase("pdf") && !doExport) {
this.appConfig = this.config.getAppConfigByExtension(this.filetypeSettings, "tif", false);
} else if (extension.equals("html")) {
this.appConfig = this.config.getFiletypeSettings().getHtml2Pdf();
} else {
this.appConfig = this.config.getAppConfigByExtension(this.filetypeSettings, extension, isfallbackRoute);
if (this.appConfig == null) {
extension = this.getExtOfUnknownFileType(sourceFile);
this.appConfig = this.config.getAppConfigByExtension(this.filetypeSettings, extension, isfallbackRoute);
}
}
destinationPathDir = sourceFile.getParentFile().getAbsolutePath();
debugMsgs.append("\ndestinationPathDir=" + destinationPathDir + " for job=" + jobIdentityId);
destinationPath = new File(destinationPathDir, new File(this.changeExtension(inFileName, "pdf")).getName()).getAbsolutePath();
if (sourceFile.length() == 0) {
throw new ConversionException(11019);
}
errorCode = 1007;
applyWatermark = GeneratePDFUtil.applyWaterMark();
if (!doExport && this.appConfig instanceof FiletypeSettings.Settings.PDFExport) {
errorCode = 1001;
throw new FileFormatNotSupportedException(80004);
}
if (doExport && !(this.appConfig instanceof FiletypeSettings.Settings.PDFExport)) {
errorCode = 1001;
throw new FileFormatNotSupportedException(80003);
}
if (doOptimize && !(this.appConfig instanceof FiletypeSettings.Settings.Optimizer)) {
errorCode = 1001;
throw new FileFormatNotSupportedException(80004);
}
osName = coreSvcImpl.getOSName();
isWindows = osName.indexOf("windows") >= 0;
native2PDFBMC = false;
if (this.appConfig == null) {
this.pdfgLogger.debug("002-001", new Object[]{inputFileName});
throw new FileFormatNotSupportedException(1015, "002-001");
}
if (this.appConfig instanceof FiletypeSettings.Settings.Acrobat) {
debugMsgs.append("\njappConfig instanceof AcrobatType for job=" + jobIdentityId);
serviceName = "AcrobatConverterService";
appName = "Acrobat";
appMonBaseName = "acrotype";
if (this.filetypeSettings.getAcrobat().isUseOCR() && isWindows) {
debugMsgs.append("\n (OCR + windows)=true for job=" + jobIdentityId);
if ("pdf".equalsIgnoreCase(extension) && PdfPostProcessorUtilities.isEncrypted(sourceFile)) {
throw new ConversionException(11032, inputFileName);
}
if (this.filetypeSettings.getAcrobat().isSetOcrLanguage()) {
pdfProducerString = "PDF generator";
serviceName = "GenericConverterService";
appName = "AcrobatOCR";
appMonBaseName = "acrobatocr";
native2PDFBMC = true;
}
} else {
debugMsgs.append("\n (OCR + windows)=false for job=" + jobIdentityId);
if (coreSvcImpl.isImageExtension(extension)) {
debugMsgs.append("\n bCallImage2PdfBmc=true for job=" + jobIdentityId);
bCallImage2PdfBmc = true;
pdfProducerString = "PDF generator";
} else {
serviceName = null;
if ("pdf".equals(extension)) {
appName = "PDF-To-PDF";
pdfProducerString = "PDF generator";
} else {
appName = null;
}
appMonBaseName = null;
native2PDFBMC = true;
debugMsgs.append("\n native2PDFBMC=true for job=" + jobIdentityId);
}
}
} else if (this.appConfig instanceof FiletypeSettings.Settings.Image) {
debugMsgs.append("\nappConfig instanceof ImageType for job=" + jobIdentityId);
pdfProducerString = "PDF generator";
serviceName = "AcrobatConverterService";
appName = "Acrobat";
appMonBaseName = "acrotype";
forJpeg2kUseAcrobat = Constants.JPEG2K_IMAGE_EXTENSION_MAP.contains(extension.toLowerCase());
if (isWindows && (coreSvcImpl.getUseAcrobatImageConversion() || forJpeg2kUseAcrobat)) {
if ("pdf".equalsIgnoreCase(extension) && PdfPostProcessorUtilities.isEncrypted(sourceFile)) {
throw new ConversionException(11032, inputFileName);
}
native2PDFBMC = true;
} else if (coreSvcImpl.isImageExtension(extension)) {
bCallImage2PdfBmc = true;
} else if (isWindows && !this.filetypeSettings.getImage().isUseOCR()) {
serviceName = null;
if ("pdf".equals(extension)) {
appName = "PDF-To-PDF";
pdfProducerString = "PDF generator";
}
}
} else if (this.appConfig instanceof FiletypeSettings.Settings.PDFExport) {
debugMsgs.append("\nappConfig instanceof PDFExportType for job=" + jobIdentityId);
exportTo = ((FiletypeSettings.Settings.PDFExport)this.appConfig).getExportTo();
ext = this.determineDestExt(exportTo);
if (ext == null) {
throw new InvalidParameterException(80011, exportTo);
}
serviceName = "PDFExportConverterService";
appName = "PDFExport";
appMonBaseName = "acrotype";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.Optimizer) {
debugMsgs.append("\nappConfig instanceof OptimizerType for job=" + jobIdentityId);
serviceName = "PDFExportConverterService";
appName = "PDFExport";
appMonBaseName = "acrotype";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.AutoCAD) {
debugMsgs.append("\nappConfig instanceof AutoCADType for job=" + jobIdentityId);
serviceName = "AutocadConverterService";
appName = coreSvcImpl.getEnableAcrobatAutocadConversion() != false ? "AutoCAD_Acrobat_enabled" : "AutoCAD";
appMonBaseName = "autocad";
autoCADConfig = (FiletypeSettings.Settings.AutoCAD)this.appConfig;
autoCADConfig.getPDFMaker().setEmbed3DContent(false);
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSExcel) {
debugMsgs.append("\nappConfig instanceof MSExcelType for job=" + jobIdentityId);
serviceName = "ExcelConverterService";
appName = "Excel";
appMonBaseName = "excel";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSPowerpoint) {
debugMsgs.append("\nappConfig instanceof MSPowerpointType for job=" + jobIdentityId);
serviceName = "PowerPointConverterService";
appName = "PowerPoint";
appMonBaseName = "powerpoint";
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSPublisher) {
serviceName = "PublisherConverterService";
appName = "Publisher";
appMonBaseName = "publisher";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSProject) {
debugMsgs.append("\nappConfig instanceof MSProjectType for job=" + jobIdentityId);
serviceName = "ProjectConverterService";
appName = "Project";
appMonBaseName = "project";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSPublisher) {
debugMsgs.append("\nappConfig instanceof MSPublisherType for job=" + jobIdentityId);
serviceName = "PublisherConverterService";
appName = "Publisher";
appMonBaseName = "publisher";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSVisio) {
debugMsgs.append("\nappConfig instanceof MSVisioType for job=" + jobIdentityId);
serviceName = "VisioConverterService";
appName = "Visio";
appMonBaseName = "visio";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.MSWord) {
debugMsgs.append("\nappConfig instanceof MSWordType for job=" + jobIdentityId);
serviceName = "WordConverterService";
appName = "Word";
appMonBaseName = "word";
} else if (this.appConfig instanceof FiletypeSettings.Settings.GenericApp) {
debugMsgs.append("\nappConfig instanceof GenericAppType for job=" + jobIdentityId);
genericApp = (FiletypeSettings.Settings.GenericApp)this.appConfig;
if (genericApp.isSetName() && genericApp.getName().length() > 0) {
serviceName = "GenericConverterService";
appName = genericApp.getName();
appMonBaseName = appName.toLowerCase();
}
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.Html2Pdf) {
serviceName = "GenericConverterService";
appName = "AcrobatOCR";
appMonBaseName = "webcapture";
native2PDFBMC = true;
} else if (this.appConfig instanceof FiletypeSettings.Settings.AdobeFlash) {
if (!isfallbackRoute) {
debugMsgs.append("\n bCallSwf2PdfBmc=true for job=" + jobIdentityId);
bCallSwf2PdfBmc = true;
pdfProducerString = "PDF generator";
} else {
serviceName = "GenericConverterService";
appName = "AcrobatOCR";
appMonBaseName = "flash";
native2PDFBMC = true;
}
} else if (this.appConfig instanceof FiletypeSettings.Settings.XPS && !isfallbackRoute) {
serviceName = "GenericConverterService";
appName = "AcrobatOCR";
pdfProducerString = "PDF generator";
appMonBaseName = "xps";
native2PDFBMC = true;
}
pdfColorSpace = 1;
if (bCallImage2PdfBmc) ** GOTO lbl-1000
if (!bCallSwf2PdfBmc) {
if (isWindows && !GeneratePDFServiceImpl.doesAcrobatExeExistOnPath) {
throw new ConversionException(80023);
}
debugMsgs.append("\n!bCallnative2PdfBmc=true for job=" + jobIdentityId);
if (serviceName == null) {
this.pdfgLogger.debug("002-002", new Object[]{inputFileName});
if ("PDF-To-PDF".equals(appName) && isWindows) {
errorCode = 1018;
throw new FileFormatNotSupportedException(errorCode);
}
errorCode = 1015;
throw new FileFormatNotSupportedException(errorCode);
}
securityConfigBytes = new byte[]{};
errorCode = 1008;
appConfigBytes = this.objectToByteArray(this.appConfig);
errorCode = 1009;
appMonData = this.getAppMonData(appMonBaseName, Native2PdfCaller.m_AppmonLocale);
errorCode = 1011;
errorCode = this.setDistillerParams(coreSvcImpl, serviceName, errorCode);
debugMsgs.append("\nerrorCode=" + errorCode + " for job=" + jobIdentityId);
results = null;
debugMsgs.append("\nbefore calling NativeToPDFTransactionCallback.initPDFMToPDFFactory for job=" + jobIdentityId);
usersMap = coreSvcImpl.getUserAccountsMap();
if ((osName.contains("2008") || osName.contains("vista") || osName.contains("windows 7")) && (usersMap == null || usersMap.isEmpty())) {
this.pdfgLogger.info("Conversion failed as no user is defined.");
throw new ConversionException(80036);
}
nativeToPDFUsrMap = new HashMap<K, V>();
pdfMakerUserMap = new HashMap<K, V>();
if (Native2PdfCaller.isSingleThreaded == null) {
Native2PdfCaller.isSingleThreaded = Native2PdfCaller.isWindows64bitOs != false && Native2PdfCaller.isMSOffice2003 != false || usersMap.size() <= 1;
}
if (Native2PdfCaller.isSingleThreaded.booleanValue()) {
if (usersMap != null && !usersMap.isEmpty()) {
entries = usersMap.entrySet();
itr = entries.iterator();
entry = itr.next();
key = (String)entry.getKey();
val = (String)entry.getValue();
newUserMap = new HashMap<String, String>();
newUserMap.put(key, val);
pdfMakerUserMap = newUserMap;
nativeToPDFUsrMap = newUserMap;
}
} else if (!usersMap.isEmpty()) {
entries = usersMap.entrySet();
itr = entries.iterator();
entry = itr.next();
nativeToPDFUsrMap.put(entry.getKey(), entry.getValue());
while (itr.hasNext()) {
entry = itr.next();
pdfMakerUserMap.put(entry.getKey(), entry.getValue());
}
}
transactionCallback = new NativeToPDFTransactionCallback(coreSvcImpl.getNativeToPdfFactory(), coreSvcImpl.getPdfMakerFactory());
transactionCallback.initPDFMToPDFFactory(pdfMakerUserMap);
transactionCallback.initNativeToPDFFactory(nativeToPDFUsrMap);
transactionCallback.setApplyWatermark(applyWatermark);
transactionCallback.setAppMonConfig(appMonData);
transactionCallback.setAppName(appName);
transactionCallback.setAppSpecificConfig(appConfigBytes);
transactionCallback.setDestFilePath(destinationPath);
transactionCallback.setSecurityConfig(securityConfigBytes);
transactionCallback.setSourceFilePath(sourcePathOrURL);
transactionCallback.setTimeoutSeconds(this.timeoutSeconds);
transactionCallback.setUseNative(native2PDFBMC);
transactionCallback.setStartPage(this.startPage);
transactionCallback.setEndPage(this.endPage);
Native2PdfCaller.pdfm_pool_size = transactionCallback.getPDFMakerPoolSize();
jobOptionsString = this.jobOptionConfig.getOptionData();
transactionCallback.setCreatePDFA(Utils.isPDFAComplianceOn((String)jobOptionsString));
debugMsgs.append("\nafter setting parameters in transactionCallback for job=" + jobIdentityId);
if (Native2PdfCaller.pdfmConversionLock == null) {
entry = Native2PdfCaller.class;
// MONITORENTER : com.adobe.pdfg.impl.Native2PdfCaller.class
if (Native2PdfCaller.pdfmConversionLock == null) {
debugMsgs.append("\ncreating Semaphore pdfmConversionLock for job=" + jobIdentityId);
Native2PdfCaller.pdfmConversionLock = new Semaphore(Native2PdfCaller.pdfm_pool_size, true);
}
// MONITOREXIT : entry
}
if (Native2PdfCaller.nativeConversionLock == null) {
entry = Native2PdfCaller.class;
// MONITORENTER : com.adobe.pdfg.impl.Native2PdfCaller.class
if (Native2PdfCaller.nativeConversionLock == null) {
debugMsgs.append("\ncreating Semaphore nativeConversionLock for job=" + jobIdentityId);
Native2PdfCaller.nativeConversionLock = new Semaphore(Native2PdfCaller.NATIVE_TO_PDF_POOL_SIZE, true);
}
// MONITOREXIT : entry
}
isGenericAppType = false;
if (this.appConfig != null && this.appConfig instanceof FiletypeSettings.Settings.GenericApp) {
isGenericAppType = true;
}
if (native2PDFBMC) {
try {
debugMsgs.append("\nbefore acquiring nativeConversionLock for job=" + jobIdentityId);
waitStartTime = System.currentTimeMillis();
Native2PdfCaller.nativeConversionLock.acquire();
waitEndTime = System.currentTimeMillis();
debugMsgs.append("\nafter acquiring nativeConversionLock for job=" + jobIdentityId);
suffix = ".joboptions";
errorCode = 1002;
if (isGenericAppType) {
debugMsgs.append("\nisGenericAppType=true for job=" + jobIdentityId);
}
if (this.appConfig instanceof FiletypeSettings.Settings.Html2Pdf) {
this.jobOptionName = "";
} else {
jobOptionFile = this.validateConfigAndWriteJobOptions(coreSvcImpl, this.config, this.jobOptionName, ".joboptions", isGenericAppType, this.appConfig, pdfgTmpDir);
this.jobOptionName = jobOptionFile.getAbsolutePath();
}
debugMsgs.append("\njobOptionName=" + this.jobOptionName + " for job=" + jobIdentityId);
this.pdfgLogger.info("001-021", new Object[]{inputFileName, this.jobOptionName});
transactionCallback.setDistillerJobOptionsName(this.jobOptionName);
if (this.appConfig instanceof FiletypeSettings.Settings.PDFExport) {
transactionCallback.setOCRLanguage(this.ocrLanguageChosen);
}
this.pdfgLogger.debug("001-000", "File " + inputFileName + " submitted as " + inputFileName);
debugMsgs.append("\nbefore calling invokeInSMT() for job=" + jobIdentityId);
this.pdfgLogger.debug(debugMsgs.toString());
debugMsgsLogged = true;
maxTryCount = 1 + Native2PdfCaller.retryLogic.getRetryCount();
timeOut = this.timeoutSeconds;
for (i = 1; i <= maxTryCount; ++i) {
try {
transactionCallback.setTimeoutSeconds(timeOut);
results = this.invokeInSMT(transactionCallback, coreSvcImpl);
break;
}
catch (Exception e) {
if (Native2PdfCaller.retryLogic.isShareTime()) {
timeOut = this.timeoutSeconds - (int)((System.currentTimeMillis() - startTime) / 1000);
}
if ((long)timeOut < 15) {
throw new ConversionException(10010, (Throwable)e);
}
if (i == maxTryCount) {
if (e instanceof COMM_FAILURE == false) throw e;
throw new ConversionException(10010, (Throwable)e);
}
this.pdfgLogger.info("Conversion failed due to an unknown exception. Retry job=" + jobIdentityId);
continue;
}
}
debugMsgs = new StringBuilder();
debugMsgsLogged = false;
var62_83 = null;
debugMsgs.append("\nbefore nativeConversionLock.release() for job=" + jobIdentityId);
Native2PdfCaller.nativeConversionLock.release();
}
catch (Throwable var61_85) {
var62_84 = null;
debugMsgs.append("\nbefore nativeConversionLock.release() for job=" + jobIdentityId);
Native2PdfCaller.nativeConversionLock.release();
throw var61_85;
}
}
try {
debugMsgs.append("\nbefore acquiring pdfmConversionLock for job=" + jobIdentityId);
waitStartTime = System.currentTimeMillis();
Native2PdfCaller.pdfmConversionLock.acquire();
debugMsgs.append("\nafter acquiring pdfmConversionLock for job=" + jobIdentityId);
if (Native2PdfCaller.isSingleThreaded.booleanValue()) {
debugMsgs.append("\nbefore acquiring nativeConversionLock for PDFMaker (for 64-bit OS & MSOffice2003) for job=" + jobIdentityId);
Native2PdfCaller.nativeConversionLock.acquire();
debugMsgs.append("\nafter acquiring nativeConversionLock for PDFMaker (for 64-bit OS & MSOffice2003)for job=" + jobIdentityId);
}
waitEndTime = System.currentTimeMillis();
suffix = ".joboptions";
errorCode = 1002;
jobOptionFile = this.validateConfigAndWriteJobOptions(coreSvcImpl, this.config, this.jobOptionName, ".joboptions", isGenericAppType, this.appConfig, pdfgTmpDir);
this.jobOptionName = jobOptionFile.getAbsolutePath();
this.pdfgLogger.info("001-021", new Object[]{inputFileName, this.jobOptionName});
transactionCallback.setDistillerJobOptionsName(this.jobOptionName);
this.pdfgLogger.debug("001-000", "File " + inputFileName + " submitted as " + inputFileName);
debugMsgs.append("\nbefore calling invokeInSMT() for job=" + jobIdentityId);
this.pdfgLogger.debug(debugMsgs.toString());
debugMsgsLogged = true;
maxTryCount = 1 + Native2PdfCaller.retryLogic.getRetryCount();
timeOut = this.timeoutSeconds;
for (i = 1; i <= maxTryCount; ++i) {
try {
transactionCallback.setTimeoutSeconds(timeOut);
results = this.invokeInSMT(transactionCallback, coreSvcImpl);
break;
}
catch (Exception e) {
if (Native2PdfCaller.retryLogic.isShareTime()) {
timeOut = this.timeoutSeconds - (int)((System.currentTimeMillis() - startTime) / 1000);
}
if ((long)timeOut < 15) {
throw new ConversionException(10010, (Throwable)e);
}
if (i == maxTryCount) {
if (e instanceof COMM_FAILURE == false) throw e;
throw new ConversionException(10010, (Throwable)e);
}
this.pdfgLogger.info("Conversion failed due to an unknown exception. Retry job=" + jobIdentityId);
continue;
}
}
debugMsgs = new StringBuilder();
debugMsgsLogged = false;
var64_86 = null;
if (Native2PdfCaller.isSingleThreaded.booleanValue()) {
debugMsgs.append("\nbefore Releasing nativeConversionLock for PDFMaker (for 64-bit OS & MSOffice2003)for job=" + jobIdentityId);
Native2PdfCaller.nativeConversionLock.release();
}
debugMsgs.append("\nbefore pdfmConversionLock.release() for job=" + jobIdentityId);
Native2PdfCaller.pdfmConversionLock.release();
}
catch (Throwable var63_88) {
var64_87 = null;
if (Native2PdfCaller.isSingleThreaded.booleanValue()) {
debugMsgs.append("\nbefore Releasing nativeConversionLock for PDFMaker (for 64-bit OS & MSOffice2003)for job=" + jobIdentityId);
Native2PdfCaller.nativeConversionLock.release();
}
debugMsgs.append("\nbefore pdfmConversionLock.release() for job=" + jobIdentityId);
Native2PdfCaller.pdfmConversionLock.release();
throw var63_88;
}
debugMsgs.append("\nbefore calling checkResult() for job=" + jobIdentityId);
errorCode = this.checkResult(results, errorCode);
debugMsgs.append("\nbefore calling doPostBmcFileNameMangling() for job=" + jobIdentityId);
} else if (bCallSwf2PdfBmc) lbl-1000: // 2 sources:
{
debugMsgs.append("\n!bCallSwf2PdfBmc=false for job=" + jobIdentityId);
if (Native2PdfCaller.swfToPDFLock == null) {
securityConfigBytes = Native2PdfCaller.class;
// MONITORENTER : com.adobe.pdfg.impl.Native2PdfCaller.class
if (Native2PdfCaller.swfToPDFLock == null) {
debugMsgs.append("\nbefore obtaining swfToPDFConversionLock for job=" + jobIdentityId);
Native2PdfCaller.swfToPDFLock = new Semaphore(Native2PdfCaller.SWF_TO_PDF_POOL_SIZE, true);
debugMsgs.append("\nafter obtaining swfToPDFConversionLock for job=" + jobIdentityId);
}
// MONITOREXIT : securityConfigBytes
}
results = null;
debugMsgs.append("\nbefore SwfToPDFTransactionCallback.initializeConnectionFactory for job=" + jobIdentityId);
transactionCallback = new SwfToPDFTransactionCallback(coreSvcImpl.getSwfToPdfFactory());
transactionCallback.setDestinationPath(destinationPath);
transactionCallback.setSourcePath(sourcePathOrURL);
transactionCallback.setDpi(coreSvcImpl.getSwf2pdf_dpi());
transactionCallback.setTimeoutSeconds(this.timeoutSeconds);
debugMsgs.append("\nafter setting parameters in transactionCallback for job=" + jobIdentityId);
try {
debugMsgs.append("\nbefore acquiring swfToPDFLock for job=" + jobIdentityId);
waitStartTime = System.currentTimeMillis();
Native2PdfCaller.swfToPDFLock.acquire();
waitEndTime = System.currentTimeMillis();
debugMsgs.append("\nafter acquiring swfToPDFLock for job=" + jobIdentityId);
this.pdfgLogger.debug("001-000", "File " + inputFileName + " submitted as " + inputFileName);
debugMsgs.append("\nbefore invokeInSMT for job=" + jobIdentityId);
this.pdfgLogger.debug(debugMsgs.toString());
debugMsgsLogged = true;
results = this.invokeInSMT(transactionCallback, coreSvcImpl);
debugMsgs = new StringBuilder();
debugMsgsLogged = false;
var67_89 = null;
debugMsgs.append("\nbefore releasing imageConversionLock for job=" + jobIdentityId);
Native2PdfCaller.swfToPDFLock.release();
debugMsgs.append("\nafter releasing imageConversionLock for job=" + jobIdentityId);
}
catch (Throwable var66_91) {
var67_90 = null;
debugMsgs.append("\nbefore releasing imageConversionLock for job=" + jobIdentityId);
Native2PdfCaller.swfToPDFLock.release();
debugMsgs.append("\nafter releasing imageConversionLock for job=" + jobIdentityId);
throw var66_91;
}
errorCode = this.checkResult(results, errorCode);
debugMsgs.append("\nafter calling checkResult.errorCode=" + errorCode + " for job=" + jobIdentityId);
errorCode = this.setDistillerParams(coreSvcImpl, serviceName, errorCode);
debugMsgs.append("\nafter calling setDistillerParams.errorCode=" + errorCode + " for job=" + jobIdentityId);
} else {
debugMsgs.append("\n!bCallImage2PdfBmc=false for job=" + jobIdentityId);
if (Native2PdfCaller.imageConversionLock == null) {
results = Native2PdfCaller.class;
// MONITORENTER : com.adobe.pdfg.impl.Native2PdfCaller.class
if (Native2PdfCaller.imageConversionLock == null) {
debugMsgs.append("\nbefore obtaining imageConversionLock for job=" + jobIdentityId);
Native2PdfCaller.imageConversionLock = new Semaphore(Native2PdfCaller.IMAGE_TO_PDF_POOL_SIZE, true);
debugMsgs.append("\nafter obtaining imageConversionLock for job=" + jobIdentityId);
}
// MONITOREXIT : results
}
results = null;
debugMsgs.append("\nbefore ImageToPDFTransactionCallback.initializeConnectionFactory for job=" + jobIdentityId);
transactionCallback = new ImageToPDFTransactionCallback(coreSvcImpl.getImageToPdfFactory());
transactionCallback.setDestinationPath(destinationPath);
transactionCallback.setSourcePath(sourcePathOrURL);
transactionCallback.setTimeoutSeconds(this.timeoutSeconds);
jobOptionsMap = PDFGGlobalCache.getJobOptionsMap((String)this.config.getJobOptions().getOptionData());
ditillerParametersMap = (Map)jobOptionsMap.get("setdistillerparams");
transactionCallback.setPDFVersion((Double)ditillerParametersMap.get("CompatibilityLevel"));
debugMsgs.append("\nafter setting parameters in transactionCallback for job=" + jobIdentityId);
try {
debugMsgs.append("\nbefore acquiring imageConversionLock for job=" + jobIdentityId);
waitStartTime = System.currentTimeMillis();
Native2PdfCaller.imageConversionLock.acquire();
waitEndTime = System.currentTimeMillis();
debugMsgs.append("\nafter acquiring imageConversionLock for job=" + jobIdentityId);
this.pdfgLogger.debug("001-000", "File " + inputFileName + " submitted as " + inputFileName);
debugMsgs.append("\nbefore invokeInSMT for job=" + jobIdentityId);
this.pdfgLogger.debug(debugMsgs.toString());
debugMsgsLogged = true;
try {
results = this.invokeInSMT(transactionCallback, coreSvcImpl);
}
catch (COMM_FAILURE ex) {
throw new ConversionException(10010, (Throwable)ex);
}
debugMsgs = new StringBuilder();
debugMsgsLogged = false;
var70_92 = null;
debugMsgs.append("\nbefore releasing imageConversionLock for job=" + jobIdentityId);
Native2PdfCaller.imageConversionLock.release();
debugMsgs.append("\nafter releasing imageConversionLock for job=" + jobIdentityId);
}
catch (Throwable var69_94) {
var70_93 = null;
debugMsgs.append("\nbefore releasing imageConversionLock for job=" + jobIdentityId);
Native2PdfCaller.imageConversionLock.release();
debugMsgs.append("\nafter releasing imageConversionLock for job=" + jobIdentityId);
throw var69_94;
}
errorCode = this.checkResult(results, errorCode);
debugMsgs.append("\nafter calling checkResult.errorCode=" + errorCode + " for job=" + jobIdentityId);
pdfColorSpace = results.conversionErrorKey;
errorCode = this.setDistillerParams(coreSvcImpl, serviceName, errorCode);
debugMsgs.append("\nafter calling setDistillerParams.errorCode=" + errorCode + " for job=" + jobIdentityId);
}
filePaths = new PostProcessFileInfo();
filePaths.pdfFilePath = destinationPath;
filePaths.logFilePath = destinationPath + ".log";
debugMsgs.append("\nbefore calling doPostProcess for job=" + jobIdentityId);
bImage2PdfByAcrobat = false;
if (this.appConfig instanceof FiletypeSettings.Settings.Image && !bCallImage2PdfBmc && !this.filetypeSettings.getImage().isUseOCR()) {
bImage2PdfByAcrobat = true;
}
errorCode = this.doPostProcess(serviceName, appName, xmpFile, destinationPath, coreSvcImpl, jobOptionFile, errorCode, filePaths, bImage2PdfByAcrobat, bCallImage2PdfBmc, pdfProducerString, pdfColorSpace, applyWatermark);
debugMsgs.append("\nafter calling doPostProcess for job=" + jobIdentityId);
convertedDoc = filePaths.postProcessedDoc;
pdfFile = null;
if (convertedDoc == null) {
pdfFile = new File(filePaths.pdfFilePath);
}
if (!doExport && !doOptimize) {
debugMsgs.append("\nafter doPostProcess.!doExport=true for job=" + jobIdentityId);
fileName = inputFileName.substring(0, inputFileName.lastIndexOf(".") + 1) + "pdf";
if (pdfFile != null && pdfFile.exists() && pdfFile.length() > 0) {
finalPDFFile = new File(pdfgTmpDir.getParent(), new Guid().toString());
FileUtilities.moveFile((File)pdfFile, (File)finalPDFFile);
convertedDoc = new Document(finalPDFFile, false);
}
if (convertedDoc == null) {
throw new ConversionException(80005, filePaths.pdfFilePath);
}
convertedDoc.setAttribute("file", (Object)fileName);
debugMsgs.append("\nafter fileName=" + fileName + " for job=" + jobIdentityId);
} else {
debugMsgs.append("\nafter doPostProcess.!doExport=false for job=" + jobIdentityId);
targetExtension = null;
formatType = doExport != false ? ((FiletypeSettings.Settings.PDFExport)this.appConfig).getExportTo() : ((FiletypeSettings.Settings.Optimizer)this.appConfig).getTargetPDFVersion();
if (formatType != null) {
targetExtension = this.determineDestExt(formatType);
}
if (targetExtension == null) {
throw new InvalidParameterException(80011, formatType);
}
exportContentDir = new File(new File(destinationPath).getParent(), "pdfg_export");
actualDestPath = new File(exportContentDir, pdfFile.getName()).getPath();
convertedFile = new File(this.changeExtension(actualDestPath, targetExtension));
if (!convertedFile.exists()) {
if (doExport == false) throw new ConversionException(80005, convertedFile.getPath());
throw new ConversionException(11031);
}
finalConvertedFile = new File(pdfgTmpDir.getParent(), new Guid().toString());
convertedFile.renameTo(finalConvertedFile);
convertedDoc = new Document(finalConvertedFile, false);
convertedDoc.setAttribute("file", (Object)convertedFile.getName());
debugMsgs.append("\nafter fileName=" + convertedFile.getName() + " for job=" + jobIdentityId);
convertedDoc.setContentType(Native2PdfCaller.m_ExportContentTypeMapping.get(formatType));
convertedFile.delete();
convertedFile = null;
}
map = new HashMap<String, Document>();
map.put("ConvertedDoc", convertedDoc);
logFile = new File(filePaths.logFilePath);
if (logFile.exists() && logFile.length() > 0) {
debugMsgs.append("\nlog file exists for job=" + jobIdentityId);
finalLogFile = new File(pdfgTmpDir.getParent(), new Guid().toString());
FileUtilities.moveFile((File)logFile, (File)finalLogFile);
logDoc = new Document(finalLogFile, false);
logDoc.setAttribute("file", (Object)(filePaths.pdfFilePath.substring(filePaths.pdfFilePath.lastIndexOf(File.separator) + 1, filePaths.pdfFilePath.lastIndexOf(".")) + ".log"));
map.put("LogDoc", logDoc);
}
if ((outputStorageDir = System.getenv("PDFG_OUTPUT_STORAGE_DIR")) != null && outputStorageDir.trim().length() > 0) {
try {
FileUtils.copyDirectoryToDirectory((File)pdfgTmpDir, (File)new File(outputStorageDir));
}
catch (IOException ioe) {
this.pdfgLogger.warning("Could not copy the output folder to " + outputStorageDir + ". Caused by: " + ioe);
}
}
debugMsgs.append("\nbefore returning map from Native2PdfCaller.callNativeBMC for job=" + jobIdentityId);
ioe = map;
var72_95 = null;
}
catch (ConversionException e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
if (e.getErrorCode() == 9001) {
e = new ConversionException(9004, appName);
}
success = false;
throw e;
}
catch (InvalidParameterException e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
success = false;
throw e;
}
catch (FileFormatNotSupportedException e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
success = false;
throw e;
}
catch (Exception e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
success = false;
throw new ConversionException(1000, (Throwable)e);
}
endTime = System.currentTimeMillis();
if (inputFile != null && inputFile.exists()) {
inputFile.delete();
}
if (pdfgTmpDir != null) {
GeneratePDFServiceImpl.deleteSubFiles(pdfgTmpDir);
}
if (agent != null) {
try {
agent.cleanUp();
}
catch (Exception t) {
this.pdfgLogger.trace("001-007", null, (Throwable)t);
}
}
if (jobOptionFile != null) {
try {
jobOptionFile.delete();
jobOptionFile = null;
}
catch (Exception t) {
this.pdfgLogger.trace("001-007", null, (Throwable)t);
}
}
if (success) {
this.pdfgLogger.info("001-027", inputFileName);
} else {
this.pdfgLogger.info("001-028", inputFileName);
}
this.pdfgLogger.info("001-025", new Object[]{inputFileName, new Date(endTime), jobIdentityId});
this.pdfgLogger.info("001-030", new Object[]{inputFileName, waitEndTime - waitStartTime, jobIdentityId});
this.pdfgLogger.info("001-026", new Object[]{inputFileName, endTime - startTime - (waitEndTime - waitStartTime), jobIdentityId});
if (debugMsgsLogged != false) return ioe;
this.pdfgLogger.debug(debugMsgs.toString());
return ioe;
}
catch (Throwable var71_101) {
block211 : {
block210 : {
var72_96 = null;
endTime = System.currentTimeMillis();
if (inputFile != null && inputFile.exists()) {
inputFile.delete();
}
if (pdfgTmpDir != null) {
GeneratePDFServiceImpl.deleteSubFiles(pdfgTmpDir);
}
if (agent != null) {
** try [egrp 15[TRYBLOCK] [27 : 7513->7524)] {
lbl756: // 1 sources:
agent.cleanUp();
break block210;
lbl758: // 1 sources:
catch (Exception t) {
this.pdfgLogger.trace("001-007", null, (Throwable)t);
}
}
}
if (jobOptionFile != null) {
** try [egrp 16[TRYBLOCK] [28 : 7544->7556)] {
lbl763: // 1 sources:
jobOptionFile.delete();
jobOptionFile = null;
break block211;
lbl766: // 1 sources:
catch (Exception t) {
this.pdfgLogger.trace("001-007", null, (Throwable)t);
}
}
}
if (success) {
this.pdfgLogger.info("001-027", inputFileName);
} else {
this.pdfgLogger.info("001-028", inputFileName);
}
this.pdfgLogger.info("001-025", new Object[]{inputFileName, new Date(endTime), jobIdentityId});
this.pdfgLogger.info("001-030", new Object[]{inputFileName, waitEndTime - waitStartTime, jobIdentityId});
this.pdfgLogger.info("001-026", new Object[]{inputFileName, endTime - startTime - (waitEndTime - waitStartTime), jobIdentityId});
if (debugMsgsLogged != false) throw var71_101;
this.pdfgLogger.debug(debugMsgs.toString());
throw var71_101;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private boolean isMSOffice2003(String path) {
File regFile_word;
File regFile_excel;
File regFile_ppt;
block23 : {
regFile_word = null;
regFile_excel = null;
regFile_ppt = null;
Process p1 = Runtime.getRuntime().exec("regedit.exe /e \"" + path + "/regdump_word.reg\"" + "\"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\App Paths\\winword.exe\"");
Process p2 = Runtime.getRuntime().exec("regedit.exe /e \"" + path + "/regdump_excel.reg\"" + "\"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\App Paths\\excel.exe\"");
Process p3 = Runtime.getRuntime().exec("regedit.exe /e \"" + path + "/regdump_ppt.reg\"" + "\"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\App Paths\\powerpnt.exe\"");
p1.waitFor();
p2.waitFor();
p3.waitFor();
regFile_word = new File(path, "regdump_word.reg");
regFile_excel = new File(path, "regdump_excel.reg");
regFile_ppt = new File(path, "regdump_ppt.reg");
StringBuilder str = new StringBuilder();
if (regFile_word.exists()) {
str.append(this.readFile(regFile_word, "UTF-16"));
} else {
this.pdfgLogger.severe("Error: regdump_word.reg file was not created at " + path + ". It seems MS Word is not installed on the server.", "");
}
if (regFile_excel.exists()) {
str.append(this.readFile(regFile_excel, "UTF-16"));
} else {
this.pdfgLogger.severe("Error: regdump_excel.reg file was not created at " + path + ". It seems MS Excel is not installed on the server.", "");
}
if (regFile_ppt.exists()) {
str.append(this.readFile(regFile_ppt, "UTF-16"));
} else {
this.pdfgLogger.severe("Error: regdump_ppt.reg file was not created at " + path + ". It seems MS PowerPoint is not installed on the server.", "");
}
String errStr = str.toString();
if (errStr == null || errStr.trim().equals("") || !errStr.toLowerCase().contains("office11")) break block23;
this.pdfgLogger.severe("Info: MS Office 2003 components detected. Multi-user support is being disabled. For multi-user support please install Microsoft Office 2007 or later.", "");
boolean bl = true;
Object var12_14 = null;
if (regFile_word != null && regFile_word.exists()) {
regFile_word.delete();
}
if (regFile_excel != null && regFile_excel.exists()) {
regFile_excel.delete();
}
if (regFile_ppt != null && regFile_ppt.exists()) {
regFile_ppt.delete();
}
return bl;
}
try {
boolean bl = false;
Object var12_15 = null;
if (regFile_word != null && regFile_word.exists()) {
regFile_word.delete();
}
if (regFile_excel != null && regFile_excel.exists()) {
regFile_excel.delete();
}
if (regFile_ppt != null && regFile_ppt.exists()) {
regFile_ppt.delete();
}
return bl;
}
catch (Exception e) {
try {
this.pdfgLogger.severe("Error: Error occurred while finding the MSOffice version. For safety we'll assume it to be 2003 (multi-user support is being disabled). For multi-user support please install Microsoft Office 2007 or later.", "");
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
boolean p2 = true;
Object var12_16 = null;
if (regFile_word != null && regFile_word.exists()) {
regFile_word.delete();
}
if (regFile_excel != null && regFile_excel.exists()) {
regFile_excel.delete();
}
if (regFile_ppt != null && regFile_ppt.exists()) {
regFile_ppt.delete();
}
return p2;
}
catch (Throwable var11_18) {
Object var12_17 = null;
if (regFile_word != null && regFile_word.exists()) {
regFile_word.delete();
}
if (regFile_excel != null && regFile_excel.exists()) {
regFile_excel.delete();
}
if (regFile_ppt != null && regFile_ppt.exists()) {
regFile_ppt.delete();
}
throw var11_18;
}
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private String readFile(File file, String encoding) throws Exception {
String string;
block7 : {
BufferedReader br = null;
try {
StringBuilder retVal = new StringBuilder();
br = encoding != null && !encoding.trim().equals("") ? new BufferedReader(new InputStreamReader((InputStream)new FileInputStream(file), encoding)) : new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String str = null;
while ((str = br.readLine()) != null) {
retVal.append(str);
}
string = retVal.toString();
Object var8_7 = null;
if (br == null) break block7;
}
catch (Throwable var7_11) {
Object var8_8 = null;
if (br != null) {
try {
br.close();
}
catch (Exception e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
}
}
throw var7_11;
}
try {
br.close();
}
catch (Exception e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
}
}
return string;
}
private String changeExtension(String originalPath, String newExtension) {
int EXTENSIONS_SEPARATOR = 46;
StringBuffer buffer = null;
int position = originalPath.lastIndexOf(46);
buffer = position == -1 ? new StringBuffer(originalPath) : new StringBuffer(originalPath.substring(0, position));
return buffer.append('.').append(newExtension).toString();
}
protected AppMonData getAppMonData(String appMonBaseName, String localeName) {
AppMonData result = m_appMonData.get(appMonBaseName + localeName);
if (result != null) {
return result;
}
byte[] emptyArray = new byte[]{};
result = new AppMonData(emptyArray, emptyArray, emptyArray, emptyArray);
if (appMonBaseName != null) {
String prefix = "com/adobe/appmon/appmon.";
StringBuffer buff = new StringBuffer(prefix);
buff.append(appMonBaseName);
buff.append('.');
buff.append(localeName);
buff.append(".xml");
String appConfigName = buff.toString();
buff = new StringBuffer(prefix);
buff.append(appMonBaseName);
buff.append(".addition.");
buff.append(localeName);
buff.append(".xml");
String appAdditionName = buff.toString();
buff = new StringBuffer(prefix);
buff = buff.append("global.");
buff.append(localeName);
buff.append(".xml");
String globalName = buff.toString();
buff = new StringBuffer(prefix);
buff.append(appMonBaseName);
buff.append(".script.");
buff.append(localeName);
buff.append(".xml");
String scriptName = buff.toString();
result.appSpecific = this.getXmlByteArray(appConfigName);
result.appAdditional = this.getXmlByteArray(appAdditionName);
result.global = this.getXmlByteArray(globalName);
result.script = this.getXmlByteArray(scriptName);
if (result.appSpecific.length == 0 && result.appAdditional.length == 0) {
result = new AppMonData(emptyArray, emptyArray, emptyArray, emptyArray);
}
if (!debugAppMon) {
m_appMonData.put(appMonBaseName + localeName, result);
}
}
return result;
}
protected byte[] getXmlByteArray(String appConfigName) {
byte[] result = new byte[]{};
InputStream inputStream = null;
if (debugAppMon) {
String appConfigPath = "C:/temp/" + appConfigName.substring(appConfigName.lastIndexOf(47) + 1);
try {
inputStream = new FileInputStream(appConfigPath);
}
catch (FileNotFoundException fnfe) {
this.pdfgLogger.trace("[Native2PdfCaller.getXmlByteArray()] File not found: " + appConfigPath);
}
} else {
inputStream = this.getClass().getClassLoader().getResourceAsStream(appConfigName);
}
if (inputStream != null) {
try {
Unmarshaller unmarshaller = Native2PdfCaller.getAppMonUnmarshaller();
Serializable dialogs = (Serializable)unmarshaller.unmarshal(inputStream);
result = this.objectToByteArray(dialogs);
}
catch (JAXBException e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
}
catch (IOException e) {
this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
}
}
return result;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled force condition propagation
* Lifted jumps to return sites
*/
protected byte[] objectToByteArray(Object appConfig) throws IOException {
ByteArrayOutputStream appConfigStream;
byte[] arrby;
block5 : {
if (appConfig == null || !(appConfig instanceof Serializable)) {
return new byte[0];
}
appConfigStream = new ByteArrayOutputStream();
ObjectOutputStream objectStream = null;
try {
objectStream = new ObjectOutputStream(appConfigStream);
objectStream.writeObject(appConfig);
objectStream.flush();
byte[] appConfigBytes = appConfigStream.toByteArray();
objectStream.close();
arrby = appConfigBytes;
Object var7_6 = null;
if (objectStream == null) break block5;
}
catch (Throwable var6_8) {
Object var7_7 = null;
if (objectStream != null) {
objectStream.close();
throw var6_8;
} else {
appConfigStream.close();
}
throw var6_8;
}
objectStream.close();
return arrby;
}
appConfigStream.close();
return arrby;
}
private String determineDestExt(String export) {
String storedOutput = null;
storedOutput = "plain-text".equalsIgnoreCase(export) ? "txt" : ("accessible-text".equalsIgnoreCase(export) ? "txt" : ("rtf".equalsIgnoreCase(export) ? "rtf" : ("doc".equalsIgnoreCase(export) || "docx".equalsIgnoreCase(export) || "xlsx".equalsIgnoreCase(export) || "pptx".equalsIgnoreCase(export) || "html32".equalsIgnoreCase(export) || "html40".equalsIgnoreCase(export) || "eps".equalsIgnoreCase(export) || "xml10".equalsIgnoreCase(export) ? "zip" : (export.startsWith("PDF/") ? "pdf" : (export.startsWith("PDFAcrobat") || export.startsWith("PDFRetain") ? "pdf" : null)))));
return storedOutput;
}
protected boolean checkLinearizationForPostProcessing() {
return false;
}
private String getExtOfUnknownFileType(File inputFile) throws IOException {
String extension = null;
int result = new FileTypeAnalyzer().identify(inputFile);
switch (result) {
case 1: {
extension = "xls";
break;
}
case 2: {
extension = "doc";
break;
}
case 3: {
extension = "ppt";
break;
}
case 5: {
extension = "pdf";
break;
}
case 9: {
extension = "rtf";
break;
}
case 13: {
extension = "pub";
break;
}
}
return extension;
}
public static void setRetryLogic(String retryLogicStr) {
for (RetryLogic logic : RetryLogic.values()) {
if (!logic.getName().equalsIgnoreCase(retryLogicStr)) continue;
retryLogic = logic;
}
}
public static synchronized JAXBContext getAppMonJAXBContext() throws JAXBException {
if (appMonJAXBContext == null) {
appMonJAXBContext = JAXBContext.newInstance("com.adobe.appmon.xml", Native2PdfCaller.class.getClassLoader());
}
return appMonJAXBContext;
}
public static Unmarshaller getAppMonUnmarshaller() throws JAXBException {
Unmarshaller unmarshaller = Native2PdfCaller.getAppMonJAXBContext().createUnmarshaller();
return unmarshaller;
}
static {
m_ExportTypeMapping.put("EPS", Constants.FT_EXPORTTO_OPTIONS[0].toLowerCase());
m_ExportTypeMapping.put("HTML32", Constants.FT_EXPORTTO_OPTIONS[1].toLowerCase());
m_ExportTypeMapping.put("HTML40", Constants.FT_EXPORTTO_OPTIONS[2].toLowerCase());
m_ExportTypeMapping.put("DOC", Constants.FT_EXPORTTO_OPTIONS[5].toLowerCase());
m_ExportTypeMapping.put("DOCX", Constants.FT_EXPORTTO_OPTIONS[6].toLowerCase());
m_ExportTypeMapping.put("XLSX", Constants.FT_EXPORTTO_OPTIONS[7].toLowerCase());
m_ExportTypeMapping.put("PPTX", Constants.FT_EXPORTTO_OPTIONS[8].toLowerCase());
m_ExportTypeMapping.put("RTF", Constants.FT_EXPORTTO_OPTIONS[11].toLowerCase());
m_ExportTypeMapping.put("Accessible-Text", Constants.FT_EXPORTTO_OPTIONS[12].toLowerCase());
m_ExportTypeMapping.put("Plain-Text", Constants.FT_EXPORTTO_OPTIONS[13].toLowerCase());
m_ExportTypeMapping.put("XML10", Constants.FT_EXPORTTO_OPTIONS[15].toLowerCase());
m_ExportTypeMapping.put("PDF/A-1a(sRGB)", Constants.FT_EXPORTTO_OPTIONS[16].toLowerCase());
m_ExportTypeMapping.put("PDF/A-1b(sRGB)", Constants.FT_EXPORTTO_OPTIONS[17].toLowerCase());
m_ExportTypeMapping.put("PDF/E-1(sRGB)", Constants.FT_EXPORTTO_OPTIONS[18].toLowerCase());
m_OptimizeTypeSet.add("PDFRetainVersion");
m_OptimizeTypeSet.add("PDFAcrobat4");
m_OptimizeTypeSet.add("PDFAcrobat5");
m_OptimizeTypeSet.add("PDFAcrobat6");
m_OptimizeTypeSet.add("PDFAcrobat7");
m_OptimizeTypeSet.add("PDFAcrobat8");
m_OptimizeTypeSet.add("PDFAcrobat9");
m_OptimizeTypeSet.add("PDFAcrobat10");
m_ExportContentTypeMapping.put("EPS", "application/zip");
m_ExportContentTypeMapping.put("HTML32", "application/zip");
m_ExportContentTypeMapping.put("HTML40", "application/zip");
m_ExportContentTypeMapping.put("DOC", "application/zip");
m_ExportContentTypeMapping.put("RTF", "application/rtf");
m_ExportContentTypeMapping.put("Accessible-Text", "text/plain");
m_ExportContentTypeMapping.put("Plain-Text", "text/plain");
m_ExportContentTypeMapping.put("XML10", "application/zip");
m_ExportContentTypeMapping.put("PDFRetainVersion", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat4", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat5", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat6", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat7", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat8", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat9", "application/pdf");
m_ExportContentTypeMapping.put("PDFAcrobat10", "application/pdf");
String localeName = AESProperties.getLocale().toString();
m_AppmonLocale = localeName.startsWith("de") ? "de_DE" : (localeName.startsWith("fr") ? "fr_FR" : (localeName.startsWith("ja") ? "ja_JP" : "en_US"));
}
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
private static enum RetryLogic {
NO_RETRY("No retry", 0, false),
RETRY("Retry", 1, false),
RETRY_IF_TIME_PERMITS("Retry if time permits", 1, true);
private final String name;
private final int retryCount;
private final boolean shareTime;
public String getName() {
return this.name;
}
public int getRetryCount() {
return this.retryCount;
}
public boolean isShareTime() {
return this.shareTime;
}
private RetryLogic(String name, int retryCount, boolean shareTime) {
this.name = name;
this.retryCount = retryCount;
this.shareTime = shareTime;
}
}
}