Source Code Cross Referenced for AbstractVMRunner.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » launching » 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 » IDE Eclipse » jdt » org.eclipse.jdt.launching 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.launching;
011:
012:        import java.io.File;
013:        import java.util.HashMap;
014:        import java.util.Map;
015:
016:        import org.eclipse.core.runtime.CoreException;
017:        import org.eclipse.core.runtime.IStatus;
018:        import org.eclipse.core.runtime.Status;
019:        import org.eclipse.debug.core.DebugPlugin;
020:        import org.eclipse.debug.core.ILaunch;
021:        import org.eclipse.debug.core.model.IProcess;
022:        import org.eclipse.jdt.internal.launching.LaunchingMessages;
023:
024:        /**
025:         * Abstract implementation of a VM runner.
026:         * <p>
027:         * Clients implementing VM runners should subclass this class.
028:         * </p>
029:         * @see IVMRunner
030:         * @since 2.0
031:         */
032:        public abstract class AbstractVMRunner implements  IVMRunner {
033:
034:            /**
035:             * Throws a core exception with an error status object built from
036:             * the given message, lower level exception, and error code.
037:             * 
038:             * @param message the status message
039:             * @param exception lower level exception associated with the
040:             *  error, or <code>null</code> if none
041:             * @param code error code
042:             * @throws CoreException The exception encapsulating the reason for the abort
043:             */
044:            protected void abort(String message, Throwable exception, int code)
045:                    throws CoreException {
046:                throw new CoreException(new Status(IStatus.ERROR,
047:                        getPluginIdentifier(), code, message, exception));
048:            }
049:
050:            /**
051:             * Returns the identifier of the plug-in this VM runner 
052:             * originated from.
053:             * 
054:             * @return plug-in identifier
055:             */
056:            protected abstract String getPluginIdentifier();
057:
058:            /**
059:             * @see DebugPlugin#exec(String[], File)
060:             */
061:            protected Process exec(String[] cmdLine, File workingDirectory)
062:                    throws CoreException {
063:                return DebugPlugin.exec(cmdLine, workingDirectory);
064:            }
065:
066:            /**
067:             * @since 3.0
068:             * @see DebugPlugin#exec(String[], File, String[])
069:             */
070:            protected Process exec(String[] cmdLine, File workingDirectory,
071:                    String[] envp) throws CoreException {
072:                return DebugPlugin.exec(cmdLine, workingDirectory, envp);
073:            }
074:
075:            /**
076:             * Returns the given array of strings as a single space-delimited string.
077:             * 
078:             * @param cmdLine array of strings
079:             * @return a single space-delimited string
080:             */
081:            protected String getCmdLineAsString(String[] cmdLine) {
082:                StringBuffer buff = new StringBuffer();
083:                for (int i = 0, numStrings = cmdLine.length; i < numStrings; i++) {
084:                    buff.append(cmdLine[i]);
085:                    buff.append(' ');
086:                }
087:                return buff.toString().trim();
088:            }
089:
090:            /**
091:             * Returns the default process attribute map for Java processes.
092:             * 
093:             * @return default process attribute map for Java processes
094:             */
095:            protected Map getDefaultProcessMap() {
096:                Map map = new HashMap();
097:                map.put(IProcess.ATTR_PROCESS_TYPE,
098:                        IJavaLaunchConfigurationConstants.ID_JAVA_PROCESS_TYPE);
099:                return map;
100:            }
101:
102:            /**
103:             * Returns a new process aborting if the process could not be created.
104:             * @param launch the launch the process is contained in
105:             * @param p the system process to wrap
106:             * @param label the label assigned to the process
107:             * @param attributes values for the attribute map
108:             * @return the new process
109:             * @throws CoreException problems occurred creating the process
110:             * @since 3.0
111:             */
112:            protected IProcess newProcess(ILaunch launch, Process p,
113:                    String label, Map attributes) throws CoreException {
114:                IProcess process = DebugPlugin.newProcess(launch, p, label,
115:                        attributes);
116:                if (process == null) {
117:                    p.destroy();
118:                    abort(
119:                            LaunchingMessages.AbstractVMRunner_0,
120:                            null,
121:                            IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
122:                }
123:                return process;
124:            }
125:
126:            /**
127:             * Combines and returns VM arguments specified by the runner configuration,
128:             * with those specified by the VM install, if any.
129:             * 
130:             * @param configuration runner configuration
131:             * @param vmInstall vm install
132:             * @return combined VM arguments specified by the runner configuration
133:             *  and VM install
134:             * @since 3.0
135:             */
136:            protected String[] combineVmArgs(
137:                    VMRunnerConfiguration configuration, IVMInstall vmInstall) {
138:                String[] launchVMArgs = configuration.getVMArguments();
139:                String[] vmVMArgs = vmInstall.getVMArguments();
140:                if (vmVMArgs == null || vmVMArgs.length == 0) {
141:                    return launchVMArgs;
142:                }
143:                String[] allVMArgs = new String[launchVMArgs.length
144:                        + vmVMArgs.length];
145:                System.arraycopy(launchVMArgs, 0, allVMArgs, 0,
146:                        launchVMArgs.length);
147:                System.arraycopy(vmVMArgs, 0, allVMArgs, launchVMArgs.length,
148:                        vmVMArgs.length);
149:                return allVMArgs;
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.