Source Code Cross Referenced for CMSynergyBootstrapper.java in  » Build » cruisecontrol » net » sourceforge » cruisecontrol » bootstrappers » 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 » cruisecontrol » net.sourceforge.cruisecontrol.bootstrappers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /********************************************************************************
002:         * CruiseControl, a Continuous Integration Toolkit
003:         * Copyright (c) 2001, ThoughtWorks, Inc.
004:         * 200 E. Randolph, 25th Floor
005:         * Chicago, IL 60601 USA
006:         * All rights reserved.
007:         *
008:         * Redistribution and use in source and binary forms, with or without
009:         * modification, are permitted provided that the following conditions
010:         * are met:
011:         *
012:         *     + Redistributions of source code must retain the above copyright
013:         *       notice, this list of conditions and the following disclaimer.
014:         *
015:         *     + Redistributions in binary form must reproduce the above
016:         *       copyright notice, this list of conditions and the following
017:         *       disclaimer in the documentation and/or other materials provided
018:         *       with the distribution.
019:         *
020:         *     + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the
021:         *       names of its contributors may be used to endorse or promote
022:         *       products derived from this software without specific prior
023:         *       written permission.
024:         *
025:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
026:         * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
027:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
028:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
029:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
030:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
031:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
032:         * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
033:         * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
034:         * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
035:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
036:         ********************************************************************************/package net.sourceforge.cruisecontrol.bootstrappers;
037:
038:        import java.io.File;
039:
040:        import net.sourceforge.cruisecontrol.Bootstrapper;
041:        import net.sourceforge.cruisecontrol.CruiseControlException;
042:        import net.sourceforge.cruisecontrol.sourcecontrols.CMSynergy;
043:        import net.sourceforge.cruisecontrol.util.ManagedCommandline;
044:        import net.sourceforge.cruisecontrol.util.ValidationHelper;
045:
046:        import org.apache.log4j.Logger;
047:
048:        /**
049:         * The CMSynergyBootstrapper will reconfigure the project (and
050:         * by default all subprojects) in order to pull in the latest changes.
051:         * <p>
052:         * If you do not wish to reconfigure subprojects, please set the
053:         * recurse attribute to false.
054:         *
055:         * @author <a href="mailto:rjmpsmith@gmail.com">Robert J. Smith</a>
056:         */
057:        public class CMSynergyBootstrapper implements  Bootstrapper {
058:
059:            /**
060:             * The CM Synergy executable used for executing commands. If not set,
061:             * we will use the default value "ccm".
062:             */
063:            private String ccmExe;
064:
065:            /**
066:             * The CM Synergy project spec (2 part name) of the project we will
067:             * use as a template to determine if any new tasks have been completed.
068:             */
069:            private String projectSpec;
070:
071:            /**
072:             * If set to true, all subprojects will also be reconfigured.
073:             */
074:            private boolean recurse = true;
075:
076:            /**
077:             * The file which contains the mapping between CM Synergy session names
078:             * and IDs.
079:             */
080:            private File sessionFile;
081:
082:            /**
083:             * The given name of the CM Synergy session to use.
084:             */
085:            private String sessionName;
086:
087:            /**
088:             * The logger for this class
089:             */
090:            private static final Logger LOG = Logger
091:                    .getLogger(CMSynergyBootstrapper.class);
092:
093:            /**
094:             * Sets the name of the CM Synergy executable to use when issuing
095:             * commands.
096:             *
097:             * @param ccmExe the name of the CM Synergy executable
098:             */
099:            public void setCcmExe(String ccmExe) {
100:                this .ccmExe = ccmExe;
101:            }
102:
103:            /**
104:             * Sets the CM Synergy project you wish to reconfigure
105:             *
106:             * @param projectSpec
107:             *            The project spec (in 2 part name format).
108:             */
109:            public void setProject(String projectSpec) {
110:                this .projectSpec = projectSpec;
111:            }
112:
113:            /**
114:             * Sets the value of the recurse attribute. If set to true, all subprojects
115:             * will be reconfigured.
116:             *
117:             * @param recurse
118:             */
119:            public void setRecurse(boolean recurse) {
120:                this .recurse = recurse;
121:            }
122:
123:            /**
124:             * Sets the file which contains the mapping between CM Synergy session names
125:             * and IDs. This file should be in the standard properties file format. Each
126:             * line should map one name to a CM Synergy session ID (as returned by the
127:             * "ccm status" command).
128:             * <p>
129:             * example:
130:             * <br><br>
131:             * session1=localhost:65024:192.168.1.17
132:             *
133:             * @param sessionFile
134:             *            The session file
135:             */
136:            public void setSessionFile(String sessionFile) {
137:                this .sessionFile = new File(sessionFile);
138:            }
139:
140:            /**
141:             * Sets the name of the CM Synergy session to use with this plugin. This
142:             * name should appear in the specified session file.
143:             *
144:             * @param sessionName
145:             *            The session name
146:             *
147:             * @see #setSessionFile(String)
148:             */
149:            public void setSessionName(String sessionName) {
150:                this .sessionName = sessionName;
151:            }
152:
153:            public void bootstrap() throws CruiseControlException {
154:                LOG.info("Reconfiguring project \"" + projectSpec + "\".");
155:
156:                // Create a managed command line
157:                ManagedCommandline cmd = CMSynergy.createCcmCommand(ccmExe,
158:                        sessionName, sessionFile);
159:                cmd.createArgument("reconfigure");
160:                cmd.createArguments("-project", projectSpec);
161:                if (recurse) {
162:                    cmd.createArgument("-recurse");
163:                }
164:
165:                try {
166:                    cmd.execute();
167:                    cmd.assertExitCode(0);
168:                } catch (Exception e) {
169:                    throw new CruiseControlException(
170:                            "Could not reconfigure the project \""
171:                                    + projectSpec + "\".", e);
172:                }
173:            }
174:
175:            /* (non-Javadoc)
176:             * @see net.sourceforge.cruisecontrol.Bootstrapper#validate()
177:             */
178:            public void validate() throws CruiseControlException {
179:                // We must know which project to reconfigure
180:                ValidationHelper.assertIsSet(projectSpec, "project", this
181:                        .getClass());
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.