Source Code Cross Referenced for LinkGatherer.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » sitemap » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.sitemap 
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.cocoon.sitemap;
018:
019:        import org.apache.avalon.framework.parameters.Parameters;
020:        import org.apache.cocoon.ProcessingException;
021:        import org.apache.cocoon.Constants;
022:        import org.apache.cocoon.caching.CacheableProcessingComponent;
023:        import org.apache.cocoon.environment.SourceResolver;
024:        import org.apache.cocoon.transformation.Transformer;
025:        import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
026:
027:        import org.apache.excalibur.source.SourceValidity;
028:
029:        import org.xml.sax.Attributes;
030:        import org.xml.sax.SAXException;
031:
032:        import java.io.IOException;
033:        import java.util.List;
034:        import java.util.Map;
035:
036:        /**
037:         * @author <a href="mailto:uv@upaya.co.uk">Upayavira</a>
038:         * @version CVS $Id: LinkGatherer.java 433543 2006-08-22 06:22:54Z crossley $
039:         */
040:        public class LinkGatherer extends ExtendedXLinkPipe implements 
041:                Transformer, CacheableProcessingComponent {
042:            private List links;
043:
044:            /**
045:             * Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
046:             * the source and sitemap <code>Parameters</code> used to process the request.
047:             */
048:            public void setup(SourceResolver resolver, Map objectModel,
049:                    String src, Parameters par) throws ProcessingException,
050:                    SAXException, IOException {
051:                this .links = (List) objectModel
052:                        .get(Constants.LINK_COLLECTION_OBJECT);
053:            }
054:
055:            /**
056:             * Generate the unique key.
057:             * This key must be unique inside the space of this component.
058:             *
059:             * @return The generated key hashes the src
060:             */
061:            public java.io.Serializable getKey() {
062:                return "1";
063:            }
064:
065:            /**
066:             * Generate the validity object.
067:             *
068:             * @return The generated validity object or <code>null</code> if the
069:             *         component is currently not cacheable.
070:             */
071:            public SourceValidity getValidity() {
072:                //      Whilst the cache does not store gathered links, this component must be non-cacheable
073:                //      return NOPValidity.SHARED_INSTANCE;
074:                return null;
075:            }
076:
077:            public void simpleLink(String href, String role, String arcrole,
078:                    String title, String show, String actuate, String uri,
079:                    String name, String raw, Attributes attr)
080:                    throws SAXException {
081:                if (!this .links.contains(href)) {
082:                    this .addLink(href);
083:                }
084:                super .simpleLink(href, role, arcrole, title, show, actuate,
085:                        uri, name, raw, attr);
086:            }
087:
088:            public void startLocator(String href, String role, String title,
089:                    String label, String uri, String name, String raw,
090:                    Attributes attr) throws SAXException {
091:                if (!this .links.contains(href)) {
092:                    this .addLink(href);
093:                }
094:                super .startLocator(href, role, title, label, uri, name, raw,
095:                        attr);
096:            }
097:
098:            private void addLink(String href) {
099:                if (href.length() == 0)
100:                    return;
101:                if (href.charAt(0) == '#')
102:                    return;
103:                if (href.indexOf("://") != -1)
104:                    return;
105:                if (href.startsWith("mailto:"))
106:                    return;
107:                if (href.startsWith("news:"))
108:                    return;
109:                if (href.startsWith("javascript:"))
110:                    return;
111:
112:                int anchorPos = href.indexOf('#');
113:                if (anchorPos == -1) {
114:                    this .links.add(href);
115:                } else {
116:                    this .links.add(href.substring(0, anchorPos));
117:                }
118:            }
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.