001: /*
002: * A Mac OS X Jar Bundler Ant Task.
003: *
004: * Copyright (c) 2003, Seth J. Morabito <sethm@loomcom.com> All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify it
007: * under the terms of the GNU General Public License as published by the Free
008: * Software Foundation; either version 2 of the License, or (at your option)
009: * any later version.
010: *
011: * This program is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
014: * more details.
015: *
016: * You should have received a copy of the GNU General Public License along with
017: * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
018: * Place - Suite 330, Boston, MA 02111-1307, USA.
019: */
020:
021: package net.sourceforge.jarbundler;
022:
023: // Java Utility
024: import java.util.ArrayList;
025: import java.util.Hashtable;
026: import java.util.List;
027: import java.util.LinkedList;
028:
029: // Java language imports
030: import java.lang.String;
031:
032: public class AppBundleProperties {
033:
034: // Required
035: private String mApplicationName;
036: private String mMainClass;
037:
038: // Application short name
039: private String mCFBundleName = null;
040:
041: // Finder version, with default
042: private String mCFBundleShortVersionString = "1.0";
043:
044: // Get Info string, optional
045: private String mCFBundleGetInfoString = null;
046:
047: // Build number, optional
048: private String mCFBundleVersion = null;
049:
050: // Help Book folder, optional
051: private String mCFHelpBookFolder = null;
052:
053: // Help Book name, optional
054: private String mCFHelpBookName = null;
055:
056: // Explicit default: false
057: private boolean mCFBundleAllowMixedLocalizations = false;
058:
059: // Explicit default: JavaApplicationStub
060: private String mCFBundleExecutable = "JavaApplicationStub";
061:
062: // Explicit default: English
063: private String mCFBundleDevelopmentRegion = "English";
064:
065: // Explicit default: APPL
066: private final String mCFBundlePackageType = "APPL";
067:
068: // Explicit default: ????
069: private String mCFBundleSignature = "????";
070:
071: // Explicit default: 1.3+
072: private String mJVMVersion = "1.3+";
073:
074: // Explicit default: 6.0
075: private final String mCFBundleInfoDictionaryVersion = "6.0";
076:
077: // Optional keys, with no defaults.
078:
079: private String mCFBundleIconFile = null;
080: private String mCFBundleIdentifier = null;
081: private String mVMOptions = null; // Java VM options
082: private String mWorkingDirectory = null; // Java Working Dir
083: private String mArguments = null; // Java command line arguments
084:
085: // Class path and extra class path elements
086: private List mClassPath = new ArrayList();
087: private List mExtraClassPath = new ArrayList();
088:
089: // Java properties
090: private Hashtable mJavaProperties = new Hashtable();
091:
092: // Document types
093: private List mDocumentTypes = new LinkedList();
094:
095: // Services
096: private List mServices = new LinkedList();
097:
098: // ================================================================================
099:
100: /**
101: * Add a Java runtime property to the properties hashtable.
102: */
103:
104: public void addJavaProperty(String prop, String val) {
105: mJavaProperties.put(prop, val);
106: }
107:
108: public Hashtable getJavaProperties() {
109: return mJavaProperties;
110: }
111:
112: public void addToClassPath(String s) {
113: mClassPath.add("$JAVAROOT/" + s);
114: }
115:
116: public void addToExtraClassPath(String s) {
117: mExtraClassPath.add(s);
118: }
119:
120: public List getExtraClassPath() {
121: return mExtraClassPath;
122: }
123:
124: public DocumentType createDocumentType() {
125: return new DocumentType();
126: }
127:
128: public List getDocumentTypes() {
129: return mDocumentTypes;
130: }
131:
132: /**
133: * Add a document type to the document type list.
134: */
135: public void addDocumentType(DocumentType documentType) {
136: mDocumentTypes.add(documentType);
137: }
138:
139: public Service createService() {
140: return new Service();
141: }
142:
143: public List getServices() {
144: return mServices;
145: }
146:
147: /**
148: * Add a service to the services list.
149: */
150: public void addService(Service service) {
151: mServices.add(service);
152: }
153:
154: // ================================================================================
155:
156: public void setApplicationName(String s) {
157: mApplicationName = s;
158: }
159:
160: public String getApplicationName() {
161: return mApplicationName;
162: }
163:
164: // ================================================================================
165: //
166: // Bundle setters and getters
167: //
168:
169: public void setCFBundleName(String s) {
170:
171: if (s.length() > 16)
172: System.err
173: .println("WARNING: 'shortname' is recommeded to be no more than 16 "
174: + "charaters long. See usage notes.");
175: mCFBundleName = s;
176: }
177:
178: public String getCFBundleName() {
179: if (mCFBundleName == null)
180: return getApplicationName();
181:
182: return mCFBundleName;
183: }
184:
185: public void setCFBundleVersion(String s) {
186: mCFBundleVersion = s;
187: }
188:
189: public String getCFBundleVersion() {
190: return mCFBundleVersion;
191: }
192:
193: public void setCFBundleInfoDictionaryVersion(String s) {
194: // mCFBundleInfoDictionaryVersion = s;
195: }
196:
197: public String getCFBundleInfoDictionaryVersion() {
198: return mCFBundleInfoDictionaryVersion;
199: }
200:
201: public void setCFBundleIdentifier(String s) {
202: mCFBundleIdentifier = s;
203: }
204:
205: public String getCFBundleIdentifier() {
206: return mCFBundleIdentifier;
207: }
208:
209: public void setCFBundleGetInfoString(String s) {
210: mCFBundleGetInfoString = s;
211: }
212:
213: public String getCFBundleGetInfoString() {
214: if (mCFBundleGetInfoString == null)
215: return getCFBundleShortVersionString();
216:
217: return mCFBundleGetInfoString;
218: }
219:
220: public void setCFBundleShortVersionString(String s) {
221: mCFBundleShortVersionString = s;
222: }
223:
224: public String getCFBundleShortVersionString() {
225: return mCFBundleShortVersionString;
226: }
227:
228: public void setCFBundleIconFile(String s) {
229: mCFBundleIconFile = s;
230: }
231:
232: public String getCFBundleIconFile() {
233: return mCFBundleIconFile;
234: }
235:
236: public void setCFBundleAllowMixedLocalizations(boolean b) {
237: mCFBundleAllowMixedLocalizations = b;
238: }
239:
240: public boolean getCFBundleAllowMixedLocalizations() {
241: return mCFBundleAllowMixedLocalizations;
242: }
243:
244: public void setCFBundleExecutable(String s) {
245: mCFBundleExecutable = s;
246: }
247:
248: public String getCFBundleExecutable() {
249: return mCFBundleExecutable;
250: }
251:
252: public void setCFBundleDevelopmentRegion(String s) {
253: mCFBundleDevelopmentRegion = s;
254: }
255:
256: public String getCFBundleDevelopmentRegion() {
257: return mCFBundleDevelopmentRegion;
258: }
259:
260: public void setCFBundlePackageType(String s) {
261: // mCFBundlePackageType = s;
262: }
263:
264: public String getCFBundlePackageType() {
265: return mCFBundlePackageType;
266: }
267:
268: public void setCFBundleSignature(String s) {
269: mCFBundleSignature = s;
270: }
271:
272: public String getCFBundleSignature() {
273: return mCFBundleSignature;
274: }
275:
276: public void setCFBundleHelpBookFolder(String s) {
277: mCFHelpBookFolder = s;
278: }
279:
280: public String getCFBundleHelpBookFolder() {
281: return mCFHelpBookFolder;
282: }
283:
284: public void setCFBundleHelpBookName(String s) {
285: mCFHelpBookName = s;
286: }
287:
288: public String getCFBundleHelpBookName() {
289: return mCFHelpBookName;
290: }
291:
292: public void setMainClass(String s) {
293: mMainClass = s;
294: }
295:
296: public String getMainClass() {
297: return mMainClass;
298: }
299:
300: public void setJVMVersion(String s) {
301: mJVMVersion = s;
302: }
303:
304: public String getJVMVersion() {
305: return mJVMVersion;
306: }
307:
308: public void setVMOptions(String s) {
309: mVMOptions = s;
310: }
311:
312: public String getVMOptions() {
313: return mVMOptions;
314: }
315:
316: public void setWorkingDirectory(String s) {
317: mWorkingDirectory = s;
318: }
319:
320: public String getWorkingDirectory() {
321: return mWorkingDirectory;
322: }
323:
324: public void setArguments(String s) {
325: mArguments = s;
326: }
327:
328: public String getArguments() {
329: return mArguments;
330: }
331:
332: public List getClassPath() {
333: return mClassPath;
334: }
335:
336: }
|