lenya/src/java/org/apache/lenya/cms/publication SiteTreeException.java,NONE,1.1 SiteTree.java,1.3,1.4 DefaultSiteTree.java,1.5,1.6
Christian Egli <[email protected]> Tue, 13 May 2003 17:56:07 +0200
| Newsgroups | gmane.comp.cms.wyona.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /repository/lenya/src/java/org/apache/lenya/cms/publication In directory erbium:/tmp/cvs-serv10449/src/java/org/apache/lenya/cms/publication Modified Files: SiteTree.java DefaultSiteTree.java Added Files: SiteTreeException.java Log Message: Added an Exception to the SiteTree that is thrown if the addNode method fails, usually because the parent node doesn't exist. --- NEW FILE: SiteTreeException.java --- /* * $Id: SiteTreeException.java,v 1.1 2003/05/13 15:56:04 egli Exp $ * <License> * The Apache Software License * * Copyright (c) 2002 lenya. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * 3. All advertising materials mentioning features or use of this software must * display the following acknowledgment: "This product includes software developed * by lenya (http://www.lenya.org)" * * 4. The name "lenya" must not be used to endorse or promote products derived from * this software without prior written permission. For written permission, please * contact [email protected] * * 5. Products derived from this software may not be called "lenya" nor may "lenya" * appear in their names without prior written permission of lenya. * * 6. Redistributions of any form whatsoever must retain the following acknowledgment: * "This product includes software developed by lenya (http://www.lenya.org)" * * THIS SOFTWARE IS PROVIDED BY lenya "AS IS" WITHOUT ANY WARRANTY EXPRESS OR IMPLIED, * INCLUDING THE WARRANTY OF NON-INFRINGEMENT AND THE IMPLIED WARRANTIES OF MERCHANTI- * BILITY AND FITNESS FOR A PARTICULAR PURPOSE. lenya WILL NOT BE LIABLE FOR ANY DAMAGES * SUFFERED BY YOU AS A RESULT OF USING THIS SOFTWARE. IN NO EVENT WILL lenya BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR LOST PROFITS EVEN IF lenya HAS * BEEN ADVISED OF THE POSSIBILITY OF THEIR OCCURRENCE. lenya WILL NOT BE LIABLE FOR ANY * THIRD PARTY CLAIMS AGAINST YOU. * * Lenya includes software developed by the Apache Software Foundation, W3C, * DOM4J Project, BitfluxEditor and Xopus. * </License> */ package org.apache.lenya.cms.publication; public class SiteTreeException extends Exception { /** * Creates a new SiteTreeException. */ public SiteTreeException() { } /** * Creates a new SiteTreeException. */ public SiteTreeException(String message) { super(message); } /** * Creates a new SiteTreeException. */ public SiteTreeException(String message, Throwable cause) { super(message, cause); } /** * Creates a new SiteTreeException. */ public SiteTreeException(Throwable cause) { super(cause); } } Index: SiteTree.java =================================================================== RCS file: /repository/lenya/src/java/org/apache/lenya/cms/publication/SiteTree.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SiteTree.java 13 May 2003 12:28:53 -0000 1.3 --- SiteTree.java 13 May 2003 15:56:04 -0000 1.4 *************** *** 48,57 **** public interface SiteTree { ! void addNode(String parentid, String id, Label[] labels); void addNode(String parentid, String id, Label[] labels, ! String href, String suffix, boolean link); ! void addNode(SiteTreeNode node); void deleteNode(String id); --- 48,60 ---- public interface SiteTree { ! void addNode(String parentid, String id, Label[] labels) ! throws SiteTreeException; void addNode(String parentid, String id, Label[] labels, ! String href, String suffix, boolean link) ! throws SiteTreeException; ! void addNode(SiteTreeNode node) ! throws SiteTreeException; void deleteNode(String id); Index: DefaultSiteTree.java =================================================================== RCS file: /repository/lenya/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DefaultSiteTree.java 13 May 2003 13:22:42 -0000 1.5 --- DefaultSiteTree.java 13 May 2003 15:56:04 -0000 1.6 *************** *** 113,128 **** } ! public void addNode(String parentid, String id, Label[] labels) { addNode(parentid, id, labels, null, null, false); } public void addNode(String parentid, String id, Label[] labels, ! String href, String suffix, boolean link) { Node parentNode = getNodeInternal(parentid); if (parentNode == null) { ! log.error("No nodes: " + parentid + ". No child added"); ! ! return; } --- 113,134 ---- } ! public void addNode(String parentid, String id, Label[] labels) ! throws SiteTreeException { addNode(parentid, id, labels, null, null, false); } + public void addNode(SiteTreeNode node) + throws SiteTreeException { + this.addNode(node.getParentId(), node.getId(), node.getLabels(), + node.getHref(), node.getSuffix(), node.hasLink()); + } + public void addNode(String parentid, String id, Label[] labels, ! String href, String suffix, boolean link) ! throws SiteTreeException { Node parentNode = getNodeInternal(parentid); if (parentNode == null) { ! throw new SiteTreeException("Parentid: " + parentid + " not found"); } *************** *** 165,173 **** parentNode.appendChild(child); log.debug("Tree has been modified: " + document.getDocumentElement()); - } - - public void addNode(SiteTreeNode node) { - this.addNode(node.getParentId(), node.getId(), node.getLabels(), - node.getHref(), node.getSuffix(), node.hasLink()); } --- 171,174 ----