KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > cruisecontrol > bootstrappers > AntBootstrapper


1 /********************************************************************************
2  * CruiseControl, a Continuous Integration Toolkit
3  * Copyright (c) 2001, ThoughtWorks, Inc.
4  * 651 W Washington Ave. Suite 600
5  * Chicago, IL 60661 USA
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * + Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * + Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  *
20  * + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the
21  * names of its contributors may be used to endorse or promote
22  * products derived from this software without specific prior
23  * written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  ********************************************************************************/

37 package net.sourceforge.cruisecontrol.bootstrappers;
38
39 import net.sourceforge.cruisecontrol.Bootstrapper;
40 import net.sourceforge.cruisecontrol.CruiseControlException;
41 import net.sourceforge.cruisecontrol.builders.AntBuilder;
42 import net.sourceforge.cruisecontrol.builders.Property;
43 import org.apache.log4j.Logger;
44 import org.jdom.Attribute;
45 import org.jdom.Element;
46
47 import java.util.HashMap JavaDoc;
48
49 /**
50  * A thin wrapper around the AntBuilder class, this class allows you to
51  * call an Ant script as a bootstrapper.
52  *
53  * @see net.sourceforge.cruisecontrol.builders.AntBuilder
54  *
55  * @author <a HREF="mailto:rjmpsmith@hotmail.com">Robert J. Smith</a>
56  */

57 public class AntBootstrapper implements Bootstrapper {
58
59     private static final Logger LOG = Logger.getLogger(AntBootstrapper.class);
60
61     private AntBuilder delegate = new AntBuilder();
62
63     /**
64      * @see net.sourceforge.cruisecontrol.Bootstrapper#bootstrap()
65      */

66     public void bootstrap() throws CruiseControlException {
67         Element result = delegate.build(new HashMap JavaDoc());
68         if (result == null) {
69             LOG.error("Bootstrap failed.\n\n");
70         } else {
71             Attribute error = result.getAttribute("error");
72             if (error == null) {
73                 LOG.info("Bootstrap successful.");
74             } else {
75                 LOG.error("Bootstrap failed.\n\n"
76                         + error.getValue()
77                         + "\n");
78             }
79         }
80     }
81
82     public void validate() throws CruiseControlException {
83         delegate.validate();
84     }
85
86     /**
87      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setSaveLogDir(String)
88      */

89     public void setSaveLogDir(String JavaDoc dir) {
90         delegate.setSaveLogDir(dir);
91     }
92
93     /**
94      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setAntWorkingDir(String)
95      */

96     public void setAntWorkingDir(String JavaDoc dir) {
97         delegate.setAntWorkingDir(dir);
98     }
99
100     /**
101      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setAntScript(String)
102      */

103     public void setAntScript(String JavaDoc antScript) {
104         delegate.setAntScript(antScript);
105     }
106
107     /**
108      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setAntHome(String)
109      */

110     public void setAntHome(String JavaDoc antHome) {
111         delegate.setAntHome(antHome);
112     }
113
114     /**
115      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setTempFile(String)
116      */

117     public void setTempFile(String JavaDoc tempFileName) {
118         delegate.setTempFile(tempFileName);
119     }
120
121     /**
122      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setTarget(String)
123      */

124     public void setTarget(String JavaDoc target) {
125         delegate.setTarget(target);
126     }
127
128     /**
129      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setBuildFile(String)
130      */

131     public void setBuildFile(String JavaDoc buildFile) {
132         delegate.setBuildFile(buildFile);
133     }
134
135     /**
136      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setUseLogger(boolean)
137      */

138     public void setUseLogger(boolean useLogger) {
139         delegate.setUseLogger(useLogger);
140     }
141
142     /**
143      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#createJVMArg()
144      */

145     public Object JavaDoc createJVMArg() {
146         return delegate.createJVMArg();
147     }
148
149     /**
150      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#createProperty()
151      */

152     public Property createProperty() {
153         return delegate.createProperty();
154     }
155
156     /**
157      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setUseDebug(boolean)
158      */

159     public void setUseDebug(boolean debug) {
160         delegate.setUseDebug(debug);
161     }
162
163     /**
164      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setUseQuiet(boolean)
165      */

166     public void setUseQuiet(boolean quiet) {
167         delegate.setUseQuiet(quiet);
168     }
169
170     /**
171      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#getLoggerClassName()
172      */

173     public String JavaDoc getLoggerClassName() {
174         return delegate.getLoggerClassName();
175     }
176
177     /**
178      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setLoggerClassName(String)
179      */

180     public void setLoggerClassName(String JavaDoc string) {
181         delegate.setLoggerClassName(string);
182     }
183
184     /**
185      * @see net.sourceforge.cruisecontrol.builders.AntBuilder#setTimeout(long)
186      */

187     public void setTimeout(long timeout) {
188         delegate.setTimeout(timeout);
189     }
190 }
191
Popular Tags