Source code: com/tripi/asp/JavaMapNode.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 import java.util.Enumeration;
28 import org.apache.log4j.Category;
29
30 /**
31 * JavaMapNode handles Java objects which implement the SimpleMap
32 * interface.
33 * @author Terence Haddock
34 * @version 0.9
35 */
36 public class JavaMapNode extends JavaObjectNode implements SimpleMap
37 {
38 /** Debugging category */
39 static Category DBG = Category.getInstance(JavaMapNode.class);
40
41 /** The object this JavaObjectNode points to, dereferenced as a
42 * SimpleMap object */
43 SimpleMap mapObj;
44
45 /**
46 * Constructor.
47 * @param obj Sub-object this node is referencing
48 */
49 public JavaMapNode(SimpleMap obj)
50 {
51 super(obj);
52 this.mapObj = obj;
53 }
54
55 /**
56 * Overrides the get() operation for an object.
57 * @param key Key key of object to objtain
58 * @return Value of the key reference
59 * @see SimpleMap#get(Object)
60 * @throws AspException when an exception occurs
61 */
62 public Object get(Object key) throws AspException
63 {
64 return Types.coerceToNode(mapObj.get(key));
65 }
66
67 /**
68 * Overrides the put() operation for an object.
69 * @param key Key of the object to store.
70 * @param value Value of the object to store
71 * @see SimpleMap#put(Object, Object)
72 * @throws AspException if an exception occurs
73 */
74 public void put(Object key, Object value) throws AspException
75 {
76 mapObj.put(key, value);
77 }
78
79 /**
80 * Overrides the getKeys() operation for an object.
81 * @return enumeration of the keys contained within this object.
82 * @throws AspException if an error occurs.
83 */
84 public Enumeration getKeys() throws AspException
85 {
86 return mapObj.getKeys();
87 }
88 }