1 /*
2 * Copyright 2004 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.nordija.tapestry.bayeux.stream;
17
18 import org.apache.tapestry.IRequestCycle;
19
20 import java.io.IOException;
21
22 import com.nordija.tapestry.bayeux.stream.StreamResource;
23
24 /**
25 * A source for resources that can be downloaded by the bayeux downloads service.
26 * <p/>
27 * An implementation of this interface must be configured in the application using the
28 * bayeux downloads service as an extension.
29 * The downloads service will ask the defined implementation for a resource based on an
30 * id when links are clicked.
31 *
32 * @see com.nordija.tapestry.bayeux.stream.StreamService
33 * @author Per Olesen www.nordija.com
34 * @version $Id: StreamResourceSource.java 119 2007-06-01 12:46:54Z jeyben $
35 */
36 public interface StreamResourceSource {
37
38 /**
39 * Called by downloads service when a download link has been clicked
40 * and the resource to be downloaded is to be obtained from somewhere.
41 *
42 * @param cycle the request cycle which originated the incoming request for a download resource
43 * @param parameters the parameters used to find and generate the needed stream resource
44 * @return an instance of the resource identified by the given id or null if resource not found
45 * @throws IOException if obtaining the resource fails with an exception (no resource on id should not result in this exception!)
46 */
47 StreamResource getStreamResource(IRequestCycle cycle, Object[] parameters) throws IOException;
48 }