001: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
002: // Released under the terms of the GNU General Public License version 2 or later.
003: package fitnesse.wiki;
004:
005: import java.util.ArrayList;
006: import java.util.HashMap;
007: import java.util.Iterator;
008: import java.util.List;
009:
010: public class VirtualCouplingPage implements WikiPage {
011:
012: private static final long serialVersionUID = 1L;
013:
014: private WikiPage hostPage;
015:
016: private HashMap children = new HashMap();
017:
018: protected VirtualCouplingPage(WikiPage hostPage) {
019: this .hostPage = hostPage;
020: }
021:
022: public VirtualCouplingPage(WikiPage hostPage, WikiPage proxy)
023: throws Exception {
024: this .hostPage = hostPage;
025: List proxyChildren = proxy.getChildren();
026: for (Iterator iterator = proxyChildren.iterator(); iterator
027: .hasNext();) {
028: CommitingPage wikiPage = (CommitingPage) iterator.next();
029: wikiPage.parent = this ;
030: children.put(wikiPage.getName(), wikiPage);
031: }
032: }
033:
034: public boolean hasChildPage(String pageName) throws Exception {
035: return children.containsKey(pageName);
036: }
037:
038: public PageData getData() throws Exception {
039: return hostPage.getData();
040: }
041:
042: public int compareTo(Object o) {
043: return 0;
044: }
045:
046: public WikiPage addChildPage(String name) throws Exception {
047: return null;
048: }
049:
050: public void removeChildPage(String name) throws Exception {
051: }
052:
053: public PageData getDataVersion(String versionName) throws Exception {
054: return null;
055: }
056:
057: public WikiPage getParent() throws Exception {
058: return hostPage.getParent();
059: }
060:
061: public String getName() throws Exception {
062: return hostPage.getName();
063: }
064:
065: public WikiPage getChildPage(String name) throws Exception {
066: WikiPage subpage = (WikiPage) children.get(name);
067: if (subpage == null)
068: subpage = hostPage.getChildPage(name);
069: return subpage;
070: }
071:
072: public List getChildren() throws Exception {
073: return new ArrayList(children.values());
074: }
075:
076: public VersionInfo commit(PageData data) throws Exception {
077: return null;
078: }
079:
080: public boolean hasExtension(String extensionName) {
081: return false;
082: }
083:
084: public Extension getExtension(String extensionName) {
085: return null;
086: }
087:
088: public PageCrawler getPageCrawler() {
089: return hostPage.getPageCrawler();
090: }
091:
092: public boolean isSTIQTest() {
093: return false;
094: }
095:
096: public boolean isSTIQTestComponent() {
097: return false;
098: }
099:
100: public boolean isSTIQBranch() {
101: return false;
102: }
103:
104: }
|