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


001:        /*
002:         * ServiceManager.java - Handles services.xml files in plugins
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 2003 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;
024:
025:        //{{{ Imports
026:        import java.io.*;
027:        import java.net.URL;
028:        import java.util.*;
029:
030:        import org.xml.sax.Attributes;
031:        import org.xml.sax.InputSource;
032:        import org.xml.sax.helpers.DefaultHandler;
033:
034:        import org.gjt.sp.util.Log;
035:        import org.gjt.sp.util.XMLUtilities;
036:
037:        //}}}
038:
039:        /**
040:         * @since jEdit 4.2pre1
041:         * @author Slava Pestov
042:         * @version $Id: ServiceListHandler.java 5573 2006-07-13 04:37:32Z vanza $
043:         */
044:        class ServiceListHandler extends DefaultHandler {
045:            //{{{ ServiceListHandler constructor
046:            ServiceListHandler(PluginJAR plugin, URL uri) {
047:                this .plugin = plugin;
048:                this .uri = uri;
049:                code = new StringBuffer();
050:                stateStack = new Stack();
051:                cachedServices = new LinkedList();
052:            } //}}}
053:
054:            //{{{ resolveEntity() method
055:            public InputSource resolveEntity(String publicId, String systemId) {
056:                return XMLUtilities.findEntity(systemId, "services.dtd",
057:                        getClass());
058:            } //}}}
059:
060:            //{{{ characters() method
061:            public void characters(char[] c, int off, int len) {
062:                String tag = peekElement();
063:                if (tag == "SERVICE")
064:                    code.append(c, off, len);
065:            } //}}}
066:
067:            //{{{ startElement() method
068:            public void startElement(String uri, String localName, String tag,
069:                    Attributes attrs) {
070:                tag = pushElement(tag);
071:                serviceName = attrs.getValue("NAME");
072:                serviceClass = attrs.getValue("CLASS");
073:            } //}}}
074:
075:            //{{{ endElement() method
076:            public void endElement(String uri, String localName, String name) {
077:                String tag = peekElement();
078:
079:                if (name.equals(tag)) {
080:                    if (tag.equals("SERVICE")) {
081:                        ServiceManager.Descriptor d = new ServiceManager.Descriptor(
082:                                serviceClass, serviceName, code.toString(),
083:                                plugin);
084:                        ServiceManager.registerService(d);
085:                        cachedServices.add(d);
086:                        code.setLength(0);
087:                    }
088:
089:                    popElement();
090:                } else {
091:                    // can't happen
092:                    throw new InternalError();
093:                }
094:            } //}}}
095:
096:            //{{{ startDocument() method
097:            public void startDocument() {
098:                try {
099:                    pushElement(null);
100:                } catch (Exception e) {
101:                    e.printStackTrace();
102:                }
103:            } //}}}
104:
105:            //{{{ getCachedServices() method
106:            public ServiceManager.Descriptor[] getCachedServices() {
107:                return (ServiceManager.Descriptor[]) cachedServices
108:                        .toArray(new ServiceManager.Descriptor[cachedServices
109:                                .size()]);
110:            } //}}}
111:
112:            //{{{ Private members
113:
114:            //{{{ Instance variables
115:            private PluginJAR plugin;
116:            private URL uri;
117:
118:            private String serviceName;
119:            private String serviceClass;
120:            private StringBuffer code;
121:
122:            private Stack stateStack;
123:
124:            private List cachedServices;
125:
126:            //}}}
127:
128:            //{{{ pushElement() method
129:            private String pushElement(String name) {
130:                name = (name == null) ? null : name.intern();
131:
132:                stateStack.push(name);
133:
134:                return name;
135:            } //}}}
136:
137:            //{{{ peekElement() method
138:            private String peekElement() {
139:                return (String) stateStack.peek();
140:            } //}}}
141:
142:            //{{{ popElement() method
143:            private String popElement() {
144:                return (String) stateStack.pop();
145:            } //}}}
146:
147:            //}}}
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.