PDFGProductInfo.java
4.73 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.pdfg.exception.ConfigException
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.pdfg.common;
import com.adobe.pdfg.exception.ConfigException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PDFGProductInfo
implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(PDFGProductInfo.class);
static final long serialVersionUID = 765312;
static final String LICENSE_EVAL = "Eval";
static final String LICENSE_FULL = "Full";
private String licenseType;
private String version;
private String patchVersion;
private String expirationDate;
private String seriallNumber;
private boolean windows = false;
private boolean aix = false;
static PDFGProductInfo instance = null;
static PDFGProductInfo emptyInstance = null;
private PDFGProductInfo(String licenseType, String version, String patchVersion, String dateString, String serialNumber) {
this.licenseType = licenseType;
this.version = version;
this.patchVersion = patchVersion;
this.expirationDate = dateString;
this.seriallNumber = serialNumber;
String osName = System.getProperty("os.name").toLowerCase();
this.windows = osName.indexOf("windows") >= 0;
this.aix = osName.indexOf("aix") >= 0;
}
private PDFGProductInfo() {
String osName = System.getProperty("os.name").toLowerCase();
this.windows = osName.indexOf("windows") >= 0;
this.aix = osName.indexOf("aix") >= 0;
}
public static long getSerialVersionUID() {
return 765312;
}
public String getExpirationDate() {
return this.expirationDate;
}
public String getLicenseType() {
return this.licenseType;
}
public String getVersion() {
return this.version;
}
public String getPatchVersion() {
return this.patchVersion;
}
public String getSerialNumber() {
return this.seriallNumber;
}
public static PDFGProductInfo getEmptyInstance() {
if (emptyInstance == null) {
emptyInstance = new PDFGProductInfo();
}
return emptyInstance;
}
public static PDFGProductInfo getInstance() throws ConfigException {
if (instance == null) {
PDFGProductInfo.init();
}
return instance;
}
private static void init() throws ConfigException {
PDFGProductInfo localInstance = new PDFGProductInfo("Full", "10.0.0", "0", "", "");
boolean ok = true;
String temp = localInstance.getLicenseType();
if (!localInstance.isEvaluation() && !localInstance.isFull()) {
logger.debug("Bad license type '" + temp + "'");
ok = false;
}
if ((temp = localInstance.getVersion()) == null) {
logger.debug("Bad version '" + temp + "'");
}
if ((temp = localInstance.getPatchVersion()) == null) {
logger.debug("Bad patch version '" + temp + "'");
}
if ((temp = localInstance.getExpirationDate()) == null) {
logger.debug("Bad expiration date'" + temp + "'");
ok = false;
}
if (!ok) {
throw new ConfigException(Integer.toString(80018));
}
instance = localInstance;
}
public Map getInfoMap() {
HashMap<String, String> infoMap = new HashMap<String, String>();
infoMap.put("PDFG_LICENSE_TYPE", this.licenseType);
infoMap.put("PDFG_VERSION", this.version);
infoMap.put("PDFG_PATCH_VERSION", this.patchVersion);
infoMap.put("PDFG_EXPIRATION_DATE", this.expirationDate);
infoMap.put("PDFG_SERIAL_NUMBER", this.seriallNumber);
return infoMap;
}
public void setFromMap(Map infoMap) {
this.licenseType = (String)infoMap.get("PDFG_LICENSE_TYPE");
this.version = (String)infoMap.get("PDFG_VERSION");
this.patchVersion = (String)infoMap.get("PDFG_PATCH_VERSION");
this.expirationDate = (String)infoMap.get("PDFG_EXPIRATION_DATE");
this.seriallNumber = (String)infoMap.get("PDFG_SERIAL_NUMBER");
}
public boolean isEvaluation() {
return this.licenseType.equalsIgnoreCase("Eval");
}
public boolean isFull() {
return this.licenseType.equalsIgnoreCase("Full");
}
public boolean isApplyWatermark() {
return this.licenseType.equalsIgnoreCase("Eval");
}
public boolean isWindows() {
return this.windows;
}
public boolean isUnix() {
return !this.windows;
}
public boolean isAix() {
return this.aix;
}
}