Source Code Cross Referenced for ProcessFactory.java in  » Database-ORM » MMBase » org » mmbase » util » externalprocess » 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 » Database ORM » MMBase » org.mmbase.util.externalprocess 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:        This software is OSI Certified Open Source Software.
004:        OSI Certified is a certification mark of the Open Source Initiative.
005:
006:        The license (Mozilla version 1.0) can be read at the MMBase site.
007:        See http://www.MMBase.org/license
008:
009:         */
010:        package org.mmbase.util.externalprocess;
011:
012:        import java.io.File;
013:        import java.io.IOException;
014:
015:        /**
016:         * Process Factory creates a external process.
017:         * 
018:         * The factory could be used to create a process in another way than java.lang.
019:         * Runtime.exec();
020:         *
021:         * @author Nico Klasens (Finalist IT Group)
022:         * @version $Id: ProcessFactory.java,v 1.3 2003/05/12 13:10:47 kees Exp $
023:         * @since MMBase-1.6
024:         */
025:        public class ProcessFactory {
026:
027:            /**
028:             * instance of the Process Factory
029:             */
030:            static private ProcessFactory instance = new ProcessFactory();
031:
032:            /**
033:             * Runtime of the current java process
034:             */
035:            private Runtime runtime;
036:
037:            /**
038:             * get the Process Factory.instance
039:             * @return ProcessFactory
040:             */
041:            public static ProcessFactory getFactory() {
042:                return instance;
043:            }
044:
045:            /**
046:             * Create an new process factory.
047:             */
048:            private ProcessFactory() {
049:                runtime = Runtime.getRuntime();
050:            }
051:
052:            /**
053:             * Executes the specified command in a separate process.
054:             *
055:             * @param cmd the command to call
056:             * @return Process a Process object for managing the external process
057:             * @throws IOException if an I/O error occurs.
058:             */
059:            public Process exec(String cmd) throws IOException {
060:                return runtime.exec(cmd);
061:            }
062:
063:            /**
064:             * Executes the specified command and arguments in a separate process.
065:             *
066:             * @param cmdarray array containing the command to call and its arguments
067:             * @return Process a Process object for managing the external process
068:             * @throws IOException if an I/O error occurs.
069:             */
070:            public Process exec(String[] cmdarray) throws IOException {
071:                return runtime.exec(cmdarray);
072:            }
073:
074:            /**
075:             * Executes the specified command and arguments in a separate process with
076:             * the specified environment.
077:             *
078:             * @param cmdarray array containing the command to call and its arguments
079:             * @param envp array of strings, each element of which has environment
080:             *    variable  settings in format name=value.
081:             * @return Process a Process object for managing the external process
082:             * @throws IOException if an I/O error occurs.
083:             */
084:            public Process exec(String[] cmdarray, String[] envp)
085:                    throws IOException {
086:                return runtime.exec(cmdarray, envp);
087:            }
088:
089:            /**
090:             * Executes the specified command in a separate process with the specified
091:             * environment.
092:             *
093:             * @param cmd the command to call
094:             * @param envp array of strings, each element of which has environment
095:             *    variable  settings in format name=value.
096:             * @return Process a Process object for managing the external process
097:             * @throws IOException if an I/O error occurs.
098:             */
099:            public Process exec(String cmd, String[] envp) throws IOException {
100:                return runtime.exec(cmd, envp);
101:            }
102:
103:            /**
104:             * Executes the specified command in a separate process with the specified
105:             * environment and working directory.
106:             *
107:             * @param cmd the command to call
108:             * @param envp array of strings, each element of which has environment
109:             *    variable  settings in format name=value.
110:             * @param dir the working directory of the subprocess
111:             * @return Process a Process object for managing the external process
112:             * @throws IOException if an I/O error occurs.
113:             */
114:            public Process exec(String cmd, String[] envp, String dir)
115:                    throws IOException {
116:
117:                if (dir != null && !"".equals(dir.trim())) {
118:                    return runtime.exec(cmd, envp, new File(dir));
119:                } else {
120:                    return exec(cmd, envp);
121:                }
122:            }
123:
124:            /**
125:             * Executes the specified command and arguments in a separate process with
126:             * the specified environment and working directory.
127:             * 
128:             * @param cmdarray array containing the command to call and its arguments
129:             * @param envp array of strings, each element of which has environment
130:             *    variable  settings in format name=value.
131:             * @param dir the working directory of the subprocess
132:             * @return Process a Process object for managing the external process
133:             * @throws IOException if an I/O error occurs.
134:             */
135:            public Process exec(String cmdarray[], String[] envp, String dir)
136:                    throws IOException {
137:                if (dir != null && !"".equals(dir.trim())) {
138:                    return runtime.exec(cmdarray, envp, new File(dir));
139:                } else {
140:                    return exec(cmdarray, envp);
141:                }
142:            }
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.