Source code: com/tripi/asp/DefaultNode.java
1 /**
2 * ArrowHead ASP Server
3 * This is a source file for the ArrowHead ASP Server - an 100% Java
4 * VBScript interpreter and ASP server.
5 *
6 * For more information, see http://www.tripi.com/arrowhead
7 *
8 * Copyright (C) 2002 Terence Haddock
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25 package com.tripi.asp;
26
27 /**
28 * This class contains the default implementation of the Node
29 * interface. The default implementation is to throw the
30 * AspNotImplemented exception for every method.
31 *
32 * @author Terence Haddock
33 * @version 0.9
34 */
35 public class DefaultNode implements Node
36 {
37 /**
38 * Dumps the node representation in a textual format. Default
39 * implementation is to throw an AspNotImplemented exception
40 *
41 * @throws AspNotImplementedException if not overriden
42 * @see Node#dump()
43 */
44 public void dump() throws AspException
45 {
46 throw new AspNotImplementedException("dump");
47 }
48
49 /**
50 * Prepares this node for execution. Default implementation is to
51 * do nothing.
52 *
53 * @param context Global context
54 * @throws AspException if an error occurs
55 * @see Node#prepare(AspContext)
56 */
57 public void prepare(AspContext context) throws AspException
58 {
59 /* Default is to do nothing. */
60 }
61
62 /**
63 * Executes this node, returning the result.
64 * Default implementation is to return itself.
65 *
66 * @param context Current context
67 * @return Result of this node's execution.
68 * @throws AspNotException if any error occurs
69 * @see Node#execute(AspContext)
70 */
71 public Object execute(AspContext context) throws AspException
72 {
73 return this;
74 }
75 }