Source Code Cross Referenced for MappingAction.java in  » Library » Apache-commons-betwixt-0.8-src » org » apache » commons » betwixt » io » read » 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 betwixt 0.8 src » org.apache.commons.betwixt.io.read 
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.betwixt.io.read;
018:
019:        import org.apache.commons.betwixt.AttributeDescriptor;
020:        import org.apache.commons.betwixt.ElementDescriptor;
021:        import org.xml.sax.Attributes;
022:
023:        /**
024:         * Executes mapping action for a subgraph.
025:         * It is intended that most MappingAction's will not need to maintain state.
026:         * 
027:         * @author <a href='http://jakarta.apache.org/'>Jakarta Commons Team</a>
028:         * @version $Revision: 438373 $
029:         */
030:        public abstract class MappingAction {
031:
032:            public abstract MappingAction next(String namespace, String name,
033:                    Attributes attributes, ReadContext context)
034:                    throws Exception;
035:
036:            /**
037:             * Executes mapping action on new element.
038:             * @param namespace
039:             * @param name
040:             * @param attributes Attributes not null
041:             * @param context Context not null
042:             * @return the MappingAction to be used to map the sub-graph 
043:             * under this element
044:             * @throws Exception
045:             */
046:            public abstract MappingAction begin(String namespace, String name,
047:                    Attributes attributes, ReadContext context)
048:                    throws Exception;
049:
050:            /**
051:             * Executes mapping action for element body text
052:             * @param text
053:             * @param context
054:             * @throws Exception
055:             */
056:            public abstract void body(String text, ReadContext context)
057:                    throws Exception;
058:
059:            /**
060:             * Executes mapping action one element ends
061:             * @param context
062:             * @throws Exception
063:             */
064:            public abstract void end(ReadContext context) throws Exception;
065:
066:            public static final MappingAction EMPTY = new MappingAction.Base();
067:
068:            public static final MappingAction IGNORE = new MappingAction.Ignore();
069:
070:            private static final class Ignore extends MappingAction {
071:
072:                public MappingAction next(String namespace, String name,
073:                        Attributes attributes, ReadContext context)
074:                        throws Exception {
075:                    return this ;
076:                }
077:
078:                public MappingAction begin(String namespace, String name,
079:                        Attributes attributes, ReadContext context)
080:                        throws Exception {
081:                    return this ;
082:                }
083:
084:                public void body(String text, ReadContext context)
085:                        throws Exception {
086:                    // do nothing
087:                }
088:
089:                public void end(ReadContext context) throws Exception {
090:                    // do nothing
091:                }
092:
093:            }
094:
095:            /**
096:             * Basic action.
097:             * 
098:             * @author <a href='http://jakarta.apache.org/'>Jakarta Commons Team</a>
099:             * @version $Revision: 438373 $
100:             */
101:            public static class Base extends MappingAction {
102:
103:                public MappingAction next(String namespace, String name,
104:                        Attributes attributes, ReadContext context)
105:                        throws Exception {
106:
107:                    return context.getActionMappingStrategy().getMappingAction(
108:                            namespace, name, attributes, context);
109:                }
110:
111:                /**
112:                 * @see org.apache.commons.betwixt.io.read.MappingAction#begin(String, String, Attributes, ReadContext)
113:                 */
114:                public MappingAction begin(String namespace, String name,
115:                        Attributes attributes, ReadContext context)
116:                        throws Exception {
117:                    // TODO: i'm not too sure about this part of the design
118:                    // i'm not sure whether base should give base behaviour or if it should give standard behaviour
119:                    // i'm hoping that things will become clearer once the descriptor logic has been cleared 
120:                    ElementDescriptor descriptor = context
121:                            .getCurrentDescriptor();
122:                    if (descriptor != null) {
123:
124:                        AttributeDescriptor[] attributeDescriptors = descriptor
125:                                .getAttributeDescriptors();
126:                        context.populateAttributes(attributeDescriptors,
127:                                attributes);
128:                    }
129:                    return this ;
130:                }
131:
132:                /**
133:                 * @see MappingAction#body(String, ReadContext)
134:                 */
135:                public void body(String text, ReadContext context)
136:                        throws Exception {
137:                    // do nothing
138:                }
139:
140:                /**
141:                 * @see MappingAction#end(ReadContext)
142:                 */
143:                public void end(ReadContext context) throws Exception {
144:                    // do nothing
145:                    // TODO: this is a temporary refactoring
146:                    // it would be better to do this in the rule
147:                    // need to move more logic into the context and out of the rule
148:                    context.popElement();
149:                }
150:
151:            }
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.