001: /*
002: Launch4j (http://launch4j.sourceforge.net/)
003: Cross-platform Java application wrapper for creating Windows native executables.
004:
005: Copyright (c) 2004, 2007 Grzegorz Kowal
006:
007: All rights reserved.
008:
009: Redistribution and use in source and binary forms, with or without modification,
010: are permitted provided that the following conditions are met:
011:
012: * Redistributions of source code must retain the above copyright notice,
013: this list of conditions and the following disclaimer.
014: * Redistributions in binary form must reproduce the above copyright notice,
015: this list of conditions and the following disclaimer in the documentation
016: and/or other materials provided with the distribution.
017: * Neither the name of the Launch4j nor the names of its contributors
018: may be used to endorse or promote products derived from this software without
019: specific prior written permission.
020:
021: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
022: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
023: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
024: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
025: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
026: EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
027: PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
028: PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
029: LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
030: NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
031: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
032: */
033:
034: /*
035: * Created on May 21, 2005
036: */
037: package net.sf.launch4j.config;
038:
039: import net.sf.launch4j.binding.IValidatable;
040: import net.sf.launch4j.binding.Validator;
041:
042: /**
043: * @author Copyright (C) 2005 Grzegorz Kowal
044: */
045: public class VersionInfo implements IValidatable {
046: public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+";
047:
048: private String fileVersion;
049: private String txtFileVersion;
050: private String fileDescription;
051: private String copyright;
052: private String productVersion;
053: private String txtProductVersion;
054: private String productName;
055: private String companyName;
056: private String internalName;
057: private String originalFilename;
058:
059: public void checkInvariants() {
060: Validator.checkString(fileVersion, 20, VERSION_PATTERN,
061: "versionInfo.fileVersion", Messages
062: .getString("VersionInfo.file.version"));
063: Validator.checkString(txtFileVersion, 50,
064: "versionInfo.txtFileVersion", Messages
065: .getString("VersionInfo.txt.file.version"));
066: Validator.checkString(fileDescription, 150,
067: "versionInfo.fileDescription", Messages
068: .getString("VersionInfo.file.description"));
069: Validator.checkString(copyright, 150, "versionInfo.copyright",
070: Messages.getString("VersionInfo.copyright"));
071: Validator.checkString(productVersion, 20, VERSION_PATTERN,
072: "versionInfo.productVersion", Messages
073: .getString("VersionInfo.product.version"));
074: Validator.checkString(txtProductVersion, 50,
075: "versionInfo.txtProductVersion", Messages
076: .getString("VersionInfo.txt.product.version"));
077: Validator.checkString(productName, 150,
078: "versionInfo.productName", Messages
079: .getString("VersionInfo.product.name"));
080: Validator.checkOptString(companyName, 150,
081: "versionInfo.companyName", Messages
082: .getString("VersionInfo.company.name"));
083: Validator.checkString(internalName, 50,
084: "versionInfo.internalName", Messages
085: .getString("VersionInfo.internal.name"));
086: Validator
087: .checkTrue(
088: !internalName.endsWith(".exe"),
089: "versionInfo.internalName",
090: Messages
091: .getString("VersionInfo.internal.name.not.exe"));
092: Validator.checkString(originalFilename, 50,
093: "versionInfo.originalFilename", Messages
094: .getString("VersionInfo.original.filename"));
095: Validator
096: .checkTrue(
097: originalFilename.endsWith(".exe"),
098: "versionInfo.originalFilename",
099: Messages
100: .getString("VersionInfo.original.filename.exe"));
101: }
102:
103: public String getCompanyName() {
104: return companyName;
105: }
106:
107: public void setCompanyName(String companyName) {
108: this .companyName = companyName;
109: }
110:
111: public String getCopyright() {
112: return copyright;
113: }
114:
115: public void setCopyright(String copyright) {
116: this .copyright = copyright;
117: }
118:
119: public String getFileDescription() {
120: return fileDescription;
121: }
122:
123: public void setFileDescription(String fileDescription) {
124: this .fileDescription = fileDescription;
125: }
126:
127: public String getFileVersion() {
128: return fileVersion;
129: }
130:
131: public void setFileVersion(String fileVersion) {
132: this .fileVersion = fileVersion;
133: }
134:
135: public String getInternalName() {
136: return internalName;
137: }
138:
139: public void setInternalName(String internalName) {
140: this .internalName = internalName;
141: }
142:
143: public String getOriginalFilename() {
144: return originalFilename;
145: }
146:
147: public void setOriginalFilename(String originalFilename) {
148: this .originalFilename = originalFilename;
149: }
150:
151: public String getProductName() {
152: return productName;
153: }
154:
155: public void setProductName(String productName) {
156: this .productName = productName;
157: }
158:
159: public String getProductVersion() {
160: return productVersion;
161: }
162:
163: public void setProductVersion(String productVersion) {
164: this .productVersion = productVersion;
165: }
166:
167: public String getTxtFileVersion() {
168: return txtFileVersion;
169: }
170:
171: public void setTxtFileVersion(String txtFileVersion) {
172: this .txtFileVersion = txtFileVersion;
173: }
174:
175: public String getTxtProductVersion() {
176: return txtProductVersion;
177: }
178:
179: public void setTxtProductVersion(String txtProductVersion) {
180: this.txtProductVersion = txtProductVersion;
181: }
182: }
|