Source Code Cross Referenced for CocoonToAvalonSource.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » components » source » impl » 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.components.source.impl 
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.components.source.impl;
018:
019:        import java.io.IOException;
020:        import java.io.InputStream;
021:        import java.util.Iterator;
022:
023:        import org.apache.avalon.excalibur.pool.Recyclable;
024:        import org.apache.cocoon.ProcessingException;
025:        import org.apache.cocoon.ResourceNotFoundException;
026:        import org.apache.cocoon.environment.ModifiableSource;
027:        import org.apache.excalibur.source.Source;
028:        import org.apache.excalibur.source.SourceException;
029:        import org.apache.excalibur.source.SourceNotFoundException;
030:        import org.apache.excalibur.source.SourceValidity;
031:        import org.apache.excalibur.source.impl.validity.TimeStampValidity;
032:        import org.apache.excalibur.xml.sax.XMLizable;
033:        import org.xml.sax.ContentHandler;
034:        import org.xml.sax.SAXException;
035:
036:        /**
037:         * This source objects wraps an obsolete Cocoon Source object
038:         * to avoid recoding existing source objects.
039:         *
040:         * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
041:         * @version CVS $Id: CocoonToAvalonSource.java 433543 2006-08-22 06:22:54Z crossley $
042:         */
043:        public final class CocoonToAvalonSource implements  Source, XMLizable,
044:                Recyclable {
045:
046:            /** The real source */
047:            protected org.apache.cocoon.environment.Source source;
048:
049:            /** The protocol */
050:            protected String protocol;
051:
052:            /**
053:             * Constructor
054:             */
055:            public CocoonToAvalonSource(String location,
056:                    org.apache.cocoon.environment.Source source) {
057:                this .source = source;
058:                int pos = location.indexOf(':');
059:                this .protocol = location.substring(0, pos);
060:            }
061:
062:            /**
063:             * Return the protocol identifier.
064:             */
065:            public String getScheme() {
066:                return this .protocol;
067:            }
068:
069:            /**
070:             * @see org.apache.excalibur.source.Source#exists()
071:             */
072:            public boolean exists() {
073:                try {
074:                    this .getInputStream();
075:                    return true;
076:                } catch (Exception local) {
077:                    return false;
078:                }
079:            }
080:
081:            /**
082:             * Return an <code>InputStream</code> object to read from the source.
083:             */
084:            public InputStream getInputStream() throws IOException,
085:                    SourceException {
086:                try {
087:                    return this .source.getInputStream();
088:                } catch (ResourceNotFoundException rnfe) {
089:                    throw new SourceNotFoundException("Source not found.", rnfe);
090:                } catch (ProcessingException pe) {
091:                    throw new SourceException("ProcessingException", pe);
092:                }
093:            }
094:
095:            /**
096:             * Return the unique identifer for this source
097:             */
098:            public String getURI() {
099:                return this .source.getSystemId();
100:            }
101:
102:            /**
103:             *  Get the Validity object. This can either wrap the last modification
104:             *  date or the expires information or...
105:             *  If it is currently not possible to calculate such an information
106:             *  <code>null</code> is returned.
107:             */
108:            public SourceValidity getValidity() {
109:                if (this .source.getLastModified() > 0) {
110:                    return new TimeStampValidity(this .source.getLastModified());
111:                }
112:                return null;
113:            }
114:
115:            /**
116:             * Refresh this object and update the last modified date
117:             * and content length.
118:             */
119:            public void refresh() {
120:                if (this .source instanceof  ModifiableSource) {
121:                    ((ModifiableSource) this .source).refresh();
122:                }
123:            }
124:
125:            /**
126:             * The mime-type of the content described by this object.
127:             * If the source is not able to determine the mime-type by itself
128:             * this can be null.
129:             */
130:            public String getMimeType() {
131:                return null;
132:            }
133:
134:            /**
135:             * Stream content to the content handler
136:             */
137:            public void toSAX(ContentHandler contentHandler)
138:                    throws SAXException {
139:                this .source.toSAX(contentHandler);
140:            }
141:
142:            /**
143:             * Recyclable
144:             */
145:            public void recycle() {
146:                this .source.recycle();
147:            }
148:
149:            /**
150:             * Return the content length of the content or -1 if the length is
151:             * unknown
152:             */
153:            public long getContentLength() {
154:                return this .source.getContentLength();
155:            }
156:
157:            /**
158:             * Get the last modification date of the source or 0 if it
159:             * is not possible to determine the date.
160:             */
161:            public long getLastModified() {
162:                return this .source.getLastModified();
163:            }
164:
165:            /**
166:             * Get the value of a parameter.
167:             * Using this it is possible to get custom information provided by the
168:             * source implementation, like an expires date, HTTP headers etc.
169:             */
170:            public String getParameter(String name) {
171:                return null;
172:            }
173:
174:            /**
175:             * Get the value of a parameter.
176:             * Using this it is possible to get custom information provided by the
177:             * source implementation, like an expires date, HTTP headers etc.
178:             */
179:            public long getParameterAsLong(String name) {
180:                return 0;
181:            }
182:
183:            /**
184:             * Get parameter names
185:             * Using this it is possible to get custom information provided by the
186:             * source implementation, like an expires date, HTTP headers etc.
187:             */
188:            public Iterator getParameterNames() {
189:                return java.util.Collections.EMPTY_LIST.iterator();
190:            }
191:
192:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.