001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.mobility.project;
043:
044: import java.lang.ref.Reference;
045: import java.lang.ref.WeakReference;
046: import java.nio.charset.Charset;
047: import java.util.HashSet;
048: import java.util.Set;
049: import org.netbeans.api.mobility.project.PropertyDescriptor;
050: import org.netbeans.spi.mobility.project.ProjectPropertiesDescriptor;
051: import org.netbeans.spi.mobility.project.support.DefaultPropertyParsers;
052:
053: /**
054: *
055: * @author Adam Sotona
056: */
057: public class DefaultPropertiesDescriptor implements
058: ProjectPropertiesDescriptor {
059:
060: public static final String CONFIG_ACTIVE = "config.active"; //NOI18N
061: public static final String USE_PREPROCESSOR = "use.preprocessor"; //NOI18N
062: public static final String ALL_CONFIGURATIONS = "all.configurations"; //NOI18N
063: public static final String SELECTED_CONFIGURATIONS = "selected.configurations"; //NOI18N
064: public static final String CONFIG_DISPLAY_NAME = "display.name"; //NOI18N
065: public static final String CONFIG_DISPLAY_COLOR = "display.color"; //NOI18N
066: public static final String ABILITIES = "abilities";//NOI18N
067: public static final String DEBUG_LEVEL = "debug.level"; //NOI18N
068:
069: public static final String LIBS_CLASSPATH = "libs.classpath"; //NOI18N
070: public static final String EXTRA_CLASSPATH = "extra.classpath"; //NOI18N
071: public static final String JAVAC_DEBUG = "javac.debug"; //NOI18N
072: public static final String JAVAC_DEPRECATION = "javac.deprecation"; //NOI18N
073: public static final String JAVAC_OPTIMIZATION = "javac.optimize"; //NOI18N
074: public static final String JAVAC_SOURCE = "javac.source"; //NOI18N
075: public static final String JAVAC_TARGET = "javac.target"; //NOI18N
076: public static final String JAVAC_ENCODING = "javac.encoding"; //NOI18N
077: public static final String OBFUSCATION_LEVEL = "obfuscation.level"; //NOI18N
078: public static final String OBFUSCATION_CUSTOM = "obfuscation.custom"; //NOI18N
079: public static final String USE_EMPTYAPIS = "use.emptyapis"; //NOI18N
080: public static final String SRC_DIR = "src.dir"; //NOI18N
081: public static final String BUILD_DIR = "build.dir"; //NOI18N
082: public static final String DIST_DIR = "dist.dir"; //NOI18N
083: public static final String DIST_JAR = "dist.jar"; //NOI18N
084: public static final String DIST_JAD = "dist.jad"; //NOI18N
085: public static final String JAR_COMPRESS = "jar.compress"; //NOI18N
086: public static final String BUILD_ROOT_DIR = "build.root.dir"; //NOI18N
087: public static final String DIST_ROOT_DIR = "dist.root.dir"; //NOI18N
088: public static final String BUILD_CLASSES_EXCLUDES = "build.classes.excludes"; //NOI18N
089: public static final String NO_DEPENDENCIES = "no.dependencies"; //NOI18N
090: public static final String PLATFORM_TRIGGER = "platform.trigger"; //NOI18N
091: public static final String PLATFORM_ACTIVE = "platform.active"; //NOI18N
092: public static final String PLATFORM_ACTIVE_DESCRIPTION = "platform.active.description";
093: public static final String PLATFORM_DEVICE = "platform.device"; //NOI18N
094: public static final String PLATFORM_CONFIGURATION = "platform.configuration"; //NOI18N
095: public static final String PLATFORM_PROFILE = "platform.profile"; //NOI18N
096: public static final String PLATFORM_APIS = "platform.apis"; //NOI18N
097: public static final String PLATFORM_BOOTCLASSPATH = "platform.bootclasspath"; //NOI18N
098: public static final String PLATFORM_TYPE = "platform.type"; //NOI18N
099: public static final String RUN_METHOD = "run.method"; //NOI18N
100: public static final String RUN_USE_SECURITY_DOMAIN = "run.use.security.domain"; //NOI18N
101: public static final String RUN_SECURITY_DOMAIN = "run.security.domain"; //NOI18N
102: public static final String MANIFEST_MIDLETS = "manifest.midlets"; //NOI18N
103: public static final String MANIFEST_APIPERMISSIONS = "manifest.apipermissions"; //NOI18N
104: public static final String MANIFEST_PUSHREGISTRY = "manifest.pushregistry"; //NOI18N
105: public static final String MANIFEST_OTHERS = "manifest.others"; //NOI18N
106: public static final String MANIFEST_MANIFEST = "manifest.manifest"; //NOI18N
107: public static final String MANIFEST_JAD = "manifest.jad"; //NOI18N
108: public static final String FILTER_USE_STANDARD = "filter.use.standard"; //NOI18N
109: public static final String FILTER_EXCLUDE_TESTS = "filter.exclude.tests"; //NOI18N
110: public static final String FILTER_EXCLUDES = "filter.excludes"; //NOI18N
111: public static final String FILTER_MORE_EXCLUDES = "filter.more.excludes"; //NOI18N
112: public static final String RUN_CMD_OPTIONS = "run.cmd.options"; //NOI18N
113: public static final String APP_VERSION_AUTOINCREMENT = "app-version.autoincrement"; //NOI18N
114: public static final String APP_VERSION_COUNTER = "deployment.counter"; //NOI18N
115: public static final String APP_VERSION_NUMBER = "deployment.number"; //NOI18N
116:
117: public static final String JAVADOC_PRIVATE = "javadoc.private"; //NOI18N
118: public static final String JAVADOC_NO_TREE = "javadoc.notree"; //NOI18N
119: public static final String JAVADOC_USE = "javadoc.use"; //NOI18N
120: public static final String JAVADOC_NO_NAVBAR = "javadoc.nonavbar"; //NOI18N
121: public static final String JAVADOC_NO_INDEX = "javadoc.noindex"; //NOI18N
122: public static final String JAVADOC_SPLIT_INDEX = "javadoc.splitindex"; //NOI18N
123: public static final String JAVADOC_AUTHOR = "javadoc.author"; //NOI18N
124: public static final String JAVADOC_VERSION = "javadoc.version"; //NOI18N
125: public static final String JAVADOC_WINDOW_TITLE = "javadoc.windowtitle"; //NOI18N
126: public static final String JAVADOC_ENCODING = "javadoc.encoding"; //NOI18N
127:
128: public static final String SIGN_ENABLED = "sign.enabled"; //NOI18N
129: public static final String SIGN_KEYSTORE = "sign.keystore"; //NOI18N
130: public static final String SIGN_KEYSTORE_PASSWORD = "sign.keystore.password"; //NOI18N
131: public static final String SIGN_ALIAS = "sign.alias"; //NOI18N
132: public static final String SIGN_ALIAS_PASSWORD = "sign.alias.password"; //NOI18N
133:
134: public static final String DEPLOYMENT_METHOD = "deployment.method"; //MOI18N
135: public static final String DEPLOYMENT_INSTANCE = "deployment.instance"; //MOI18N
136: public static final String DEPLOYMENT_OVERRIDE_JARURL = "deployment.override.jarurl"; //MOI18N
137: public static final String DEPLOYMENT_JARURL = "deployment.jarurl"; //MOI18N
138:
139: // Properties stored in the PRIVATE.PROPERTIES
140: public static final String JAVADOC_PREVIEW = "javadoc.preview"; //NOI18N
141:
142: private Reference<Set<PropertyDescriptor>> ref = new WeakReference(
143: null);
144:
145: /**
146: * Creates a new instance of DefaultPropertiesDescriptor
147: */
148: public DefaultPropertiesDescriptor() {
149: }
150:
151: public Set<PropertyDescriptor> getPropertyDescriptors() {
152: String FALSE = "false"; //NOI18N
153: String TRUE = "true"; //NOI18N
154: String EMPTY = ""; //NOI18N
155: Set<PropertyDescriptor> set = ref.get();
156: if (set == null) {
157: set = new HashSet();
158: set.add(new PropertyDescriptor(CONFIG_ACTIVE, false,
159: DefaultPropertyParsers.STRING_PARSER, EMPTY));
160: set.add(new PropertyDescriptor(USE_PREPROCESSOR, true,
161: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
162: set.add(new PropertyDescriptor(ALL_CONFIGURATIONS, true,
163: DefaultPropertyParsers.STRING_PARSER, " "));//NOI18N
164: set.add(new PropertyDescriptor(SELECTED_CONFIGURATIONS,
165: false, DefaultPropertyParsers.STRING_PARSER));
166: set.add(new PropertyDescriptor(CONFIG_DISPLAY_NAME, true,
167: DefaultPropertyParsers.STRING_PARSER));
168: set.add(new PropertyDescriptor(CONFIG_DISPLAY_COLOR, true,
169: DefaultPropertyParsers.STRING_PARSER));
170: set.add(new PropertyDescriptor(ABILITIES, true,
171: DefaultPropertyParsers.ABILITIES_PARSER));
172: set
173: .add(new PropertyDescriptor(DEBUG_LEVEL, true,
174: DefaultPropertyParsers.DEBUG_LEVEL_PARSER,
175: "debug")); //NOI18N
176: set.add(new PropertyDescriptor(DIST_DIR, true,
177: DefaultPropertyParsers.STRING_PARSER,
178: "dist/${config.active}")); //NOI18N
179: set.add(new PropertyDescriptor(DIST_JAR, true,
180: DefaultPropertyParsers.STRING_PARSER));
181: set.add(new PropertyDescriptor(DIST_JAD, true,
182: DefaultPropertyParsers.STRING_PARSER));
183: set.add(new PropertyDescriptor(LIBS_CLASSPATH, true,
184: DefaultPropertyParsers.PATH_PARSER, EMPTY));
185: set.add(new PropertyDescriptor(EXTRA_CLASSPATH, true,
186: DefaultPropertyParsers.PATH_PARSER, EMPTY));
187: set.add(new PropertyDescriptor(JAR_COMPRESS, true,
188: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
189: set.add(new PropertyDescriptor(JAVAC_DEBUG, true,
190: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
191: set.add(new PropertyDescriptor(JAVAC_OPTIMIZATION, true,
192: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
193: set.add(new PropertyDescriptor(JAVAC_DEPRECATION, true,
194: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
195: set.add(new PropertyDescriptor(JAVAC_SOURCE, true,
196: DefaultPropertyParsers.STRING_PARSER, "1.3")); //NOI18N
197: set.add(new PropertyDescriptor(JAVAC_TARGET, true,
198: DefaultPropertyParsers.STRING_PARSER, "1.1")); //NOI18N
199: set.add(new PropertyDescriptor(JAVAC_ENCODING, true,
200: DefaultPropertyParsers.STRING_PARSER, Charset
201: .defaultCharset().name()));
202: set.add(new PropertyDescriptor(OBFUSCATION_LEVEL, true,
203: DefaultPropertyParsers.INTEGER_PARSER, "0")); //NOI18N
204: set.add(new PropertyDescriptor(OBFUSCATION_CUSTOM, true,
205: DefaultPropertyParsers.STRING_PARSER, EMPTY));
206: set.add(new PropertyDescriptor(USE_EMPTYAPIS, true,
207: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
208: set
209: .add(new PropertyDescriptor(
210: SRC_DIR,
211: true,
212: DefaultPropertyParsers.FILE_REFERENCE_PARSER,
213: "src")); //NOI18N
214: set.add(new PropertyDescriptor(BUILD_DIR, true,
215: DefaultPropertyParsers.STRING_PARSER,
216: "build/${config.active}")); //NOI18N
217: set
218: .add(new PropertyDescriptor(BUILD_CLASSES_EXCLUDES,
219: true, DefaultPropertyParsers.STRING_PARSER,
220: "**/*.java,**/*.form,**/*.class,**/.nbintdb,**/*.mvd,**/*.wsclient,**/*.vmd")); //NOI18N
221: set.add(new PropertyDescriptor(NO_DEPENDENCIES, true,
222: DefaultPropertyParsers.INVERSE_BOOLEAN_PARSER,
223: FALSE));
224: set.add(new PropertyDescriptor(PLATFORM_TRIGGER, true,
225: DefaultPropertyParsers.STRING_PARSER, "CLDC")); //NOI18N
226: set.add(new PropertyDescriptor(PLATFORM_ACTIVE, true,
227: DefaultPropertyParsers.PLATFORM_PARSER));
228: set.add(new PropertyDescriptor(PLATFORM_ACTIVE_DESCRIPTION,
229: true, DefaultPropertyParsers.STRING_PARSER));
230: set.add(new PropertyDescriptor(PLATFORM_DEVICE, true,
231: DefaultPropertyParsers.STRING_PARSER));
232: set.add(new PropertyDescriptor(PLATFORM_CONFIGURATION,
233: true, DefaultPropertyParsers.STRING_PARSER));
234: set.add(new PropertyDescriptor(PLATFORM_PROFILE, true,
235: DefaultPropertyParsers.STRING_PARSER));
236: set.add(new PropertyDescriptor(PLATFORM_APIS, true,
237: DefaultPropertyParsers.STRING_PARSER));
238: set.add(new PropertyDescriptor(PLATFORM_BOOTCLASSPATH,
239: true, DefaultPropertyParsers.STRING_PARSER));
240: set.add(new PropertyDescriptor(PLATFORM_TYPE, true,
241: DefaultPropertyParsers.STRING_PARSER));
242: set.add(new PropertyDescriptor(RUN_METHOD, true,
243: DefaultPropertyParsers.STRING_PARSER, "STANDARD")); //NOI18N
244: set
245: .add(new PropertyDescriptor(
246: RUN_USE_SECURITY_DOMAIN, true,
247: DefaultPropertyParsers.BOOLEAN_PARSER,
248: FALSE));
249: set.add(new PropertyDescriptor(RUN_SECURITY_DOMAIN, true,
250: DefaultPropertyParsers.STRING_PARSER, "trusted")); //NOI18N
251: set.add(new PropertyDescriptor(RUN_CMD_OPTIONS, true,
252: DefaultPropertyParsers.STRING_PARSER, EMPTY));
253: set
254: .add(new PropertyDescriptor(
255: APP_VERSION_AUTOINCREMENT, false,
256: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
257: set.add(new PropertyDescriptor(APP_VERSION_NUMBER, false,
258: DefaultPropertyParsers.STRING_PARSER, "0.0.1")); //NOI18N
259: set.add(new PropertyDescriptor(APP_VERSION_COUNTER, false,
260: DefaultPropertyParsers.INTEGER_PARSER, "2")); //NOI18N
261: set.add(new PropertyDescriptor(MANIFEST_MIDLETS, true,
262: DefaultPropertyParsers.MANIFEST_PROPERTY_PARSER,
263: EMPTY));
264: set.add(new PropertyDescriptor(MANIFEST_APIPERMISSIONS,
265: true,
266: DefaultPropertyParsers.MANIFEST_PROPERTY_PARSER,
267: EMPTY));
268: set.add(new PropertyDescriptor(MANIFEST_PUSHREGISTRY, true,
269: DefaultPropertyParsers.MANIFEST_PROPERTY_PARSER,
270: EMPTY));
271: set.add(new PropertyDescriptor(MANIFEST_OTHERS, true,
272: DefaultPropertyParsers.MANIFEST_PROPERTY_PARSER));
273: set.add(new PropertyDescriptor(MANIFEST_JAD, true,
274: DefaultPropertyParsers.MANIFEST_PROPERTY_PARSER,
275: EMPTY));
276: set.add(new PropertyDescriptor(MANIFEST_MANIFEST, true,
277: DefaultPropertyParsers.MANIFEST_PROPERTY_PARSER,
278: EMPTY));
279: set.add(new PropertyDescriptor(FILTER_USE_STANDARD, true,
280: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
281: set.add(new PropertyDescriptor(FILTER_EXCLUDE_TESTS, true,
282: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
283: set.add(new PropertyDescriptor(FILTER_EXCLUDES, true,
284: DefaultPropertyParsers.STRING_PARSER, EMPTY));
285: set.add(new PropertyDescriptor(FILTER_MORE_EXCLUDES, true,
286: DefaultPropertyParsers.STRING_PARSER, EMPTY));
287:
288: set.add(new PropertyDescriptor(JAVADOC_PRIVATE, true,
289: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
290: set.add(new PropertyDescriptor(JAVADOC_NO_TREE, true,
291: DefaultPropertyParsers.INVERSE_BOOLEAN_PARSER,
292: FALSE));
293: set.add(new PropertyDescriptor(JAVADOC_USE, true,
294: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
295: set.add(new PropertyDescriptor(JAVADOC_NO_NAVBAR, true,
296: DefaultPropertyParsers.INVERSE_BOOLEAN_PARSER,
297: FALSE));
298: set.add(new PropertyDescriptor(JAVADOC_NO_INDEX, true,
299: DefaultPropertyParsers.INVERSE_BOOLEAN_PARSER,
300: FALSE));
301: set.add(new PropertyDescriptor(JAVADOC_SPLIT_INDEX, true,
302: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
303: set.add(new PropertyDescriptor(JAVADOC_AUTHOR, true,
304: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
305: set.add(new PropertyDescriptor(JAVADOC_VERSION, true,
306: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
307: set.add(new PropertyDescriptor(JAVADOC_WINDOW_TITLE, true,
308: DefaultPropertyParsers.STRING_PARSER, EMPTY));
309: set.add(new PropertyDescriptor(JAVADOC_ENCODING, true,
310: DefaultPropertyParsers.STRING_PARSER, EMPTY));
311:
312: set.add(new PropertyDescriptor(SIGN_ENABLED, true,
313: DefaultPropertyParsers.BOOLEAN_PARSER, FALSE));
314: set
315: .add(new PropertyDescriptor(
316: SIGN_KEYSTORE,
317: true,
318: DefaultPropertyParsers.FILE_REFERENCE_PARSER,
319: EMPTY));
320: set.add(new PropertyDescriptor(SIGN_KEYSTORE_PASSWORD,
321: true, DefaultPropertyParsers.STRING_PARSER));
322: set.add(new PropertyDescriptor(SIGN_ALIAS, true,
323: DefaultPropertyParsers.STRING_PARSER, EMPTY));
324: set.add(new PropertyDescriptor(SIGN_ALIAS_PASSWORD, true,
325: DefaultPropertyParsers.STRING_PARSER));
326:
327: set.add(new PropertyDescriptor(JAVADOC_PREVIEW, false,
328: DefaultPropertyParsers.BOOLEAN_PARSER, TRUE));
329:
330: set.add(new PropertyDescriptor(DEPLOYMENT_METHOD, true,
331: DefaultPropertyParsers.DEPLOYMENT_TYPE_PARSER,
332: "NONE")); //NOI18N
333: set.add(new PropertyDescriptor(DEPLOYMENT_INSTANCE, true,
334: DefaultPropertyParsers.STRING_PARSER, "default")); //NOI18N
335: set
336: .add(new PropertyDescriptor(
337: DEPLOYMENT_OVERRIDE_JARURL, true,
338: DefaultPropertyParsers.BOOLEAN_PARSER,
339: FALSE));
340: set
341: .add(new PropertyDescriptor(DEPLOYMENT_JARURL,
342: true, DefaultPropertyParsers.STRING_PARSER,
343: "${dist.jar}")); //NOI18N
344: ref = new WeakReference(set);
345: }
346: return set;
347: }
348:
349: }
|