Source Code Cross Referenced for NodeAddData.java in  » Library » Apache-commons-configuration-1.4-src » org » apache » commons » configuration » tree » 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 » Library » Apache commons configuration 1.4 src » org.apache.commons.configuration.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.commons.configuration.tree;
018:
019:        import java.util.Collections;
020:        import java.util.LinkedList;
021:        import java.util.List;
022:
023:        /**
024:         * <p>
025:         * A simple data class used by <code>{@link ExpressionEngine}</code> to store
026:         * the results of the <code>prepareAdd()</code> operation.
027:         * </p>
028:         * <p>
029:         * If a new property is to be added to a configuration, the affected
030:         * <code>Configuration</code> object must know, where in its hierarchy of
031:         * configuration nodes new elements have to be added. This information is
032:         * obtained by an <code>ExpressionEngine</code> object that interprets the key
033:         * of the new property. This expression engine will pack all information
034:         * necessary for the configuration to perform the add operation in an instance
035:         * of this class.
036:         * </p>
037:         * <p>
038:         * Information managed by this class contains:
039:         * <ul>
040:         * <li>the configuration node, to which new elements must be added</li>
041:         * <li>the name of the new node</li>
042:         * <li>whether the new node is a child node or an attribute node</li>
043:         * <li>if a whole branch is to be added at once, the names of all nodes between
044:         * the parent node (the target of the add operation) and the new node</li>
045:         * </ul>
046:         * </p>
047:         *
048:         * @since 1.3
049:         * @author Oliver Heger
050:         */
051:        public class NodeAddData {
052:            /** Stores the parent node of the add operation. */
053:            private ConfigurationNode parent;
054:
055:            /**
056:             * Stores a list with nodes that are on the path between the parent node and
057:             * the new node.
058:             */
059:            private List pathNodes;
060:
061:            /** Stores the name of the new node. */
062:            private String newNodeName;
063:
064:            /** Stores the attribute flag. */
065:            private boolean attribute;
066:
067:            /**
068:             * Creates a new, uninitialized instance of <code>NodeAddData</code>.
069:             */
070:            public NodeAddData() {
071:                this (null, null);
072:            }
073:
074:            /**
075:             * Creates a new instance of <code>NodeAddData</code> and sets the most
076:             * important data fields.
077:             *
078:             * @param parent the parent node
079:             * @param nodeName the name of the new node
080:             */
081:            public NodeAddData(ConfigurationNode parent, String nodeName) {
082:                setParent(parent);
083:                setNewNodeName(nodeName);
084:            }
085:
086:            /**
087:             * Returns a flag if the new node to be added is an attribute.
088:             *
089:             * @return <b>true</b> for an attribute node, <b>false</b> for a child
090:             * node
091:             */
092:            public boolean isAttribute() {
093:                return attribute;
094:            }
095:
096:            /**
097:             * Sets the attribute flag. This flag determines whether an attribute or a
098:             * child node will be added.
099:             *
100:             * @param attribute the attribute flag
101:             */
102:            public void setAttribute(boolean attribute) {
103:                this .attribute = attribute;
104:            }
105:
106:            /**
107:             * Returns the name of the new node.
108:             *
109:             * @return the new node's name
110:             */
111:            public String getNewNodeName() {
112:                return newNodeName;
113:            }
114:
115:            /**
116:             * Sets the name of the new node. A node with this name will be added to the
117:             * configuration's node hierarchy.
118:             *
119:             * @param newNodeName the name of the new node
120:             */
121:            public void setNewNodeName(String newNodeName) {
122:                this .newNodeName = newNodeName;
123:            }
124:
125:            /**
126:             * Returns the parent node.
127:             *
128:             * @return the parent node
129:             */
130:            public ConfigurationNode getParent() {
131:                return parent;
132:            }
133:
134:            /**
135:             * Sets the parent node. New nodes will be added to this node.
136:             *
137:             * @param parent the parent node
138:             */
139:            public void setParent(ConfigurationNode parent) {
140:                this .parent = parent;
141:            }
142:
143:            /**
144:             * Returns a list with further nodes that must be added. This is needed if a
145:             * complete branch is to be added at once. For instance imagine that there
146:             * exists only a node <code>database</code>. Now the key
147:             * <code>database.connection.settings.username</code> (assuming the syntax
148:             * of the default expression engine) is to be added. Then
149:             * <code>username</code> is the name of the new node, but the nodes
150:             * <code>connection</code> and <code>settings</code> must be added to
151:             * the parent node first. In this example these names would be returned by
152:             * this method.
153:             *
154:             * @return a list with the names of nodes that must be added as parents of
155:             * the new node (never <b>null</b>)
156:             */
157:            public List getPathNodes() {
158:                return (pathNodes != null) ? Collections
159:                        .unmodifiableList(pathNodes) : Collections.EMPTY_LIST;
160:            }
161:
162:            /**
163:             * Adds the name of a path node. With this method an additional node to be
164:             * added can be defined.
165:             *
166:             * @param nodeName the name of the node
167:             * @see #getPathNodes()
168:             */
169:            public void addPathNode(String nodeName) {
170:                if (pathNodes == null) {
171:                    pathNodes = new LinkedList();
172:                }
173:                pathNodes.add(nodeName);
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.