Source Code Cross Referenced for StarTeamLabel.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » starteam » 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.starteam 
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:        package org.apache.tools.ant.taskdefs.optional.starteam;
019:
020:        import com.starbase.starteam.Label;
021:        import com.starbase.starteam.View;
022:        import com.starbase.util.OLEDate;
023:        import java.text.ParseException;
024:        import java.text.SimpleDateFormat;
025:        import java.util.Date;
026:        import org.apache.tools.ant.BuildException;
027:
028:        /**
029:         * Creates a view label in StarTeam at the specified view.
030:         *
031:         * Ant Usage:
032:         * <pre>
033:         * &lt;taskdef name="stlabel"
034:         *          classname="org.apache.tools.ant.taskdefs.optional.starteam.StarTeamLabel"/&lt;
035:         *     &lt;stlabel
036:         * label="1.0" lastbuild="20011514100000" description="Successful Build"
037:         * username="BuildMaster" password="ant"
038:         * starteamurl="server:port/project/view"/&gt;
039:         * </pre>
040:         *
041:         * @see <a href="http://www.borland.com/us/products/starteam/index.html"
042:         * >borland StarTeam Web Site</a>
043:         *
044:         * @ant.task name="stlabel" category="scm"
045:         */
046:        public class StarTeamLabel extends StarTeamTask {
047:
048:            /**
049:             * The name of the label to be set in Starteam.
050:             */
051:            private String labelName;
052:
053:            /**
054:             * The label description to be set in Starteam.
055:             */
056:            private String description;
057:
058:            /**
059:             * If true, this will be a build label.  If false, it will be a non-build
060:             * label.  The default is false.  Has no effect if revision label is
061:             * true.
062:             */
063:            private boolean buildlabel = false;
064:
065:            /**
066:             * If true, this will be a revision label.  If false, it will be a build
067:             * label.  The default is false.
068:             */
069:            private boolean revisionlabel = false;
070:
071:            /**
072:             * The time of the last successful. The new label will be a snapshot of the
073:             * repository at this time. String should be formatted as "yyyyMMddHHmmss"
074:             */
075:            private OLEDate lastBuild = null;
076:
077:            private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
078:                    "yyyyMMddHHmmss");
079:
080:            /**
081:             * The name to be given to the label; required.
082:             * @param label the name to be used
083:             */
084:            public void setLabel(String label) {
085:                this .labelName = label;
086:            }
087:
088:            /**
089:             * Description of the label to be stored in the StarTeam project.
090:             * @param description the description to be used
091:             */
092:            public void setDescription(String description) {
093:                this .description = description;
094:            }
095:
096:            /**
097:             * set the type of label based on the supplied value - if true, this
098:             * label will be a revision label, if false, a build label.
099:             *
100:             * @param buildlabel If true this will be a revision label; if false,
101:             * a build label
102:             */
103:            public void setBuildLabel(boolean buildlabel) {
104:                this .buildlabel = buildlabel;
105:            }
106:
107:            /**
108:             * set the type of label based on the supplied value - if true, this
109:             * label will be a revision label, if false, a build label.
110:             *
111:             * @param revisionlabel If true this will be a revision label; if false,
112:             * a build label
113:             */
114:            public void setRevisionLabel(boolean revisionlabel) {
115:                this .revisionlabel = revisionlabel;
116:            }
117:
118:            /**
119:             * The timestamp of the build that will be stored with the label; required.
120:             * Must be formatted <code>yyyyMMddHHmmss</code>
121:             * @param lastbuild the timestamp of the last build
122:             * @throws BuildException on error
123:             */
124:            public void setLastBuild(String lastbuild) throws BuildException {
125:                try {
126:                    Date lastBuildTime = DATE_FORMAT.parse(lastbuild);
127:                    this .lastBuild = new OLEDate(lastBuildTime);
128:                } catch (ParseException e) {
129:                    throw new BuildException("Unable to parse the date '"
130:                            + lastbuild + "'", e);
131:                }
132:            }
133:
134:            /**
135:             * This method does the work of creating the new view and checking it into
136:             * Starteam.
137:             * @throws BuildException on error
138:             */
139:            public void execute() throws BuildException {
140:
141:                if (this .revisionlabel && this .buildlabel) {
142:                    throw new BuildException(
143:                            "'revisionlabel' and 'buildlabel' "
144:                                    + "both specified.  A revision label cannot be a build label.");
145:                }
146:
147:                try {
148:                    View snapshot = openView();
149:
150:                    // Create the new label and update the repository
151:
152:                    if (this .revisionlabel) {
153:                        new Label(snapshot, this .labelName, this .description)
154:                                .update();
155:                        log("Created Revision Label " + this .labelName);
156:                    } else if (null != lastBuild) {
157:                        new Label(snapshot, this .labelName, this .description,
158:                                this .lastBuild, this .buildlabel).update();
159:                        log("Created View Label ("
160:                                + (this .buildlabel ? "" : "non-") + "build) "
161:                                + this .labelName + " as of "
162:                                + this .lastBuild.toString());
163:                    } else {
164:                        new Label(snapshot, this .labelName, this .description,
165:                                this .buildlabel).update();
166:                        log("Created View Label ("
167:                                + (this .buildlabel ? "" : "non-") + "build) "
168:                                + this .labelName);
169:                    }
170:                } catch (Exception e) {
171:                    throw new BuildException(e);
172:                } finally {
173:                    disconnectFromServer();
174:                }
175:
176:            }
177:
178:            /**
179:             * Override of base-class abstract function creates an
180:             * appropriately configured view.  For labels this a view
181:             * configured as of this.lastBuild.
182:             *
183:             * @param raw the unconfigured <code>View</code>
184:             * @return the snapshot <code>View</code> appropriately configured.
185:             */
186:            protected View createSnapshotView(View raw) {
187:                /*
188:                if (this.revisionlabel) {
189:                    return raw;
190:                }
191:                return new View(raw, ViewConfiguration.createFromTime(this.lastBuild));
192:                 */
193:                return raw;
194:            }
195:
196:        }
ww___w___.__j_ava__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.