1 | /*
|
---|
2 | Launch4j (http://launch4j.sourceforge.net/)
|
---|
3 | Cross-platform Java application wrapper for creating Windows native executables.
|
---|
4 |
|
---|
5 | Copyright (C) 2004, 2006 Grzegorz Kowal
|
---|
6 |
|
---|
7 | This program is free software; you can redistribute it and/or modify
|
---|
8 | it under the terms of the GNU General Public License as published by
|
---|
9 | the Free Software Foundation; either version 2 of the License, or
|
---|
10 | (at your option) any later version.
|
---|
11 |
|
---|
12 | This program is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | GNU General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with this program; if not, write to the Free Software
|
---|
19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Created on May 21, 2005
|
---|
24 | */
|
---|
25 | package net.sf.launch4j.config;
|
---|
26 |
|
---|
27 | import net.sf.launch4j.binding.IValidatable;
|
---|
28 | import net.sf.launch4j.binding.Validator;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * @author Copyright (C) 2005 Grzegorz Kowal
|
---|
32 | */
|
---|
33 | public class VersionInfo implements IValidatable {
|
---|
34 | public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+"; //$NON-NLS-1$
|
---|
35 | private static final int MAX_LEN = 150;
|
---|
36 |
|
---|
37 | private String fileVersion;
|
---|
38 | private String txtFileVersion;
|
---|
39 | private String fileDescription;
|
---|
40 | private String copyright;
|
---|
41 | private String productVersion;
|
---|
42 | private String txtProductVersion;
|
---|
43 | private String productName;
|
---|
44 | private String companyName;
|
---|
45 | private String internalName;
|
---|
46 | private String originalFilename;
|
---|
47 |
|
---|
48 | public void checkInvariants() {
|
---|
49 | Validator.checkString(fileVersion, 20, VERSION_PATTERN,
|
---|
50 | "versionInfo.fileVersion", Messages.getString("VersionInfo.file.version")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
51 | Validator.checkString(txtFileVersion, 50,
|
---|
52 | "versionInfo.txtFileVersion", Messages.getString("VersionInfo.txt.file.version")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
53 | Validator.checkString(fileDescription, MAX_LEN,
|
---|
54 | "versionInfo.fileDescription", Messages.getString("VersionInfo.file.description")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
55 | Validator.checkString(copyright, MAX_LEN,
|
---|
56 | "versionInfo.copyright", Messages.getString("VersionInfo.copyright")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
57 | Validator.checkString(productVersion, 20, VERSION_PATTERN,
|
---|
58 | "versionInfo.productVersion", Messages.getString("VersionInfo.product.version")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
59 | Validator.checkString(txtProductVersion, 50,
|
---|
60 | "versionInfo.txtProductVersion", Messages.getString("VersionInfo.txt.product.version")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
61 | Validator.checkString(productName, MAX_LEN,
|
---|
62 | "versionInfo.productName", Messages.getString("VersionInfo.product.name")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
63 | Validator.checkOptString(companyName, MAX_LEN,
|
---|
64 | "versionInfo.companyName", Messages.getString("VersionInfo.company.name")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
65 | Validator.checkString(internalName, 50,
|
---|
66 | "versionInfo.internalName", Messages.getString("VersionInfo.internal.name")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
67 | Validator.checkTrue(!internalName.endsWith(".exe"), //$NON-NLS-1$
|
---|
68 | "versionInfo.internalName", //$NON-NLS-1$
|
---|
69 | Messages.getString("VersionInfo.internal.name.not.exe")); //$NON-NLS-1$
|
---|
70 | Validator.checkString(originalFilename, 50,
|
---|
71 | "versionInfo.originalFilename", Messages.getString("VersionInfo.original.filename")); //$NON-NLS-1$ //$NON-NLS-2$
|
---|
72 | Validator.checkTrue(originalFilename.endsWith(".exe"), //$NON-NLS-1$
|
---|
73 | "versionInfo.originalFilename", //$NON-NLS-1$
|
---|
74 | Messages.getString("VersionInfo.original.filename.exe")); //$NON-NLS-1$
|
---|
75 | }
|
---|
76 |
|
---|
77 | public String getCompanyName() {
|
---|
78 | return companyName;
|
---|
79 | }
|
---|
80 |
|
---|
81 | public void setCompanyName(String companyName) {
|
---|
82 | this.companyName = companyName;
|
---|
83 | }
|
---|
84 |
|
---|
85 | public String getCopyright() {
|
---|
86 | return copyright;
|
---|
87 | }
|
---|
88 |
|
---|
89 | public void setCopyright(String copyright) {
|
---|
90 | this.copyright = copyright;
|
---|
91 | }
|
---|
92 |
|
---|
93 | public String getFileDescription() {
|
---|
94 | return fileDescription;
|
---|
95 | }
|
---|
96 |
|
---|
97 | public void setFileDescription(String fileDescription) {
|
---|
98 | this.fileDescription = fileDescription;
|
---|
99 | }
|
---|
100 |
|
---|
101 | public String getFileVersion() {
|
---|
102 | return fileVersion;
|
---|
103 | }
|
---|
104 |
|
---|
105 | public void setFileVersion(String fileVersion) {
|
---|
106 | this.fileVersion = fileVersion;
|
---|
107 | }
|
---|
108 |
|
---|
109 | public String getInternalName() {
|
---|
110 | return internalName;
|
---|
111 | }
|
---|
112 |
|
---|
113 | public void setInternalName(String internalName) {
|
---|
114 | this.internalName = internalName;
|
---|
115 | }
|
---|
116 |
|
---|
117 | public String getOriginalFilename() {
|
---|
118 | return originalFilename;
|
---|
119 | }
|
---|
120 |
|
---|
121 | public void setOriginalFilename(String originalFilename) {
|
---|
122 | this.originalFilename = originalFilename;
|
---|
123 | }
|
---|
124 |
|
---|
125 | public String getProductName() {
|
---|
126 | return productName;
|
---|
127 | }
|
---|
128 |
|
---|
129 | public void setProductName(String productName) {
|
---|
130 | this.productName = productName;
|
---|
131 | }
|
---|
132 |
|
---|
133 | public String getProductVersion() {
|
---|
134 | return productVersion;
|
---|
135 | }
|
---|
136 |
|
---|
137 | public void setProductVersion(String productVersion) {
|
---|
138 | this.productVersion = productVersion;
|
---|
139 | }
|
---|
140 |
|
---|
141 | public String getTxtFileVersion() {
|
---|
142 | return txtFileVersion;
|
---|
143 | }
|
---|
144 |
|
---|
145 | public void setTxtFileVersion(String txtFileVersion) {
|
---|
146 | this.txtFileVersion = txtFileVersion;
|
---|
147 | }
|
---|
148 |
|
---|
149 | public String getTxtProductVersion() {
|
---|
150 | return txtProductVersion;
|
---|
151 | }
|
---|
152 |
|
---|
153 | public void setTxtProductVersion(String txtProductVersion) {
|
---|
154 | this.txtProductVersion = txtProductVersion;
|
---|
155 | }
|
---|
156 | }
|
---|