01: /* Copyright 2003 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal;
07:
08: import java.io.IOException;
09: import java.io.InputStream;
10: import java.io.OutputStream;
11: import java.util.Map;
12:
13: /**
14: * Internal adapter for a multithreaded character channel that is also
15: * cacheable and implements IMimeResponse (capable of using DonwloadWorker)
16: * @author <a href="mailto:nbolton@unicon.net">Nick Bolton</a>
17: * @version $Revision: 34812 $
18: * @see MultithreadedCacheableChannelAdapter
19: */
20: public class MultithreadedCacheableMimeResponseCharacterChannelAdapter
21: extends MultithreadedCacheableCharacterChannelAdapter implements
22: IMimeResponse {
23: public MultithreadedCacheableMimeResponseCharacterChannelAdapter(
24: IMultithreadedCharacterChannel channel, String uid)
25: throws PortalException {
26: super (channel, uid);
27: if (!(channel instanceof IMultithreadedMimeResponse)) {
28: throw (new PortalException(
29: "MultithreadedCacheableMimeResponseChannelAdapter: Cannot adapt "
30: + channel.getClass().getName()));
31: }
32: }
33:
34: public String getContentType() {
35: return ((IMultithreadedMimeResponse) channel)
36: .getContentType(uid);
37: }
38:
39: public InputStream getInputStream() throws IOException {
40: return ((IMultithreadedMimeResponse) channel)
41: .getInputStream(uid);
42: }
43:
44: public void downloadData(OutputStream out) throws IOException {
45: ((IMultithreadedMimeResponse) channel).downloadData(out, uid);
46: }
47:
48: public String getName() {
49: return ((IMultithreadedMimeResponse) channel).getName(uid);
50: }
51:
52: public Map getHeaders() {
53: return ((IMultithreadedMimeResponse) channel).getHeaders(uid);
54: }
55:
56: public void reportDownloadError(Exception e) {
57: ((IMultithreadedMimeResponse) channel).reportDownloadError(e);
58: }
59: }
|