01: /* Copyright 2001 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 channel that is also cacheable and
15: * implements IMimeResponse (capable of using DonwloadWorker)
16: * @author Alex Vigdor
17: * @version $Revision: 34818 $
18: * @see MultithreadedCacheableChannelAdapter
19: */
20:
21: public class MultithreadedCacheableMimeResponseChannelAdapter extends
22: MultithreadedCacheableChannelAdapter implements IMimeResponse {
23:
24: public MultithreadedCacheableMimeResponseChannelAdapter(
25: IMultithreadedChannel channel, String uid)
26: throws PortalException {
27: super (channel, uid);
28: if (!(channel instanceof IMultithreadedMimeResponse)) {
29: throw (new PortalException(
30: "MultithreadedCacheableMimeResponseChannelAdapter: Cannot adapt "
31: + channel.getClass().getName()));
32: }
33: }
34:
35: public String getContentType() {
36: return ((IMultithreadedMimeResponse) channel)
37: .getContentType(uid);
38: }
39:
40: public InputStream getInputStream() throws IOException {
41: return ((IMultithreadedMimeResponse) channel)
42: .getInputStream(uid);
43: }
44:
45: public void downloadData(OutputStream out) throws IOException {
46: ((IMultithreadedMimeResponse) channel).downloadData(out, uid);
47: }
48:
49: public String getName() {
50: return ((IMultithreadedMimeResponse) channel).getName(uid);
51: }
52:
53: public Map getHeaders() {
54: return ((IMultithreadedMimeResponse) channel).getHeaders(uid);
55: }
56:
57: public void reportDownloadError(Exception e) {
58: ((IMultithreadedMimeResponse) channel).reportDownloadError(e);
59: }
60: }
|