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.wiki;
04:
05: import java.util.*;
06:
07: public class VirtualCouplingPage implements WikiPage {
08: private WikiPage hostPage;
09: private HashMap children = new HashMap();
10:
11: protected VirtualCouplingPage(WikiPage hostPage) {
12: this .hostPage = hostPage;
13: }
14:
15: public VirtualCouplingPage(WikiPage hostPage, WikiPage proxy)
16: throws Exception {
17: this .hostPage = hostPage;
18: List proxyChildren = proxy.getChildren();
19: for (Iterator iterator = proxyChildren.iterator(); iterator
20: .hasNext();) {
21: CommitingPage wikiPage = (CommitingPage) iterator.next();
22: wikiPage.parent = this ;
23: children.put(wikiPage.getName(), wikiPage);
24: }
25: }
26:
27: public boolean hasChildPage(String pageName) throws Exception {
28: return children.containsKey(pageName);
29: }
30:
31: public PageData getData() throws Exception {
32: return hostPage.getData();
33: }
34:
35: public int compareTo(Object o) {
36: return 0;
37: }
38:
39: public WikiPage addChildPage(String name) throws Exception {
40: return null;
41: }
42:
43: public void removeChildPage(String name) throws Exception {
44: }
45:
46: public PageData getDataVersion(String versionName) throws Exception {
47: return null;
48: }
49:
50: public WikiPage getParent() throws Exception {
51: return hostPage.getParent();
52: }
53:
54: public String getName() throws Exception {
55: return hostPage.getName();
56: }
57:
58: public WikiPage getChildPage(String name) throws Exception {
59: WikiPage subpage = (WikiPage) children.get(name);
60: if (subpage == null)
61: subpage = hostPage.getChildPage(name);
62: return subpage;
63: }
64:
65: public List getChildren() throws Exception {
66: return new ArrayList(children.values());
67: }
68:
69: public VersionInfo commit(PageData data) throws Exception {
70: return null;
71: }
72:
73: public boolean hasExtension(String extensionName) {
74: return false;
75: }
76:
77: public Extension getExtension(String extensionName) {
78: return null;
79: }
80:
81: public PageCrawler getPageCrawler() {
82: return hostPage.getPageCrawler();
83: }
84: }
|