Source Code Cross Referenced for MirrorListHandler.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » pluginmgr » 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 » Swing Library » jEdit » org.gjt.sp.jedit.pluginmgr 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * MirrorListHandler.java - XML handler for the mirrors list
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 2002 Kris Kopicki (parts copied from Slava Pestov :) )
007:         *
008:         * This program is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public License
010:         * as published by the Free Software Foundation; either version 2
011:         * of the License, or any later version.
012:         *
013:         * This program is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:
023:        package org.gjt.sp.jedit.pluginmgr;
024:
025:        import java.util.*;
026:
027:        import org.xml.sax.Attributes;
028:        import org.xml.sax.InputSource;
029:        import org.xml.sax.helpers.DefaultHandler;
030:
031:        import org.gjt.sp.util.XMLUtilities;
032:        import org.gjt.sp.util.Log;
033:        import org.gjt.sp.jedit.options.PluginOptions;
034:
035:        /**
036:         * @version $Id: MirrorListHandler.java 8314 2007-01-06 09:50:04Z kpouer $
037:         */
038:        class MirrorListHandler extends DefaultHandler {
039:            //{{{ Constructor
040:            MirrorListHandler(MirrorList mirrors, String path) {
041:                this .mirrors = mirrors;
042:                this .path = path;
043:            } //}}}
044:
045:            //{{{ resolveEntity() method
046:            public InputSource resolveEntity(String publicId, String systemId) {
047:                return XMLUtilities.findEntity(systemId, "mirrors.dtd",
048:                        PluginOptions.class);
049:            } //}}}
050:
051:            //{{{ characters() method
052:            public void characters(char[] c, int off, int len) {
053:                String tag = peekElement();
054:
055:                if (tag == "DESCRIPTION")
056:                    description.append(c, off, len);
057:                else if (tag == "LOCATION")
058:                    location.append(c, off, len);
059:                else if (tag == "COUNTRY")
060:                    country.append(c, off, len);
061:                else if (tag == "CONTINENT")
062:                    continent.append(c, off, len);
063:            } //}}}
064:
065:            //{{{ startElement() method
066:            public void startElement(String uri, String localName, String tag,
067:                    Attributes attrs) {
068:                tag = pushElement(tag);
069:
070:                if (tag.equals("MIRROR")) {
071:                    mirror = new MirrorList.Mirror();
072:                    id = attrs.getValue("ID");
073:                }
074:            } //}}}
075:
076:            //{{{ endElement() method
077:            public void endElement(String uri, String localName, String tag) {
078:                popElement();
079:
080:                if (tag.equals("MIRROR")) {
081:                    mirror.id = id;
082:                    mirror.description = description.toString();
083:                    mirror.location = location.toString();
084:                    mirror.country = country.toString();
085:                    mirror.continent = continent.toString();
086:                    mirrors.add(mirror);
087:                    description.setLength(0);
088:                    location.setLength(0);
089:                    country.setLength(0);
090:                    continent.setLength(0);
091:                }
092:            } //}}}
093:
094:            //{{{ startDocument() method
095:            public void startDocument() {
096:                try {
097:                    pushElement(null);
098:                } catch (Exception e) {
099:                    Log.log(Log.ERROR, this , e);
100:                }
101:            } //}}}
102:
103:            //{{{ endDocument() method
104:            public void endDocument() {
105:                mirrors.finished();
106:            } //}}}
107:
108:            //{{{ Private members
109:
110:            //{{{ Variables
111:            private String id;
112:            private final StringBuilder description = new StringBuilder();
113:            private final StringBuilder location = new StringBuilder();
114:            private final StringBuilder country = new StringBuilder();
115:            private final StringBuilder continent = new StringBuilder();
116:
117:            private final MirrorList mirrors;
118:            private MirrorList.Mirror mirror;
119:
120:            private final Stack<String> stateStack = new Stack<String>();
121:            private final String path;
122:
123:            //}}}
124:
125:            private String pushElement(String name) {
126:                name = name == null ? null : name.intern();
127:                stateStack.push(name);
128:                return name;
129:            }
130:
131:            private String peekElement() {
132:                return stateStack.peek();
133:            }
134:
135:            private void popElement() {
136:                stateStack.pop();
137:            }
138:
139:            //}}}
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.