Source Code Cross Referenced for SystemCommandInvocationDefinition.java in  » UML » MetaBoss » com » metaboss » sdlctools » applications » anttasks » builder » tools » 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 » UML » MetaBoss » com.metaboss.sdlctools.applications.anttasks.builder.tools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.sdlctools.applications.anttasks.builder.tools;
016:
017:        import java.io.File;
018:        import java.util.ArrayList;
019:        import java.util.Arrays;
020:        import java.util.Iterator;
021:        import java.util.List;
022:
023:        import org.apache.tools.ant.BuildException;
024:        import org.apache.tools.ant.Project;
025:        import org.apache.tools.ant.taskdefs.ExecTask;
026:        import org.apache.tools.ant.types.Commandline;
027:
028:        import com.metaboss.sdlctools.applications.anttasks.builder.MetaBossBuilderTask;
029:        import com.metaboss.sdlctools.applications.anttasks.builder.ToolInvocationDefinition;
030:        import com.metaboss.util.ObjectUtils;
031:
032:        /** This definition is responsible for invocation of the 'exec' ant task */
033:        public class SystemCommandInvocationDefinition extends
034:                ToolInvocationDefinition {
035:            //	The command to execute
036:            private String mExecutable = null;
037:            //	Directory from where to run the executable
038:            private String mDirectory = null;
039:            //	Fail or Not
040:            private boolean mFailOnError = true;
041:
042:            //	Array of command line arguments
043:            private List mArguments = new ArrayList();
044:
045:            /** Public constructor for the invocation */
046:            public SystemCommandInvocationDefinition(
047:                    MetaBossBuilderTask pOwnerTask, String pToolInvocationName) {
048:                super (pOwnerTask, pToolInvocationName);
049:            }
050:
051:            /** Sets the executable to run */
052:            public void setExecutable(String pExecutable) {
053:                mExecutable = pExecutable;
054:            }
055:
056:            /** Set whether to propagate existing environment variables to the new process */
057:            public void setDir(String pDirectory) {
058:                mDirectory = pDirectory;
059:            }
060:
061:            /** Set fail on error attribute */
062:            public void setFailOnError(boolean pFailOnError) {
063:                mFailOnError = pFailOnError;
064:            }
065:
066:            /* ** Sets the Java class path */
067:            public void addArgument(String pArgument) {
068:                mArguments.add(pArgument);
069:            }
070:
071:            /** Overridden to compare details of the invocation */
072:            public boolean equals(Object pOther) {
073:                if (this  == pOther)
074:                    return true;
075:
076:                if (pOther == null)
077:                    return false;
078:
079:                if ((pOther instanceof  SystemCommandInvocationDefinition) == false)
080:                    return false;
081:
082:                SystemCommandInvocationDefinition lOther = (SystemCommandInvocationDefinition) pOther;
083:
084:                if (!ObjectUtils.equals(mExecutable, lOther.mExecutable))
085:                    return false;
086:                if (!ObjectUtils.equals(mDirectory, lOther.mDirectory))
087:                    return false;
088:                if (mFailOnError != lOther.mFailOnError)
089:                    return false;
090:                if (!Arrays.equals(mArguments.toArray(), lOther.mArguments
091:                        .toArray()))
092:                    return false;
093:
094:                return true; // Everything appears to be in order
095:            }
096:
097:            /** This method will have to invoke the generator */
098:            public void invoke() throws BuildException {
099:                MetaBossBuilderTask lOwnerTask = getOwnerTask();
100:                Project lThisProject = lOwnerTask.getProject();
101:                // Now create and execute the java compiler task
102:                ExecTask lExecTask = (ExecTask) lThisProject.createTask("exec");
103:                lExecTask.setTaskName(lOwnerTask.getTaskName());
104:                if (mExecutable == null) {
105:                    throw new BuildException(
106:                            "Could not execute Ant Task (exec) due to no 'Executable' being set. Internal Exception.");
107:                }
108:
109:                lExecTask.setExecutable(mExecutable);
110:
111:                lExecTask.setFailonerror(mFailOnError);
112:                if (mDirectory != null) {
113:                    File lDir = new File(mDirectory);
114:                    lExecTask.setDir(lDir);
115:                }
116:                // Work on arguments and then roar like a lion.
117:                for (Iterator lArgumentsIterator = mArguments.iterator(); lArgumentsIterator
118:                        .hasNext();) {
119:                    String lArgument = (String) lArgumentsIterator.next();
120:                    Commandline.Argument lTaskArgument = lExecTask.createArg();
121:                    lTaskArgument.setValue(lArgument);
122:                }
123:
124:                lExecTask.execute();
125:            }
126:        }
w_ww__.j___a___v___a___2___s_.__c__o___m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.