Source Code Cross Referenced for NamedNodeMapImpl.java in  » Database-DBMS » Ozone-1.1 » org » ozoneDB » xml » dom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » Ozone 1.1 » org.ozoneDB.xml.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * org/ozone-db/xml/dom/NamedNodeMapImpl.java
003:         *
004:         * The contents of this file are subject to the OpenXML Public
005:         * License Version 1.0; you may not use this file except in compliance
006:         * with the License. You may obtain a copy of the License at
007:         * http://www.openxml.org/license.html
008:         *
009:         * THIS SOFTWARE IS DISTRIBUTED ON AN "AS IS" BASIS WITHOUT WARRANTY
010:         * OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE INITIAL DEVELOPER
011:         * AND ALL CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES AS A
012:         * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
013:         * DERIVATIVES. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
014:         * RIGHTS AND LIMITATIONS UNDER THE LICENSE.
015:         *
016:         * The Initial Developer of this code under the License is Assaf Arkin.
017:         * Portions created by Assaf Arkin are Copyright (C) 1998, 1999.
018:         * All Rights Reserved.
019:         */
020:
021:        /**
022:         * Changes for Persistent DOM running with ozone are
023:         * Copyright 1999 by SMB GmbH. All rights reserved.
024:         */package org.ozoneDB.xml.dom;
025:
026:        import java.util.*;
027:        import java.io.*;
028:        import org.w3c.dom.*;
029:        import org.ozoneDB.OzoneObject;
030:
031:        /**
032:         * Implements a collection of nodes that can be accessed by name. Used mostly by
033:         * {@link DocumentTypeImpl} to hold collections of element, notation and other
034:         * definitions.
035:         * <P>
036:         * The actual collection of objects is held by some owner node in a {@link
037:         * java.util.Dictionary}. This map object provides access to this dictionary
038:         * in a manner that is consistent with the DOM. This map can be accessed
039:         * concurrently, so the owner need only create one map per dictionary.
040:         * <P>
041:         * Nodes are not maintained in any particular order, so accessing them by index
042:         * can be expected to be a slow operation.
043:         *
044:         *
045:         * @version $Revision: 1.1 $ $Date: 2001/12/18 11:03:24 $
046:         * @author <a href="mailto:arkin@trendline.co.il">Assaf Arkin</a>
047:         * @see org.w3c.dom.NamedNodeMap
048:         */
049:        public final class NamedNodeMapImpl extends OzoneObject implements 
050:                NamedNodeMapProxy, Externalizable {
051:
052:            final static long serialVersionUID = 1;
053:
054:            public Node getNamedItemNS(java.lang.String namespaceURI,
055:                    java.lang.String localName) {
056:                throw new DOMExceptionImpl(
057:                        DOMException.NOT_SUPPORTED_ERR,
058:                        "NamedNode.getNamedItemNS(): ozone's persistent DOM doesn't support DOM level 2 yet.");
059:            }
060:
061:            public Node setNamedItemNS(Node arg) throws DOMException {
062:                throw new DOMExceptionImpl(
063:                        DOMException.NOT_SUPPORTED_ERR,
064:                        "NamedNode.getNamedItemNS(): ozone's persistent DOM doesn't support DOM level 2 yet.");
065:            }
066:
067:            public Node removeNamedItemNS(java.lang.String namespaceURI,
068:                    java.lang.String localName) throws DOMException {
069:                throw new DOMExceptionImpl(
070:                        DOMException.NOT_SUPPORTED_ERR,
071:                        "NamedNode.getNamedItemNS(): ozone's persistent DOM doesn't support DOM level 2 yet.");
072:            }
073:
074:            public synchronized Node getNamedItem(String name) {
075:                // Dictionary get by name.
076:                return (Node) _dictionary.get(name);
077:            }
078:
079:            public synchronized Node setNamedItem(Node arg) throws DOMException {
080:                // Make sure the DTD is not read only and that the added node is of the
081:                // allowed type (Entity, Notation, AttrDecl, ElementDecl).
082:                if (_owner.isReadOnly()) {
083:                    throw new DOMExceptionImpl(
084:                            DOMException.NO_MODIFICATION_ALLOWED_ERR);
085:                }
086:                if (arg == null || !(arg instanceof  Node)) {
087:                    throw new DOMExceptionImpl(DOMException.WRONG_DOCUMENT_ERR);
088:                }
089:                if (!(arg instanceof  ElementDeclProxy
090:                        || arg instanceof  Notation || arg instanceof  Entity)) {
091:                    throw new DOMExceptionImpl(DOMException.WRONG_DOCUMENT_ERR);
092:                }
093:                return (Node) _dictionary.put(arg.getNodeName(), arg);
094:            }
095:
096:            public synchronized Node removeNamedItem(String name)
097:                    throws DOMException {
098:                if (_owner.isReadOnly()) {
099:                    throw new DOMExceptionImpl(
100:                            DOMException.NO_MODIFICATION_ALLOWED_ERR);
101:                }
102:                return (Node) _dictionary.remove(name);
103:            }
104:
105:            public synchronized Node item(int index) {
106:                Enumeration elem;
107:
108:                // Get by index is a long operation, but one that is performed less
109:                // than get by name. We opt not to use the JDK 1.2 collections to
110:                // speed it up for the sake of portability.
111:                elem = _dictionary.elements();
112:                while (elem.hasMoreElements()) {
113:                    if (index == 0) {
114:                        return (Node) elem.nextElement();
115:                    }
116:                    elem.nextElement();
117:                    --index;
118:                }
119:                return null;
120:            }
121:
122:            public int getLength() {
123:                return _dictionary.size();
124:            }
125:
126:            /**
127:             * So we lied about the owner managing the dictionary. But just in case
128:             * the owner would like to traverse the dictionary list without resorting
129:             * to the slower indexed method.
130:             *
131:             * @return Enumeration of all elements in the dictionary
132:             */
133:            public Enumeration elements() {
134:                return (Enumeration) _dictionary.elements();
135:            }
136:
137:            /**
138:             * Constructor required the owner of this dictionary and a reference to the
139:             * dictionary. Once constructed, the map is ready for use.
140:             *
141:             * @param owner The owner of this dictionary
142:             * @param dictionary The dictionary managed by that owner
143:             */
144:            public NamedNodeMapImpl(NodeProxy owner, Dictionary dictionary) {
145:                init(owner, dictionary);
146:            }
147:
148:            public NamedNodeMapImpl() {
149:                super ();
150:            }
151:
152:            public void init(NodeProxy owner, Dictionary dictionary) {
153:                if (owner == null || dictionary == null) {
154:                    throw new NullPointerException(
155:                            "Argument 'owner' or 'dictionary' is null.");
156:                }
157:                _dictionary = dictionary;
158:                _owner = owner;
159:            }
160:
161:            /** */
162:            public void writeExternal(ObjectOutput out) throws IOException {
163:                // super.writeExternal (out);
164:                out.writeObject(_dictionary);
165:                out.writeObject(_owner);
166:            }
167:
168:            /** */
169:            public void readExternal(ObjectInput in) throws IOException,
170:                    ClassNotFoundException {
171:                // super.readExternal (in);
172:                _dictionary = (Dictionary) in.readObject();
173:                _owner = (NodeProxy) in.readObject();
174:            }
175:
176:            /**
177:             * Reference to the dictionary accessed through this node map. The dictionary
178:             * is not held by this object but by the {@link #_owner}.
179:             */
180:            private Dictionary _dictionary;
181:
182:            /**
183:             * Reference to the owner of this node list. This is another node which contains
184:             * {@link #_dictionary} as part of it.
185:             */
186:            private NodeProxy _owner;
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.