KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > jarbundler > AppBundleProperties


1 /*
2  * A Mac OS X Jar Bundler Ant Task.
3  *
4  * Copyright (c) 2003, Seth J. Morabito <sethm@loomcom.com> All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; either version 2 of the License, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18  * Place - Suite 330, Boston, MA 02111-1307, USA.
19  */

20
21
22 package net.sourceforge.jarbundler;
23
24 // Java Utility
25
import java.util.ArrayList JavaDoc;
26 import java.util.Hashtable JavaDoc;
27 import java.util.List JavaDoc;
28 import java.util.LinkedList JavaDoc;
29
30 // Java language imports
31
import java.lang.String JavaDoc;
32
33 public class AppBundleProperties {
34
35     // Required
36
private String JavaDoc mApplicationName;
37     private String JavaDoc mMainClass;
38
39     // Application short name
40
private String JavaDoc mCFBundleName = null;
41
42     // Finder version, with default
43
private String JavaDoc mCFBundleShortVersionString = "1.0";
44
45     // Get Info string, optional
46
private String JavaDoc mCFBundleGetInfoString = null;
47
48     // Build number, optional
49
private String JavaDoc mCFBundleVersion = null;
50
51     // Help Book folder, optional
52
private String JavaDoc mCFHelpBookFolder = null;
53
54     // Help Book name, optional
55
private String JavaDoc mCFHelpBookName = null;
56
57     // Explicit default: false
58
private boolean mCFBundleAllowMixedLocalizations = false;
59
60     // Explicit default: JavaApplicationStub
61
private String JavaDoc mCFBundleExecutable = "JavaApplicationStub";
62
63     // Explicit default: English
64
private String JavaDoc mCFBundleDevelopmentRegion = "English";
65
66     // Explicit default: APPL
67
private final String JavaDoc mCFBundlePackageType = "APPL";
68
69     // Explicit default: ????
70
private String JavaDoc mCFBundleSignature = "????";
71
72     // Explicit default: 1.3+
73
private String JavaDoc mJVMVersion = "1.3+";
74
75     // Explicit default: 6.0
76
private final String JavaDoc mCFBundleInfoDictionaryVersion = "6.0";
77
78     // Optional keys, with no defaults.
79

80     private String JavaDoc mCFBundleIconFile = null;
81     private String JavaDoc mCFBundleIdentifier = null;
82     private String JavaDoc mVMOptions = null; // Java VM options
83
private String JavaDoc mWorkingDirectory = null; // Java Working Dir
84
private String JavaDoc mArguments = null; // Java command line arguments
85

86     // Class path and extra class path elements
87
private List JavaDoc mClassPath = new ArrayList JavaDoc();
88     private List JavaDoc mExtraClassPath = new ArrayList JavaDoc();
89
90     // Java properties
91
private Hashtable JavaDoc mJavaProperties = new Hashtable JavaDoc();
92
93     // Document types
94
private List JavaDoc mDocumentTypes = new LinkedList JavaDoc();
95
96     // Services
97
private List JavaDoc mServices = new LinkedList JavaDoc();
98     
99     // ================================================================================
100

101     /**
102      * Add a Java runtime property to the properties hashtable.
103      */

104
105     public void addJavaProperty(String JavaDoc prop, String JavaDoc val) {
106         mJavaProperties.put(prop, val);
107     }
108
109     public Hashtable JavaDoc getJavaProperties() {
110         return mJavaProperties;
111     }
112
113     public void addToClassPath(String JavaDoc s) {
114         mClassPath.add("$JAVAROOT/" + s);
115     }
116
117     public void addToExtraClassPath(String JavaDoc s) {
118         mExtraClassPath.add(s);
119     }
120
121     public List JavaDoc getExtraClassPath() {
122         return mExtraClassPath;
123     }
124
125     public DocumentType createDocumentType() {
126         return new DocumentType();
127     }
128
129     public List JavaDoc getDocumentTypes() {
130         return mDocumentTypes;
131     }
132
133     /**
134      * Add a document type to the document type list.
135      */

136     public void addDocumentType(DocumentType documentType) {
137         mDocumentTypes.add(documentType);
138     }
139
140     public Service createService() {
141         return new Service();
142     }
143     
144     public List JavaDoc getServices() {
145         return mServices;
146     }
147     
148     /**
149      * Add a service to the services list.
150      */

151     public void addService(Service service) {
152         mServices.add(service);
153     }
154     
155     // ================================================================================
156

157     public void setApplicationName(String JavaDoc s) {
158         mApplicationName = s;
159     }
160
161     public String JavaDoc getApplicationName() {
162         return mApplicationName;
163     }
164
165     // ================================================================================
166
//
167
// Bundle setters and getters
168
//
169

170     public void setCFBundleName(String JavaDoc s) {
171
172         if (s.length() > 16)
173             System.err
174                     .println("WARNING: 'shortname' is recommeded to be no more than 16 "
175                             + "charaters long. See usage notes.");
176         mCFBundleName = s;
177     }
178
179     public String JavaDoc getCFBundleName() {
180         if (mCFBundleName == null)
181             return getApplicationName();
182
183         return mCFBundleName;
184     }
185
186     public void setCFBundleVersion(String JavaDoc s) {
187         mCFBundleVersion = s;
188     }
189
190     public String JavaDoc getCFBundleVersion() {
191         return mCFBundleVersion;
192     }
193
194     public void setCFBundleInfoDictionaryVersion(String JavaDoc s) {
195         // mCFBundleInfoDictionaryVersion = s;
196
}
197
198     public String JavaDoc getCFBundleInfoDictionaryVersion() {
199         return mCFBundleInfoDictionaryVersion;
200     }
201
202     public void setCFBundleIdentifier(String JavaDoc s) {
203         mCFBundleIdentifier = s;
204     }
205
206     public String JavaDoc getCFBundleIdentifier() {
207         return mCFBundleIdentifier;
208     }
209
210     public void setCFBundleGetInfoString(String JavaDoc s) {
211         mCFBundleGetInfoString = s;
212     }
213
214     public String JavaDoc getCFBundleGetInfoString() {
215         if (mCFBundleGetInfoString == null)
216             return getCFBundleShortVersionString();
217
218         return mCFBundleGetInfoString;
219     }
220
221     public void setCFBundleShortVersionString(String JavaDoc s) {
222         mCFBundleShortVersionString = s;
223     }
224
225     public String JavaDoc getCFBundleShortVersionString() {
226         return mCFBundleShortVersionString;
227     }
228
229     public void setCFBundleIconFile(String JavaDoc s) {
230         mCFBundleIconFile = s;
231     }
232
233     public String JavaDoc getCFBundleIconFile() {
234         return mCFBundleIconFile;
235     }
236
237     public void setCFBundleAllowMixedLocalizations(boolean b) {
238         mCFBundleAllowMixedLocalizations = b;
239     }
240
241     public boolean getCFBundleAllowMixedLocalizations() {
242         return mCFBundleAllowMixedLocalizations;
243     }
244
245     public void setCFBundleExecutable(String JavaDoc s) {
246         mCFBundleExecutable = s;
247     }
248
249     public String JavaDoc getCFBundleExecutable() {
250         return mCFBundleExecutable;
251     }
252
253     public void setCFBundleDevelopmentRegion(String JavaDoc s) {
254         mCFBundleDevelopmentRegion = s;
255     }
256
257     public String JavaDoc getCFBundleDevelopmentRegion() {
258         return mCFBundleDevelopmentRegion;
259     }
260
261     public void setCFBundlePackageType(String JavaDoc s) {
262         // mCFBundlePackageType = s;
263
}
264
265     public String JavaDoc getCFBundlePackageType() {
266         return mCFBundlePackageType;
267     }
268
269     public void setCFBundleSignature(String JavaDoc s) {
270         mCFBundleSignature = s;
271     }
272
273     public String JavaDoc getCFBundleSignature() {
274         return mCFBundleSignature;
275     }
276
277     public void setCFBundleHelpBookFolder(String JavaDoc s) {
278         mCFHelpBookFolder = s;
279     }
280
281     public String JavaDoc getCFBundleHelpBookFolder() {
282         return mCFHelpBookFolder;
283     }
284
285     public void setCFBundleHelpBookName(String JavaDoc s) {
286         mCFHelpBookName = s;
287     }
288
289     public String JavaDoc getCFBundleHelpBookName() {
290         return mCFHelpBookName;
291     }
292
293     public void setMainClass(String JavaDoc s) {
294         mMainClass = s;
295     }
296
297     public String JavaDoc getMainClass() {
298         return mMainClass;
299     }
300
301     public void setJVMVersion(String JavaDoc s) {
302         mJVMVersion = s;
303     }
304
305     public String JavaDoc getJVMVersion() {
306         return mJVMVersion;
307     }
308
309     public void setVMOptions(String JavaDoc s) {
310         mVMOptions = s;
311     }
312
313     public String JavaDoc getVMOptions() {
314         return mVMOptions;
315     }
316
317     public void setWorkingDirectory(String JavaDoc s) {
318         mWorkingDirectory = s;
319     }
320
321     public String JavaDoc getWorkingDirectory() {
322         return mWorkingDirectory;
323     }
324
325     public void setArguments(String JavaDoc s) {
326         mArguments = s;
327     }
328
329     public String JavaDoc getArguments() {
330         return mArguments;
331     }
332
333     public List JavaDoc getClassPath() {
334         return mClassPath;
335     }
336
337 }
338
Popular Tags