Source Code Cross Referenced for MockEnvironment.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » environment » mock » 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.environment.mock 
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.environment.mock;
018:
019:        import java.io.ByteArrayOutputStream;
020:        import java.io.IOException;
021:        import java.io.OutputStream;
022:        import java.net.MalformedURLException;
023:        import java.util.Enumeration;
024:        import java.util.HashMap;
025:        import java.util.Hashtable;
026:        import java.util.Map;
027:
028:        import junit.framework.AssertionFailedError;
029:
030:        import org.apache.cocoon.ProcessingException;
031:        import org.apache.cocoon.environment.Environment;
032:        import org.apache.cocoon.environment.Source;
033:        import org.apache.excalibur.source.SourceResolver;
034:        import org.xml.sax.ContentHandler;
035:        import org.xml.sax.SAXException;
036:
037:        /* @version $Id: MockEnvironment.java 433543 2006-08-22 06:22:54Z crossley $ */
038:        public class MockEnvironment implements  Environment {
039:
040:            private SourceResolver resolver;
041:
042:            private String uri;
043:            private String uriprefix;
044:            private String rootcontext;
045:            private String context;
046:            private String view;
047:            private String action;
048:            private String contenttype;
049:            private int contentlength;
050:            private int status;
051:            private ByteArrayOutputStream outputstream;
052:            private HashMap objectmodel;
053:            private Hashtable attributes = new Hashtable();
054:
055:            public MockEnvironment(SourceResolver resolver) {
056:                this .resolver = resolver;
057:            }
058:
059:            public String getURI() {
060:                return uri;
061:            }
062:
063:            public String getURIPrefix() {
064:                return uriprefix;
065:            }
066:
067:            public String getRootContext() {
068:                return rootcontext;
069:            }
070:
071:            public String getContext() {
072:                return context;
073:            }
074:
075:            public String getView() {
076:                return view;
077:            }
078:
079:            public String getAction() {
080:                return action;
081:            }
082:
083:            public void setContext(String prefix, String uri, String context) {
084:                throw new AssertionFailedError("Not implemented");
085:            }
086:
087:            public void changeContext(String uriprefix, String context)
088:                    throws Exception {
089:                throw new AssertionFailedError("Not implemented");
090:            }
091:
092:            public void redirect(boolean sessionmode, String url)
093:                    throws IOException {
094:                throw new AssertionFailedError(
095:                        "Use Redirector.redirect instead!");
096:            }
097:
098:            public void setContentType(String contenttype) {
099:                this .contenttype = contenttype;
100:            }
101:
102:            public String getContentType() {
103:                return contenttype;
104:            }
105:
106:            public void setContentLength(int length) {
107:                this .contentlength = length;
108:            }
109:
110:            public int getContentLength() {
111:                return contentlength;
112:            }
113:
114:            public void setStatus(int statusCode) {
115:                this .status = statusCode;
116:            }
117:
118:            public int getStatus() {
119:                return status;
120:            }
121:
122:            /**
123:             * Get the output stream where to write the generated resource.
124:             * @deprecated Use {@link #getOutputStream(int)} instead.
125:             */
126:            public OutputStream getOutputStream() throws IOException {
127:                return getOutputStream(-1);
128:            }
129:
130:            public OutputStream getOutputStream(int bufferSize)
131:                    throws IOException {
132:                outputstream = new ByteArrayOutputStream();
133:                return outputstream;
134:            }
135:
136:            public byte[] getOutput() {
137:                return outputstream.toByteArray();
138:            }
139:
140:            public Map getObjectModel() {
141:                return objectmodel;
142:            }
143:
144:            public boolean isResponseModified(long lastModified) {
145:                throw new AssertionFailedError("Not implemented");
146:            }
147:
148:            public void setResponseIsNotModified() {
149:                throw new AssertionFailedError("Not implemented");
150:            }
151:
152:            public void setAttribute(String name, Object value) {
153:                attributes.put(name, value);
154:            }
155:
156:            public Object getAttribute(String name) {
157:                return attributes.get(name);
158:            }
159:
160:            public void removeAttribute(String name) {
161:                attributes.remove(name);
162:            }
163:
164:            public Enumeration getAttributeNames() {
165:                return attributes.keys();
166:            }
167:
168:            public boolean tryResetResponse() throws IOException {
169:                throw new AssertionFailedError("Not implemented");
170:            }
171:
172:            public void commitResponse() throws IOException {
173:                throw new AssertionFailedError("Not implemented");
174:            }
175:
176:            public void startingProcessing() {
177:                throw new AssertionFailedError("Not implemented");
178:            }
179:
180:            public void finishingProcessing() {
181:                throw new AssertionFailedError("Not implemented");
182:            }
183:
184:            public Source resolve(String systemID) throws ProcessingException,
185:                    SAXException, IOException {
186:
187:                throw new AssertionFailedError(
188:                        "Not not use deprecated methods!");
189:            }
190:
191:            public void toSAX(org.apache.excalibur.source.Source source,
192:                    ContentHandler handler) throws SAXException, IOException,
193:                    ProcessingException {
194:
195:                throw new AssertionFailedError(
196:                        "Not not use deprecated methods!");
197:            }
198:
199:            public void toSAX(org.apache.excalibur.source.Source source,
200:                    String mimeTypeHint, ContentHandler handler)
201:                    throws SAXException, IOException, ProcessingException {
202:
203:                throw new AssertionFailedError(
204:                        "Not not use deprecated methods!");
205:            }
206:
207:            public org.apache.excalibur.source.Source resolveURI(String location)
208:                    throws MalformedURLException, IOException,
209:                    org.apache.excalibur.source.SourceException {
210:
211:                return resolver.resolveURI(location);
212:            }
213:
214:            public org.apache.excalibur.source.Source resolveURI(
215:                    String location, String base, Map parameters)
216:                    throws MalformedURLException, IOException,
217:                    org.apache.excalibur.source.SourceException {
218:
219:                return resolver.resolveURI(location, base, parameters);
220:            }
221:
222:            /**
223:             * Releases a resolved resource
224:             */
225:            public void release(org.apache.excalibur.source.Source source) {
226:                resolver.release(source);
227:            }
228:
229:            /**
230:             * Always return <code>true</code>.
231:             */
232:            public boolean isExternal() {
233:                return true;
234:            }
235:
236:            /* (non-Javadoc)
237:             * @see org.apache.cocoon.environment.Environment#isInternRedirect()
238:             */
239:            public boolean isInternalRedirect() {
240:                return false;
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.