01: /*
02: * %W% %E%
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.jump.module.contentstore;
28:
29: import java.util.Iterator;
30:
31: /**
32: * <code>JUMPNode</code> abstracts the interface to access the data
33: * stored in the store. Every node has a name and an URI that serves as the
34: * unique identifier for the node that is part of the store.
35: * <p>
36: * The implementation of <code>JUMPNode</code> is not expected to be
37: * synchronized. Therefore it is a calling application's responsibility to
38: * ensure any synchronization in case of concurrent access.
39: * The behaviour of <code>JUMPNode</code> implementation is undefined
40: * if a node is modified while there is another reference to this node.
41: */
42: public interface JUMPNode {
43: /**
44: * Returns the name of the node.
45: */
46: public String getName();
47:
48: /**
49: * Returns the URI of the node.
50: */
51: public String getURI();
52:
53: /**
54: * Indicates if the node contains data or not. If the node contains
55: * data, then it can be casted to <Code>JUMPDataNode</code> or else
56: * it can be casted to <Code>JUMPContainerNode</code>
57: * <p>
58: * <pre>
59: * JUMPNode node;
60: * if ( node.containsData() ) {
61: * JUMPData data = ((JUMPNode.Data)node).getData();
62: * }
63: * else {
64: * Iterator nodeIterator =
65: * ((JUMPNode.List)node).getChildren();
66: * // use the iterator to get the children nodes
67: * }
68: * </pre>
69: */
70: public boolean containsData();
71:
72: /**
73: * A node that can contain data.
74: */
75: interface Data extends JUMPNode {
76: /**
77: * Returns the data contained within the node.
78: */
79: public JUMPData getData();
80: }
81:
82: /**
83: * A node that can contain the list of other nodes.
84: */
85: interface List extends JUMPNode {
86: /**
87: * Returns the list of children contained within this node. The
88: * class of the object contained in the iterator is
89: * <Code>JUMPNode</code>
90: */
91: public Iterator getChildren();
92: }
93: }
|