Source Code Cross Referenced for JSFCatalog.java in  » IDE-Netbeans » web.core » org » netbeans » modules » web » jsf » 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 » web.core » org.netbeans.modules.web.jsf 
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:        package org.netbeans.modules.web.jsf;
043:
044:        import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
045:        import org.netbeans.modules.xml.catalog.spi.*;
046:        import org.openide.util.NbBundle;
047:        import org.openide.util.Utilities;
048:        import org.w3c.dom.Document;
049:        import org.w3c.dom.DocumentType;
050:
051:        /**
052:         *
053:         * @author  Petr Pisl
054:         */
055:        public class JSFCatalog implements  CatalogReader, CatalogDescriptor,
056:                org.xml.sax.EntityResolver {
057:
058:            private static final String JSF_ID_1_0 = "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"; // NOI18N
059:            private static final String JSF_ID_1_1 = "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"; // NOI18N
060:
061:            private static final String URL_JSF_1_0 = "nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_1_0.dtd"; // NOI18N
062:            private static final String URL_JSF_1_1 = "nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_1_1.dtd"; // NOI18N
063:
064:            public static final String JAVAEE_NS = "http://java.sun.com/xml/ns/javaee"; // NOI18N
065:            private static final String JSF_1_2_XSD = "web-facesconfig_1_2.xsd"; // NOI18N
066:            private static final String JSF_1_2 = JAVAEE_NS + "/" + JSF_1_2_XSD; // NOI18N
067:            public static final String JSF_ID_1_2 = "SCHEMA:" + JSF_1_2; // NOI18N
068:            private static final String URL_JSF_1_2 = "nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_1_2.xsd"; // NOI18N
069:
070:            /** Creates a new instance of StrutsCatalog */
071:            public JSFCatalog() {
072:            }
073:
074:            /**
075:             * Get String iterator representing all public IDs registered in catalog.
076:             * @return null if cannot proceed, try later.
077:             */
078:            public java.util.Iterator getPublicIDs() {
079:                java.util.List list = new java.util.ArrayList();
080:                list.add(JSF_ID_1_0);
081:                list.add(JSF_ID_1_1);
082:                list.add(JSF_ID_1_2);
083:                return list.listIterator();
084:            }
085:
086:            /**
087:             * Get registered systemid for given public Id or null if not registered.
088:             * @return null if not registered
089:             */
090:            public String getSystemID(String publicId) {
091:                if (JSF_ID_1_0.equals(publicId))
092:                    return URL_JSF_1_0;
093:                else if (JSF_ID_1_1.equals(publicId))
094:                    return URL_JSF_1_1;
095:                else if (JSF_ID_1_2.equals(publicId))
096:                    return URL_JSF_1_2;
097:                else
098:                    return null;
099:            }
100:
101:            /**
102:             * Refresh content according to content of mounted catalog.
103:             */
104:            public void refresh() {
105:            }
106:
107:            /**
108:             * Optional operation allowing to listen at catalog for changes.
109:             * @throws UnsupportedOpertaionException if not supported by the implementation.
110:             */
111:            public void addCatalogListener(CatalogListener l) {
112:            }
113:
114:            /**
115:             * Optional operation couled with addCatalogListener.
116:             * @throws UnsupportedOpertaionException if not supported by the implementation.
117:             */
118:            public void removeCatalogListener(CatalogListener l) {
119:            }
120:
121:            /** Registers new listener.  */
122:            public void addPropertyChangeListener(
123:                    java.beans.PropertyChangeListener l) {
124:            }
125:
126:            /** Unregister the listener.  */
127:            public void removePropertyChangeListener(
128:                    java.beans.PropertyChangeListener l) {
129:            }
130:
131:            /**
132:             * @return I18N display name
133:             */
134:            public String getDisplayName() {
135:                return NbBundle.getMessage(JSFCatalog.class, "LBL_JSFCatalog");
136:            }
137:
138:            /**
139:             * Return visuaized state of given catalog.
140:             * @param type of icon defined by JavaBeans specs
141:             * @return icon representing current state or null
142:             */
143:            public java.awt.Image getIcon(int type) {
144:                return Utilities
145:                        .loadImage("org/netbeans/modules/web/jsf/resources/JSFCatalog.png"); // NOI18N
146:            }
147:
148:            /**
149:             * @return I18N short description
150:             */
151:            public String getShortDescription() {
152:                return NbBundle.getMessage(JSFCatalog.class, "DESC_JSFCatalog");
153:            }
154:
155:            /**
156:             * Resolves schema definition file for taglib descriptor (spec.1_1, 1_2, 2_0)
157:             * @param publicId publicId for resolved entity (null in our case)
158:             * @param systemId systemId for resolved entity
159:             * @return InputSource for publisId, 
160:             */
161:            public org.xml.sax.InputSource resolveEntity(String publicId,
162:                    String systemId) throws org.xml.sax.SAXException,
163:                    java.io.IOException {
164:                if (JSF_ID_1_0.equals(publicId)) {
165:                    return new org.xml.sax.InputSource(URL_JSF_1_0);
166:                } else if (JSF_ID_1_1.equals(publicId)) {
167:                    return new org.xml.sax.InputSource(URL_JSF_1_1);
168:                } else if (JSF_1_2.equals(systemId)) {
169:                    return new org.xml.sax.InputSource(URL_JSF_1_2);
170:                } else if (systemId != null && systemId.endsWith(JSF_1_2_XSD)) {
171:                    return new org.xml.sax.InputSource(URL_JSF_1_2);
172:                } else {
173:                    return null;
174:                }
175:            }
176:
177:            /**
178:             * Get registered URI for the given name or null if not registered.
179:             * @return null if not registered
180:             */
181:            public String resolveURI(String name) {
182:                return null;
183:            }
184:
185:            /**
186:             * Get registered URI for the given publicId or null if not registered.
187:             * @return null if not registered
188:             */
189:            public String resolvePublic(String publicId) {
190:                return null;
191:            }
192:
193:            public static JSFVersion extractVersion(Document document) {
194:                // first check the doc type to see if there is one
195:                DocumentType dt = document.getDoctype();
196:                JSFVersion value = JSFVersion.JSF_1_0;
197:                // This is the default version
198:                if (dt != null) {
199:                    if (JSF_ID_1_0.equals(dt.getPublicId())) {
200:                        value = JSFVersion.JSF_1_0;
201:                    }
202:                    if (JSF_ID_1_1.equals(dt.getPublicId())) {
203:                        value = JSFVersion.JSF_1_1;
204:                    }
205:                    if (JSF_ID_1_2.equals(dt.getPublicId())) {
206:                        value = JSFVersion.JSF_1_2;
207:                    }
208:                }
209:                return value;
210:
211:            }
212:
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.