Source Code Cross Referenced for ClearCase.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » clearcase » 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 » Build » ANT » org.apache.tools.ant.taskdefs.optional.clearcase 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:
019:        package org.apache.tools.ant.taskdefs.optional.clearcase;
020:
021:        import java.io.File;
022:        import org.apache.tools.ant.BuildException;
023:        import org.apache.tools.ant.Project;
024:        import org.apache.tools.ant.Task;
025:        import org.apache.tools.ant.taskdefs.ExecTask;
026:        import org.apache.tools.ant.taskdefs.Execute;
027:        import org.apache.tools.ant.taskdefs.LogStreamHandler;
028:        import org.apache.tools.ant.types.Commandline;
029:        import org.apache.tools.ant.util.FileUtils;
030:
031:        /**
032:         * A base class for creating tasks for executing commands on ClearCase.
033:         * <p>
034:         * The class extends the 'exec' task as it operates by executing the cleartool program
035:         * supplied with ClearCase. By default the task expects the cleartool executable to be
036:         * in the path, * you can override this be specifying the cleartooldir attribute.
037:         * </p>
038:         * <p>
039:         * This class provides set and get methods for the 'viewpath' and 'objselect'
040:         * attribute. It also contains constants for the flags that can be passed to
041:         * cleartool.
042:         * </p>
043:         *
044:         */
045:        public abstract class ClearCase extends Task {
046:            private String mClearToolDir = "";
047:            private String mviewPath = null;
048:            private String mobjSelect = null;
049:            private static int pcnt = 0;
050:            private boolean mFailonerr = true;
051:
052:            /**
053:             * Set the directory where the cleartool executable is located.
054:             *
055:             * @param dir the directory containing the cleartool executable
056:             */
057:            public final void setClearToolDir(String dir) {
058:                mClearToolDir = FileUtils.translatePath(dir);
059:            }
060:
061:            /**
062:             * Builds and returns the command string to execute cleartool
063:             *
064:             * @return String containing path to the executable
065:             */
066:            protected final String getClearToolCommand() {
067:                String toReturn = mClearToolDir;
068:                if (!toReturn.equals("") && !toReturn.endsWith("/")) {
069:                    toReturn += "/";
070:                }
071:
072:                toReturn += CLEARTOOL_EXE;
073:
074:                return toReturn;
075:            }
076:
077:            /**
078:             * Set the path to the item in a ClearCase view to operate on.
079:             *
080:             * @param viewPath Path to the view directory or file
081:             */
082:            public final void setViewPath(String viewPath) {
083:                mviewPath = viewPath;
084:            }
085:
086:            /**
087:             * Get the path to the item in a clearcase view
088:             *
089:             * @return mviewPath
090:             */
091:            public String getViewPath() {
092:                return mviewPath;
093:            }
094:
095:            /**
096:             * Get the basename path of the item in a clearcase view
097:             *
098:             * @return basename
099:             */
100:            public String getViewPathBasename() {
101:                return (new File(mviewPath)).getName();
102:            }
103:
104:            /**
105:             * Set the object to operate on.
106:             *
107:             * @param objSelect object to operate on
108:             */
109:            public final void setObjSelect(String objSelect) {
110:                mobjSelect = objSelect;
111:            }
112:
113:            /**
114:             * Get the object to operate on
115:             *
116:             * @return mobjSelect
117:             */
118:            public String getObjSelect() {
119:                return mobjSelect;
120:            }
121:
122:            /**
123:             * Execute the given command are return success or failure
124:             * @param cmd command line to execute
125:             * @return the exit status of the subprocess or <code>INVALID</code>
126:             */
127:            protected int run(Commandline cmd) {
128:                try {
129:                    Project aProj = getProject();
130:                    Execute exe = new Execute(new LogStreamHandler(this ,
131:                            Project.MSG_INFO, Project.MSG_WARN));
132:                    exe.setAntRun(aProj);
133:                    exe.setWorkingDirectory(aProj.getBaseDir());
134:                    exe.setCommandline(cmd.getCommandline());
135:                    return exe.execute();
136:                } catch (java.io.IOException e) {
137:                    throw new BuildException(e, getLocation());
138:                }
139:            }
140:
141:            /**
142:             * Execute the given command, and return it's output
143:             * @param cmdline command line to execute
144:             * @return output of the command line
145:             */
146:            protected String runS(Commandline cmdline) {
147:                String outV = "opts.cc.runS.output" + pcnt++;
148:                ExecTask exe = new ExecTask(this );
149:                Commandline.Argument arg = exe.createArg();
150:
151:                exe.setExecutable(cmdline.getExecutable());
152:                arg.setLine(Commandline.toString(cmdline.getArguments()));
153:                exe.setOutputproperty(outV);
154:                exe.execute();
155:
156:                return getProject().getProperty(outV);
157:            }
158:
159:            /**
160:             * If true, command will throw an exception on failure.
161:             *
162:             * @param failonerr the status to set the flag to
163:             * @since ant 1.6.1
164:             */
165:            public void setFailOnErr(boolean failonerr) {
166:                mFailonerr = failonerr;
167:            }
168:
169:            /**
170:             * Get failonerr flag status
171:             *
172:             * @return boolean containing status of failonerr flag
173:             * @since ant 1.6.1
174:             */
175:            public boolean getFailOnErr() {
176:                return mFailonerr;
177:            }
178:
179:            /**
180:             * Constant for the thing to execute
181:             */
182:            private static final String CLEARTOOL_EXE = "cleartool";
183:            /**
184:             * The 'Update' command
185:             */
186:            public static final String COMMAND_UPDATE = "update";
187:            /**
188:             * The 'Checkout' command
189:             */
190:            public static final String COMMAND_CHECKOUT = "checkout";
191:            /**
192:             * The 'Checkin' command
193:             */
194:            public static final String COMMAND_CHECKIN = "checkin";
195:            /**
196:             * The 'UndoCheckout' command
197:             */
198:            public static final String COMMAND_UNCHECKOUT = "uncheckout";
199:            /**
200:             * The 'Lock' command
201:             */
202:            public static final String COMMAND_LOCK = "lock";
203:            /**
204:             * The 'Unlock' command
205:             */
206:            public static final String COMMAND_UNLOCK = "unlock";
207:            /**
208:             * The 'Mkbl' command
209:             */
210:            public static final String COMMAND_MKBL = "mkbl";
211:            /**
212:             * The 'Mklabel' command
213:             */
214:            public static final String COMMAND_MKLABEL = "mklabel";
215:            /**
216:             * The 'Mklbtype' command
217:             */
218:            public static final String COMMAND_MKLBTYPE = "mklbtype";
219:            /**
220:             * The 'Rmtype' command
221:             */
222:            public static final String COMMAND_RMTYPE = "rmtype";
223:            /**
224:             * The 'LsCheckout' command
225:             */
226:            public static final String COMMAND_LSCO = "lsco";
227:            /**
228:             * The 'Mkelem' command
229:             */
230:            public static final String COMMAND_MKELEM = "mkelem";
231:            /**
232:             * The 'Mkattr' command
233:             */
234:            public static final String COMMAND_MKATTR = "mkattr";
235:            /**
236:             * The 'Mkdir' command
237:             */
238:            public static final String COMMAND_MKDIR = "mkdir";
239:
240:        }
ww___w___.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.