1
2
3
4
5
6
7 package org.astrogrid.slinger.sources;
8
9
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.io.Reader;
13 import java.security.Principal;
14
15 /***
16 * Indicates anything that can be resolved into an inputstream, or an input reader
17 * <p>
18 * Essentially TargetIndicators provide a suitably typed and validated way of
19 * passing around where things might come from, rather than having to pass around
20 * Strings to indicate Identifiers, and separate methods to handle Readers/Streams.
21 *
22 */
23
24 public interface SourceIdentifier {
25
26
27 /*** All targets must be able to resolve to a reader. The user is required
28 * for permissions */
29 public Reader resolveReader(Principal user) throws IOException;
30
31 /*** All targets must be able to resolve to a stream. The user is required
32 * for permissioning. */
33 public InputStream resolveInputStream(Principal user) throws IOException;
34
35 /*** Used to get the mime type of the data about to be read. Note that many
36 * implementations (such as disk files?) do not have this
37 * capability, and so often this will
38 * do nothing. */
39 public String getMimeType(Principal user) throws IOException;
40 }
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55