Source Code Cross Referenced for AppData.java in  » Web-Framework » TURBINE » org » apache » turbine » services » intake » xmlmodel » 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 » Web Framework » TURBINE » org.apache.turbine.services.intake.xmlmodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.services.intake.xmlmodel;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import java.io.Serializable;
023:
024:        import java.util.ArrayList;
025:        import java.util.Iterator;
026:        import java.util.List;
027:
028:        import org.apache.turbine.services.intake.IntakeException;
029:
030:        import org.xml.sax.Attributes;
031:
032:        /**
033:         * A class for holding application data structures.
034:         *
035:         * @author <a href="mailto:jmcnally@collab.net>John McNally</a>
036:         * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
037:         * @version $Id: AppData.java 534527 2007-05-02 16:10:59Z tv $
038:         */
039:        public class AppData implements  Serializable {
040:            /** Serial Version UID */
041:            private static final long serialVersionUID = -7998777726853272835L;
042:
043:            /** List of groups */
044:            private List inputs;
045:
046:            /** Package that will be used for all mapTo objects */
047:            private String basePackage;
048:
049:            /** Prefix string that will be used to qualify &lt;prefix&gt;:&lt;intakegroup&gt; names */
050:            private String groupPrefix;
051:
052:            /**
053:             * Default Constructor
054:             */
055:            public AppData() {
056:                inputs = new ArrayList();
057:            }
058:
059:            /**
060:             * Imports the top level element from an XML specification
061:             */
062:            public void loadFromXML(Attributes attrib) {
063:                String basePkg = attrib.getValue("basePackage");
064:                if (basePkg == null) {
065:                    setBasePackage("");
066:                } else {
067:                    if (basePkg.charAt(basePkg.length() - 1) != '.') {
068:                        setBasePackage(basePkg + '.');
069:                    } else {
070:                        setBasePackage(basePkg);
071:                    }
072:                }
073:
074:                setGroupPrefix(attrib.getValue("groupPrefix"));
075:            }
076:
077:            /**
078:             * Return a collection of input sections (&lt;group&gt;).
079:             * The names of the groups returned here are only unique
080:             * to this AppData object and not qualified with the groupPrefix.
081:             * This method is used in the IntakeService to register all the
082:             * groups with and without prefix in the service.
083:             *
084:             */
085:            public List getGroups() {
086:                return inputs;
087:            }
088:
089:            /**
090:             * Get a XmlGroup with the given name. It finds both
091:             * qualified and unqualified names in this package.
092:             *
093:             * @param groupName a <code>String</code> value
094:             * @return a <code>XmlGroup</code> value
095:             * @throws IntakeException indicates that the groupName was null
096:             */
097:            public XmlGroup getGroup(String groupName) throws IntakeException {
098:                if (groupName == null) {
099:                    throw new IntakeException(
100:                            "Intake AppData.getGroup(groupName) is null");
101:                }
102:
103:                String groupPrefix = getGroupPrefix();
104:
105:                for (Iterator it = inputs.iterator(); it.hasNext();) {
106:                    XmlGroup group = (XmlGroup) it.next();
107:
108:                    if (group.getName().equals(groupName)) {
109:                        return group;
110:                    }
111:                    if (groupPrefix != null) {
112:                        StringBuffer qualifiedGroupName = new StringBuffer();
113:
114:                        qualifiedGroupName.append(groupPrefix).append(':')
115:                                .append(group.getName());
116:
117:                        if (qualifiedGroupName.toString().equals(groupName)) {
118:                            return group;
119:                        }
120:                    }
121:                }
122:                return null;
123:            }
124:
125:            /**
126:             * An utility method to add a new input group from
127:             * an xml attribute.
128:             */
129:            public XmlGroup addGroup(Attributes attrib) {
130:                XmlGroup input = new XmlGroup();
131:                input.loadFromXML(attrib);
132:                addGroup(input);
133:                return input;
134:            }
135:
136:            /**
137:             * Add an input group to the vector and sets the
138:             * AppData property to this AppData
139:             */
140:            public void addGroup(XmlGroup input) {
141:                input.setAppData(this );
142:                inputs.add(input);
143:            }
144:
145:            /**
146:             * Get the base package String that will be appended to
147:             * any mapToObjects
148:             *
149:             * @return value of basePackage.
150:             */
151:            public String getBasePackage() {
152:                return basePackage;
153:            }
154:
155:            /**
156:             * Set the base package String that will be appended to
157:             * any mapToObjects
158:             *
159:             * @param v  Value to assign to basePackage.
160:             */
161:            public void setBasePackage(String v) {
162:                this .basePackage = v;
163:            }
164:
165:            /**
166:             * Get the prefix String that will be used to qualify
167:             * intake groups when using multiple XML files
168:             *
169:             * @return value of groupPrefix
170:             */
171:            public String getGroupPrefix() {
172:                return groupPrefix;
173:            }
174:
175:            /**
176:             * Set the prefix String that will be used to qualify
177:             * intake groups when using multiple XML files
178:             *
179:             * @param groupPrefix  Value to assign to basePackage.
180:             */
181:            public void setGroupPrefix(String groupPrefix) {
182:                this .groupPrefix = groupPrefix;
183:            }
184:
185:            /**
186:             * Creats a string representation of this AppData.
187:             * The representation is given in xml format.
188:             */
189:            public String toString() {
190:                StringBuffer result = new StringBuffer();
191:
192:                result.append("<input-data>\n");
193:                for (Iterator iter = inputs.iterator(); iter.hasNext();) {
194:                    result.append(iter.next());
195:                }
196:                result.append("</input-data>");
197:                return result.toString();
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.