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 Oct 8, 2006
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) 2006 Grzegorz Kowal
044: */
045: public class Msg implements IValidatable {
046: private String startupErr;
047: private String bundledJreErr;
048: private String jreVersionErr;
049: private String launcherErr;
050: private String instanceAlreadyExistsMsg;
051:
052: public void checkInvariants() {
053: Validator.checkOptString(startupErr, 1024, "startupErr",
054: Messages.getString("Msg.startupErr"));
055: Validator.checkOptString(bundledJreErr, 1024, "bundledJreErr",
056: Messages.getString("Msg.bundledJreErr"));
057: Validator.checkOptString(jreVersionErr, 1024, "jreVersionErr",
058: Messages.getString("Msg.jreVersionErr"));
059: Validator.checkOptString(launcherErr, 1024, "launcherErr",
060: Messages.getString("Msg.launcherErr"));
061: Validator.checkOptString(instanceAlreadyExistsMsg, 1024,
062: "instanceAlreadyExistsMsg", Messages
063: .getString("Msg.instanceAlreadyExistsMsg"));
064: }
065:
066: public String getStartupErr() {
067: return !Validator.isEmpty(startupErr) ? startupErr
068: : "An error occurred while starting the application.";
069: }
070:
071: public void setStartupErr(String startupErr) {
072: this .startupErr = startupErr;
073: }
074:
075: public String getBundledJreErr() {
076: return !Validator.isEmpty(bundledJreErr) ? bundledJreErr
077: : "This application was configured to use a bundled Java Runtime"
078: + " Environment but the runtime is missing or corrupted.";
079: }
080:
081: public void setBundledJreErr(String bundledJreErr) {
082: this .bundledJreErr = bundledJreErr;
083: }
084:
085: public String getJreVersionErr() {
086: return !Validator.isEmpty(jreVersionErr) ? jreVersionErr
087: : "This application requires a Java Runtime Environment";
088: }
089:
090: public void setJreVersionErr(String jreVersionErr) {
091: this .jreVersionErr = jreVersionErr;
092: }
093:
094: public String getLauncherErr() {
095: return !Validator.isEmpty(launcherErr) ? launcherErr
096: : "The registry refers to a nonexistent Java Runtime Environment"
097: + " installation or the runtime is corrupted.";
098: }
099:
100: public void setLauncherErr(String launcherErr) {
101: this .launcherErr = launcherErr;
102: }
103:
104: public String getInstanceAlreadyExistsMsg() {
105: return !Validator.isEmpty(instanceAlreadyExistsMsg) ? instanceAlreadyExistsMsg
106: : "An application instance is already running.";
107: }
108:
109: public void setInstanceAlreadyExistsMsg(
110: String instanceAlreadyExistsMsg) {
111: this.instanceAlreadyExistsMsg = instanceAlreadyExistsMsg;
112: }
113: }
|