Source Code Cross Referenced for BaseSpecificXMLDeserializer.java in  » IDE-Netbeans » db » org » netbeans » modules » dbschema » migration » archiver » deserializer » 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 » IDE Netbeans » db » org.netbeans.modules.dbschema.migration.archiver.deserializer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        // GENERATED CODE FOR Sun ONE Studio class.
043:        //
044:        package org.netbeans.modules.dbschema.migration.archiver.deserializer;
045:
046:        import java.lang.*;
047:        import java.lang.reflect.*;
048:
049:        import org.xml.sax.*;
050:
051:        public class BaseSpecificXMLDeserializer extends BaseXMLDeserializer
052:                implements  SpecificXMLDeserializer {
053:            // Fields
054:
055:            public static final String WRONG_TAG = "Saw tag {1} when {2} was expected.";
056:            protected java.lang.Integer State;
057:            protected java.lang.Class ParameterClass;
058:            protected java.lang.Class ParameterSetMethod;
059:
060:            //@olsen+MBO: used unsynchronized HashMap and ArrayListStack
061:            protected ArrayListStack StateStack;
062:            protected ArrayListStack ObjectStack;
063:            protected java.util.HashMap ActiveAliasHash;
064:            /*
065:             protected   java.util.Stack StateStack;
066:             protected   java.util.Stack ObjectStack;
067:             protected   java.util.Hashtable ActiveAliasHash;
068:             protected   java.util.Hashtable ClassHash; // @olsen+MBO: NOT USED!
069:             */
070:
071:            protected java.util.Vector ParameterArray;
072:            public java.util.Vector ParameterTypeArray;
073:            protected XMLDeserializer MasterDeserializer;
074:            private ClassLoader classLoader; //@lars
075:
076:            // Constructors
077:
078:            //@lars: added classloader-constructor
079:            public BaseSpecificXMLDeserializer(ClassLoader cl) {
080:                super ();
081:                //@olsen+MBO: used unsynchronized HashMap and ArrayListStack
082:                this .ObjectStack = new ArrayListStack();
083:                this .StateStack = new ArrayListStack();
084:                this .classLoader = (cl != null ? cl : getClass()
085:                        .getClassLoader());
086:                /*
087:                 this.ObjectStack    = new java.util.Stack();
088:                 this.StateStack     = new java.util.Stack();
089:                 */
090:                this .setMasterDeserializer(this );
091:            } /*Constructor-End*/
092:
093:            public BaseSpecificXMLDeserializer() {
094:                this (null);
095:            } /*Constructor-End*/
096:
097:            // Methods
098:
099:            public void setMasterDeserializer(XMLDeserializer master) {
100:                this .MasterDeserializer = master;
101:            } /*Method-End*/
102:
103:            public void unexpectedTag(String actual, String expected,
104:                    boolean endTagExpected) throws org.xml.sax.SAXException {
105:
106:                if (endTagExpected) {
107:                    //String endTag = new String("/" + expected);
108:                    //expected = endTag;
109:                    expected = "/" + expected;
110:
111:                }
112:
113:                String message = ("Saw tag " + actual + " when " + expected + " was expected.");
114:
115:                SAXException tagError = new SAXException(message);
116:
117:                throw tagError;
118:            } /*Method-End*/
119:
120:            public void validateTag(String actual, String expected,
121:                    boolean endTagExpected) throws org.xml.sax.SAXException {
122:                if (!actual.equals(expected)) {
123:                    this .unexpectedTag(actual, expected, endTagExpected);
124:                }
125:            } /*Method-End*/
126:
127:            public void popState() {
128:                this .State = (Integer) (this .StateStack.pop());
129:            } /*Method-End*/
130:
131:            public void pushState(int newState) {
132:                // put the old state on the top of the stack
133:
134:                this .StateStack.push(this .State);
135:
136:                // and now set the state to the new state
137:                this .State = new Integer(newState);
138:            } /*Method-End*/
139:
140:            public void addActiveAlias(String name, String alias) {
141:                if (this .ActiveAliasHash == null) {
142:                    //this.ActiveAliasHash = new java.util.Hashtable(20, 0.75F);
143:                    this .ActiveAliasHash = new java.util.HashMap(20);
144:                }
145:
146:                //@olsen+MBO: removed redundant code
147:                /*
148:                 if (this.ActiveAliasHash.containsKey(alias))
149:                 {
150:                 this.ActiveAliasHash.remove(alias);
151:                 }
152:                 */
153:                this .ActiveAliasHash.put(alias, name);
154:            } /*Method-End*/
155:
156:            public String lookupAlias(String name) {
157:                //
158:                //   this method searches the alias hashtable
159:                //   if it exists and returns the name of the alias
160:                //   otherwise it simply returns the name that was
161:                //   passed in
162:                //
163:                String retName = null;
164:
165:                if (this .ActiveAliasHash != null) {
166:                    retName = (String) (this .ActiveAliasHash.get(name));
167:
168:                }
169:                if (retName == null) {
170:                    retName = name;
171:                }
172:
173:                return retName;
174:            } /*Method-End*/
175:
176:            public Class findClass(String name)
177:                    throws java.lang.ClassNotFoundException {
178:                Class lReturnClass;
179:
180:                //@lars: added classloader
181:                //        lReturnClass = Class.forName (name);
182:
183:                name = org.netbeans.modules.dbschema.migration.archiver.MapClassName
184:                        .getRealClassName(name);
185:                lReturnClass = java.lang.Class.forName(name,
186:                        true /*initialize the class*/, this .classLoader);
187:
188:                return lReturnClass;
189:            } /*Method-End*/
190:
191:            public Object popObject() {
192:                return this .ObjectStack.pop();
193:            } /*Method-End*/
194:
195:            public void pushObject(Object obj) {
196:                this .ObjectStack.push(obj);
197:            } /*Method-End*/
198:
199:            public String unescapeName(String name) {
200:                // this method is going to strip the _ and - from
201:                // the beginning of the name
202:
203:                //@olsen+MBO: minimized number of objects and operations
204:                if (name.startsWith("_-")) {
205:                    return name.substring(2);
206:                }
207:
208:                int idx = name.indexOf('-');
209:                if (idx >= 0) {
210:                    StringBuffer buf = new StringBuffer(name);
211:                    buf.setCharAt(idx, '_');
212:                    return buf.toString();
213:                }
214:
215:                return name;
216:                /*
217:                 StringBuffer lStr = new StringBuffer(name);
218:
219:                 if ( (lStr.charAt(0) == '_') &&
220:                 (lStr.charAt(1) == '-') )
221:                 {
222:                 lStr.delete(0,2);
223:                 }
224:                 else
225:                 {
226:                 boolean lFound = false;
227:                 int lLocation;
228:                 // search for dash
229:                 loop:
230:                 for (lLocation = 0; lLocation < lStr.length(); lLocation++)
231:                 {
232:                 if (lStr.charAt(lLocation) == '-')
233:                 {
234:                 lFound = true;
235:                 break loop;
236:                 }// end if
237:                 }// end for
238:
239:                 // if we find an dash replace it with a underscore
240:                 if (lFound)
241:                 {
242:                 lStr.replace(lLocation, lLocation + 1, "_");
243:
244:                 }// end if
245:
246:
247:                 }// end if
248:                 return lStr.toString();
249:                 */
250:            } /*Method-End*/
251:
252:            public boolean useExistingAttribute(org.xml.sax.AttributeList atts,
253:                    String attrname, Object existing)
254:                    throws org.xml.sax.SAXException {
255:                boolean retBool = false;
256:
257:                String useDirective = atts.getValue("USE");
258:
259:                if (useDirective != null && useDirective.equals("EXISTING")) {
260:                    //@olsen+MBO: ever stepped in?
261:
262:                    java.lang.Object lCurrentObj = this .topObject();
263:                    Field lField = null;
264:                    try {
265:                        lField = lCurrentObj.getClass().getDeclaredField(
266:                                attrname);
267:                        existing = lField.get(lCurrentObj);
268:                    } catch (IllegalArgumentException e1) {
269:                        // add the illegal arg exception to the exception stack
270:                        // and then mask it under a SAXexception and raise the
271:                        // SAXException
272:
273:                        //String message = new String("Illegal Argument used " + lCurrentObj.getClass().getName());
274:                        String message = ("Illegal Argument used " + lCurrentObj
275:                                .getClass().getName());
276:                        SAXException useError = new SAXException(message);
277:                        throw useError;
278:                    } catch (IllegalAccessException e2) {
279:                        // add the illegal access exception to the exception stack
280:                        // and then mask it under a SAXexception and raise the
281:                        // SAXException
282:                        //String message = new String("Illegal Access of field " + lField);
283:                        String message = ("Illegal Access of field " + lField);
284:                        SAXException useError = new SAXException(message);
285:                        throw useError;
286:                    } catch (NoSuchFieldException e3) {
287:                        // add the no such field exception to the exception stack
288:                        // and then mask it under a SAXexception and raise the
289:                        // SAXException
290:
291:                        //String message = new String("No such field " + attrname);
292:                        String message = ("No such field " + attrname);
293:                        SAXException useError = new SAXException(message);
294:                        throw useError;
295:                    }
296:
297:                    retBool = true;
298:                } else if (useDirective != null) {
299:                    //String message = new String("Invalid value USE for attribute " + useDirective);
300:                    String message = ("Invalid value USE for attribute " + useDirective);
301:
302:                    SAXException useError = new SAXException(message);
303:                    throw useError;
304:
305:                }// end if
306:
307:                return retBool;
308:            } /*Method-End*/
309:
310:            public java.lang.Object topObject() throws org.xml.sax.SAXException {
311:                if (this .ObjectStack.size() == 0) {
312:                    //String message = new String("Object Stack Empty");
313:                    String message = ("Object Stack Empty");
314:
315:                    SAXException stackError = new SAXException(message);
316:
317:                    throw stackError;
318:
319:                }
320:
321:                return this .ObjectStack.peek();
322:            } /*Method-End*/
323:
324:            public void freeResources() {
325:                super .freeResources();
326:                this .ObjectStack.clear();
327:                //ParameterArray.clear();
328:                //ParameterTypeArray.clear();
329:                StateStack.clear();
330:                if (ActiveAliasHash != null)
331:                    ActiveAliasHash.clear();
332:            } /*Method-End*/
333:
334:            public void DumpStatus() {
335:                // This method is a debug method to dump status information about this object
336:                super .DumpStatus();
337:
338:                System.out
339:                        .println("Dump Status from class BaseSpecificXMLSerializer");
340:                System.out.println("Current state " + this .State);
341:                System.out.println("State stack " + this .StateStack);
342:                System.out.println("Object Stack " + this .ObjectStack);
343:                System.out
344:                        .println("Dump Status from class BasespecificXMLSerializer - END");
345:
346:            }
347:
348:        } // end of class
w_w___w__._j_a_v___a_2___s__.c_om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.