01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.updates;
04:
05: import fitnesse.wiki.*;
06:
07: public class FrontPageUpdate implements Update {
08: private Updater updater;
09:
10: public FrontPageUpdate(Updater updater) {
11: this .updater = updater;
12: }
13:
14: public String getName() {
15: return "FrontPageUpdate";
16: }
17:
18: public String getMessage() {
19: return "Creating FrontPage";
20: }
21:
22: public boolean shouldBeApplied() throws Exception {
23: return !updater.getRoot().hasChildPage("FrontPage");
24: }
25:
26: public void doUpdate() throws Exception {
27: WikiPage frontPage = updater.getRoot().getPageCrawler()
28: .addPage(updater.getRoot(),
29: PathParser.parse("FrontPage"));
30: PageData data = new PageData(frontPage);
31: data.setContent(content);
32: frontPage.commit(data);
33: }
34:
35: private static String content = "\n\n\n"
36: + "!c !3 Welcome to the Wonderful World of !-FitNesse-!!";
37: }
|