1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.applications.parameter.protocol;
12
13 import java.io.File;
14 import java.io.InputStream;
15 import java.io.OutputStream;
16
17 /*** Interface for working with a value that is 'external' - ie probably not in this JVM. May be in local storage, may be remote.
18 * <p>
19 * Because of this vagueness, the interface provides the bare minimum for working with the external value.
20 * @TODO rename the methods in this interface so that the imply opening a stream rather than reading and writing...
21 * @TODO add method to copyto local file - to take advantage of any any secialization that the protocol might have to do this...then the paramter adapters should be rewritten to use this. (also exportFrom & getURL)
22 * @TODO would be nice to have a string returning the "location" value also
23 * @author Noel Winstanley nw@jb.man.ac.uk 16-Jun-2004
24 * @author Paul Harrison (pah@jb.man.ac.uk)
25 *
26 */
27 public interface ExternalValue {
28 /*** access a stream to read the contents of the external value from
29 * @return an input stream containing the content of the external value
30 * @throws InaccessibleExternalValueException*/
31 InputStream read() throws InaccessibleExternalValueException;
32 /*** access a stream to write the contents of the external value to
33 * @return an output stream.
34 * @throws InaccessibleExternalValueException*/
35 OutputStream write() throws InaccessibleExternalValueException;
36
37 /***
38 * Copy the contents of the external value to a file. This method can take advantage of any specializations that the protocol might have.
39 * @param f The file to which the contents of the externalValue should be copied.
40 * @return file that it has copied to - this might not be the file requested for efficiencies' sake
41 * @throws InaccessibleExternalValueException
42
43 File importTo(File f) throws InaccessibleExternalValueException;
44 */
45 }
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80