001:/*
002: * $RCSfile: VersionInfo.java,v $
003: *
004: * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006: *
007: * This code is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License version 2 only, as
009: * published by the Free Software Foundation. Sun designates this
010: * particular file as subject to the "Classpath" exception as provided
011: * by Sun in the LICENSE file that accompanied this code.
012: *
013: * This code is distributed in the hope that it will be useful, but WITHOUT
014: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: * version 2 for more details (a copy is included in the LICENSE file that
017: * accompanied this code).
018: *
019: * You should have received a copy of the GNU General Public License version
020: * 2 along with this work; if not, write to the Free Software Foundation,
021: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022: *
023: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024: * CA 95054 USA or visit www.sun.com if you need additional information or
025: * have any questions.
026: *
027: * $Revision: 1.10 $
028: * $Date: 2008/02/28 20:17:15 $
029: * $State: Exp $
030: */
031:
032:package javax.media.j3d;
033:
034:/**
035: * The VersionInfo class contains strings that describe the implementation
036: * and specification version of the javax.media.j3d pacakge. These strings
037: * are made available as properties obtained from the VirtualUniverse class.
038: *
039: * <h4>NOTE TO DEVELOPERS:</h4>
040: *
041: * <p>
042: * Developers are strongly encouraged to do the following whenever they
043: * modify the 3D graphics API for the Java platform:
044: *
045: * <ol>
046: * <li>The VENDOR_DEVELOPER string should be modified to
047: * indicate the name of the individuals or organizations who have
048: * modified the source code.</li>
049: *
050: * <li>The VERSION_DEV_STRING may be modified to indicate
051: * additional information about the particular build, but this is
052: * not required.</li>
053: *
054: * <li>The strings denoted as being unmodifiable should <i>not</i> be
055: * modified.</li>
056: * </ol>
057: *
058: * <p>
059: * The tags of the form @STRING@ are populated by ant when the project is built
060: *
061: * @see VirtualUniverse#getProperties
062: */
063:class VersionInfo extends Object {
064: /**
065: * Developer who has modified the 3D graphics API for the Java platform.
066: * This string should be modified to indicate the name of the
067: * individual(s) or organization(s) who modified the code.
068: */
069: private static final String VENDOR_DEVELOPER = null;
070:
071:
072: /**
073: * An optional string appended to the end of the version string,
074: * after the time stamp. A space will be automatically prepended
075: * to this string. This string should be null if no dev string is
076: * desired.
077: */
078: private static final String VERSION_DEV_STRING = null;
079:
080: // -------------------------------------------------------------------
081: // -------------------------------------------------------------------
082: // END OF DEVELOPER-MODIFIABLE PARAMETERS
083: // -------------------------------------------------------------------
084: // -------------------------------------------------------------------
085:
086:
087: // -------------------------------------------------------------------
088: // The following set of constants should not be modified by developers.
089: // -------------------------------------------------------------------
090:
091: /**
092: * Constant that indicates whether or not this is a debug build.
093: */
094: static final boolean isDebug = @IS_DEBUG@;
095:
096: /**
097: * This static final variable is used to enable debugging and
098: * assertion checking during the development phase of a particular
099: * version of 3D graphics API for the Java platform. It is disabled
100: * for "opt" production builds (beta, release candidate, fcs, and
101: * patch builds). It is enabled for all "debug" builds and for daily
102: * and stable "opt" builds.
103: *
104: * <p>
105: * This parameter is controlled by ant via the build.xml file. The
106: * default value is true.
107: */
108: static final boolean isDevPhase = @IS_DEV_PHASE@;
109:
110: /**
111: * This static final variable is used indicate a production
112: * (beta, release candidate, fcs, or patch) build.
113: * <p>
114: * This parameter is controlled by ant via the build.xml file. The
115: * default value is false.
116: */
117: static final boolean isProduction = @IS_PRODUCTION@;
118:
119: /**
120: * If this flag is set to true, the verbose buildtime string
121: * will be appended to the version string)
122: * <p>
123: * This parameter is controlled by ant via the build.xml file. The
124: * default value is true.
125: */
126: private static final boolean useVerboseBuildTime = @USE_VERBOSE_BUILDTIME@;
127:
128: /**
129: * String identifying the type of build, one of:
130: * "daily", "stable", "beta", "fcs", or "patch". The default value
131: * is "daily".
132: */
133: private static final String BUILD_TYPE = "@BUILD_TYPE@";
134:
135: /**
136: * String identifying the build number in the format
137: * "buildNN", where "NN" is the sequential build number, for
138: * example, build47. This string contain only letters and
139: * numbers, It must not contain any other characters or spaces.
140: *
141: * For production builds, this string appears parenthetically,
142: * after the first space.
143: */
144: private static final String VERSION_BUILD = "@VERSION_BUILD@";
145:
146: /**
147: * String identifying the particular build of the 3D API, for
148: * example, "-beta1", "-build47", "-rc1", "_01", etc. Note that
149: * this includes the leading dash or underscore. It will typically
150: * be empty for FCS builds. This string may only contain letters,
151: * numbers, periods, dashes, or underscores. It must not contain
152: * any other characters or spaces.
153: *
154: * This us used as part of the j3d.version that appears before the
155: * optional first space.
156: */
157: private static final String VERSION_SUFFIX = "@VERSION_SUFFIX@";
158:
159: /**
160: * Date stamp
161: *
162: * This is only used for daily builds.
163: */
164: private static final String BUILDTIME = "@BUILDTIME@";
165:
166: /**
167: * Specification version (major and minor version only). This
168: * string must not be modified by developers.
169: */
170: private static final String SPECIFICATION_VERSION = "1.5";
171:
172: /**
173: * Specification vendor.
174: */
175: private static final String SPECIFICATION_VENDOR = "@SPEC_VENDOR@";
176:
177: /**
178: * Primary implementation vendor.
179: */
180: private static final String VENDOR_PRIMARY = "@IMPL_VENDOR@";
181:
182: /**
183: * Base version number. This is the major.minor.subminor version
184: * number. Version qualifiers are specified separately. The
185: * major and minor version <i>must</i> be the same as the specification
186: * version.
187: */
188: private static final String VERSION_BASE = "@VERSION_BASE@";
189:
190: /**
191: * Boolean flag indicating that the version of the 3D API is
192: * experimental. This must <i>not</i> be modified by developers.
193: * All non-official builds <i>must</i> contain the string
194: * <code>"experimental"</code> as part of the release name that
195: * appears before the optional first space.
196: */
197: private static final boolean isExperimental = !isProduction;
198:
199: /**
200: * The composite version string. This is composed in the static
201: * initializer for this class.
202: */
203: private static final String VERSION;
204:
205: /**
206: * The composite vendor string. This is composed in the static
207: * initializer for this class.
208: */
209: private static final String VENDOR;
210:
211: /**
212: * Verbose time and date stamp appended to the end of the version string.
213: * This is appended to the version string
214: * after the build identifier (and after the first space, which
215: * will automatically be added) and before the optional dev
216: * string. This string is only used for non-fcs builds.
217: */
218: private static final String BUILDTIME_VERBOSE = "@BUILDTIME_VERBOSE@";
219:
220: private static boolean isNonEmpty(String str) {
221: if ((str == null) || (str.length() == 0)) {
222: return false;
223: }
224: else {
225: return true;
226: }
227: }
228:
229: // The static initializer composes the version and vendor strings
230: static {
231: final boolean isPatchBuild = BUILD_TYPE.equals("patch");
232: final boolean isFcsBuild = BUILD_TYPE.equals("fcs");
233: final boolean isBetaBuild = BUILD_TYPE.equals("beta");
234: final boolean isStableBuild = BUILD_TYPE.equals("stable");
235: final boolean isDailyBuild = BUILD_TYPE.equals("daily");
236:
237: // Assign the vendor by concatenating primary and developer
238: // vendor strings
239: String tmpVendor = VENDOR_PRIMARY;
240: if (isNonEmpty(VENDOR_DEVELOPER)) {
241: tmpVendor += " & " + VENDOR_DEVELOPER;
242: }
243:
244: String tmpVersion = VERSION_BASE;
245: if (isNonEmpty(VERSION_SUFFIX)) {
246: if (isPatchBuild) {
247: tmpVersion += "_";
248: }
249: else {
250: tmpVersion += "-";
251: }
252: tmpVersion += VERSION_SUFFIX;
253: }
254:
255: if (isDailyBuild && isNonEmpty(BUILDTIME)) {
256: tmpVersion += "-" + BUILDTIME;
257: }
258:
259: if (isExperimental) {
260: tmpVersion += "-experimental";
261: }
262:
263: // Append the optional fields that follow the first space
264:
265: if (isProduction) {
266: if (isFcsBuild) {
267: tmpVersion += " fcs";
268: }
269: else if (isPatchBuild) {
270: tmpVersion += " fcs+patch";
271: }
272:
273: if (isNonEmpty(VERSION_BUILD)) {
274: tmpVersion += " (" + VERSION_BUILD + ")";
275: }
276: }
277:
278: if (useVerboseBuildTime && isNonEmpty(BUILDTIME_VERBOSE)) {
279: tmpVersion += " " + BUILDTIME_VERBOSE;
280: }
281:
282: if (isNonEmpty(VERSION_DEV_STRING)) {
283: tmpVersion += " " + VERSION_DEV_STRING;
284: }
285:
286: VERSION = tmpVersion;
287: VENDOR = tmpVendor;
288: }
289:
290: /**
291: * Returns the specification version string.
292: * @return the specification version string
293: */
294: static String getSpecificationVersion() {
295: return SPECIFICATION_VERSION;
296: }
297:
298: /**
299: * Returns the specification vendor string.
300: * @return the specification vendor string
301: */
302: static String getSpecificationVendor() {
303: return SPECIFICATION_VENDOR;
304: }
305:
306:
307: /**
308: * Returns the implementation version string.
309: * @return the implementation version string
310: */
311: static String getVersion() {
312: return VERSION;
313: }
314:
315: /**
316: * Returns the implementation vendor string.
317: * @return the implementation vendor string
318: */
319: static String getVendor() {
320: return VENDOR;
321: }
322:
323:}
|