Source Code Cross Referenced for IDETool.java in  » 6.0-JDK-Modules » j2me » makedep » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » makedep 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package makedep;
028:
029:        import java.io.*;
030:        import java.util.*;
031:        import config.Configurator;
032:
033:        /**
034:         * Base class for the creation of IDE projects files for building the VM.
035:         *
036:         * Currently only Win32/VC6 project files are supported. See Win32IDETool.java
037:         * for more details.
038:         */
039:        abstract public class IDETool {
040:            static File pwd = new File(System.getProperty("user.dir"));
041:
042:            /** command-line argument */
043:            String buildspace;
044:            /** command-line argument */
045:            String product;
046:            /** command-line argument */
047:            String platform;
048:            /** command-line argument */
049:            String database;
050:            /** command-line argument */
051:            String workspace;
052:
053:            /** User settings */
054:            Properties userSettings;
055:
056:            /** */
057:            Configurator configurator;
058:
059:            public String getBuildSpaceArg() {
060:                return buildspace;
061:            }
062:
063:            public String getProductArg() {
064:                return product;
065:            }
066:
067:            public String getPlatformArg() {
068:                return platform;
069:            }
070:
071:            public String getDatabaseArg() {
072:                return database;
073:            }
074:
075:            public String getWorkSpaceArg() {
076:                return workspace;
077:            }
078:
079:            private Vector apiSources;
080:            private Vector vmSources;
081:            private Vector jccSources;
082:
083:            public void parseArguments(String args[]) {
084:                for (int i = 0; i < args.length;) {
085:                    try {
086:                        int n = parseOneArgument(args, i);
087:                        if (n <= 0) {
088:                            fatal("unknown argument " + args[i]);
089:                        } else {
090:                            i += n;
091:                        }
092:                    } catch (ArrayIndexOutOfBoundsException e) {
093:                        fatal("parameter missing for argument " + args[i]);
094:                    }
095:                }
096:
097:                if (getWorkSpaceArg().indexOf(' ') >= 0) {
098:                    fatal("workspace name \"" + getWorkSpaceArg()
099:                            + "\" may not contain space character");
100:                }
101:                if (getBuildSpaceArg().indexOf(' ') >= 0) {
102:                    fatal("buildspace name \"" + getBuildSpaceArg()
103:                            + "\" may not contain space character");
104:                }
105:
106:            }
107:
108:            /**
109:             * Override this method in a subclass if you want to parse extra arguments.
110:             *
111:             * @throw ArrayIndexOutOfBoundsException if expected paramater is missing.
112:             */
113:            public int parseOneArgument(String args[], int i)
114:                    throws ArrayIndexOutOfBoundsException {
115:                int starting_i = i;
116:
117:                String arg = args[i++];
118:                if (arg.equals("-buildspace")) {
119:                    this .buildspace = args[i++];
120:                } else if (arg.equals("-product")) {
121:                    this .product = args[i++];
122:                } else if (arg.equals("-platform")) {
123:                    this .platform = args[i++];
124:                } else if (arg.equals("-database")) {
125:                    this .database = args[i++];
126:                } else if (arg.equals("-workspace")) {
127:                    this .workspace = args[i++];
128:                } else {
129:                    // unknown argument
130:                    return -1;
131:                }
132:
133:                return i - starting_i;
134:            }
135:
136:            void initConfigurator() throws Exception {
137:                configurator = new Configurator();
138:
139:                String workspace = getWorkSpaceArg();
140:                String input = workspace
141:                        + "/src/vm/share/utilities/BuildFlags.hpp";
142:
143:                configurator.readProductFile(product);
144:                configurator.readPlatformFile(platform);
145:                configurator.readInputFile(input);
146:            }
147:
148:            public static void fatal(String message) {
149:                System.out.println("Error: " + message);
150:                System.exit(1);
151:            }
152:
153:            String getOutputFileFullPath(String f) {
154:                // IMPL_NOTE: allow different name than "win32_i386_ide"
155:                return buildspace + File.separator + "win32_i386_ide"
156:                        + File.separator + f;
157:            }
158:
159:            void makeDirExist(String dirName) {
160:                dirName = getOutputFileFullPath(dirName);
161:                File dir = new File(dirName);
162:                if (dir.exists()) {
163:                    if (!dir.isDirectory()) {
164:                        fatal("not a directory: " + dir);
165:                    }
166:                } else {
167:                    if (!dir.mkdir()) {
168:                        fatal("failed to create directory: " + dir);
169:                    }
170:                }
171:            }
172:
173:            public PrintWriter openOutputFile(String fileName)
174:                    throws IOException {
175:                fileName = getOutputFileFullPath(fileName);
176:                File file = new File(fileName);
177:                File dir = file.getParentFile();
178:                if (!dir.exists()) {
179:                    dir.mkdir();
180:                }
181:                return new PrintWriter(new FileWriter(fileName));
182:            }
183:
184:            public abstract String getExecutablePath(String name);
185:
186:            public String getAbsolutePath(String path) {
187:                File file = new File(path);
188:                if (!file.isAbsolute()) {
189:                    path = pwd + File.separator + path;
190:                }
191:
192:                while (path.indexOf("..") >= 0) {
193:                    Vector v = splitPath(path);
194:                    removeOneDotDot(v);
195:                    path = joinPath(v);
196:                }
197:
198:                return path;
199:            }
200:
201:            static Vector splitPath(String path) {
202:                Vector v = new Vector();
203:
204:                StringTokenizer st = new StringTokenizer(path, File.separator);
205:                while (st.hasMoreTokens()) {
206:                    String f = st.nextToken();
207:                    v.addElement(f);
208:                }
209:                return v;
210:            }
211:
212:            static void removeOneDotDot(Vector v) {
213:                for (int i = 0; i < v.size() - 1; i++) {
214:                    if (v.elementAt(i + 1).equals("..")) {
215:                        v.removeElementAt(i);
216:                        v.removeElementAt(i);
217:                        return;
218:                    }
219:                }
220:            }
221:
222:            static String joinPath(Vector v) {
223:                String sep = "";
224:                StringBuffer sbuf = new StringBuffer();
225:                for (int i = 0; i < v.size(); i++) {
226:                    sbuf.append(sep);
227:                    sbuf.append(v.elementAt(i));
228:                    sep = File.separator;
229:                }
230:                return sbuf.toString();
231:            }
232:
233:            public Vector getAPISources() {
234:                if (apiSources == null) {
235:                    apiSources = findAPISources();
236:                }
237:                return apiSources;
238:            }
239:
240:            Vector findAPISources() {
241:                Vector v = new Vector();
242:                String s = File.separator;
243:                String cldc_ver;
244:                if (isOptionEnabled("ENABLE_REFLECTION")) {
245:                    cldc_ver = "cldc1.1plus";
246:                } else if (isOptionEnabled("ENABLE_CLDC_11")) {
247:                    cldc_ver = "cldc1.1";
248:                } else {
249:                    cldc_ver = "cldc1.0";
250:                }
251:
252:                findSources(v, workspace + s + "src" + s + "javaapi" + s
253:                        + cldc_ver, ".java");
254:                findSources(v, workspace + s + "src" + s + "javaapi" + s
255:                        + "share", ".java");
256:                return v;
257:            }
258:
259:            public boolean isDefaultBuildspace() {
260:                return workspace.equals("..\\..") && buildspace.equals("..");
261:            }
262:
263:            public Vector getJccSources() {
264:                if (jccSources == null) {
265:                    jccSources = findJccSources();
266:                }
267:                return jccSources;
268:            }
269:
270:            Vector findJccSources() {
271:                Vector v = new Vector();
272:                String s = File.separator;
273:                findSources(v, workspace + s + "src" + s + "tools" + s + "jcc",
274:                        ".java");
275:                return v;
276:            }
277:
278:            void findSources(Vector v, String path, String extension) {
279:                File dir = new File(path);
280:                if (dir.isDirectory()) {
281:                    if (path.endsWith("SCCS")) {
282:                        return;
283:                    }
284:                    if (path.endsWith("CVS")) {
285:                        return;
286:                    }
287:
288:                    String files[] = dir.list();
289:                    for (int i = 0; i < files.length; i++) {
290:                        findSources(v, path + File.separator + files[i],
291:                                extension);
292:                    }
293:                } else {
294:                    if (extension.equals(".java")) {
295:                        if (!isOptionEnabled("ENABLE_ISOLATES")
296:                                && (path.indexOf("isolate") != -1 || path
297:                                        .endsWith("Reflect.java"))) {
298:                            return;
299:                        }
300:                        if (!isOptionEnabled("ENABLE_DYNUPDATE")
301:                                && path.indexOf("dynupdate") != -1) {
302:                            return;
303:                        }
304:                        if (!isOptionEnabled("ENABLE_METHOD_TRAPS")
305:                                && path.endsWith("MethodTrap.java")) {
306:                            return;
307:                        }
308:                        if (!isOptionEnabled("ENABLE_JAVA_DEBUGGER")
309:                                && path.endsWith("DebuggerInvoke.java")) {
310:                            return;
311:                        }
312:                    }
313:                    if (path.endsWith(extension)) {
314:                        v.addElement(path);
315:                    }
316:                }
317:            }
318:
319:            /**
320:             * Sets this.userSettings, which contains the preferences of the user.
321:             * If the user does not specify a value for a certain build option,
322:             * a default value is taken. See Configurator.java for details.
323:             */
324:            public void setUserSettings(Properties s) {
325:                userSettings = s;
326:            }
327:
328:            public Properties getUserSettings() {
329:                return userSettings;
330:            }
331:
332:            public boolean isOptionEnabled(String name) {
333:                String value = (String) getUserSettings().get(name);
334:                if ("default".equals(value)) {
335:                    value = configurator.getDefaultValue(name);
336:                }
337:                return "true".equals(value);
338:            }
339:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.