Project

General

Profile

« Previous | Next » 

Revision 2240

Added by sgarg over 19 years ago

Added upload functionality to metacat client for upload online data

View differences:

Metacat.java
26 26

  
27 27
import java.io.Reader;
28 28
import java.io.IOException;
29
import java.io.File;
29 30

  
30 31
/**
31
 *  This interface provides methods for initializing and logging in to a 
32
 *  Metacat server, and then querying, reading, transforming, inserting, 
32
 *  This interface provides methods for initializing and logging in to a
33
 *  Metacat server, and then querying, reading, transforming, inserting,
33 34
 *  updating and deleting documents from that server.
34 35
 */
35 36
public interface Metacat
......
46 47
     *  @throws MetacatAuthException when the username/password could
47 48
     *                    not be authenticated
48 49
     */
49
    public String login(String username, String password) 
50
    public String login(String username, String password)
50 51
           throws MetacatAuthException, MetacatInaccessibleException;
51
    
52

  
52 53
    /**
53 54
     *  Method used to log out a metacat server. The Metacat server will end
54 55
     *  the session when this call is invoked.
......
57 58
     *  @throws MetacatInaccessibleException when the metacat server can not be
58 59
     *                                    reached or does not respond
59 60
     */
60
    public String logout() throws MetacatInaccessibleException, 
61
    public String logout() throws MetacatInaccessibleException,
61 62
        MetacatException;
62 63

  
63 64
    /**
......
66 67
     *
67 68
     * @param docid the identifier of the document to be read
68 69
     * @return a Reader for accessing the document
69
     * @throws InsufficientKarmaException when the user has insufficent rights 
70
     * @throws InsufficientKarmaException when the user has insufficent rights
70 71
     *                                    for the operation
71 72
     * @throws MetacatInaccessibleException when the metacat server can not be
72 73
     *                                    reached or does not respond
......
76 77
        MetacatInaccessibleException, MetacatException;
77 78

  
78 79
    /**
79
     * Query the metacat document store with the given metacat-compatible 
80
     * Query the metacat document store with the given metacat-compatible
80 81
     * query document, and return the result set as a Reader.
81 82
     *
82 83
     * @param xmlQuery a Reader for accessing the XML version of the query
......
90 91
     *
91 92
     * @param docid the docid to insert the document
92 93
     * @param xmlDocument a Reader for accessing the XML document to be inserted
93
     * @param schema a Reader for accessing the DTD or XML Schema for 
94
     * @param schema a Reader for accessing the DTD or XML Schema for
94 95
     *               the document
95 96
     * @return the metacat response message
96
     * @throws InsufficientKarmaException when the user has insufficent rights 
97
     * @throws InsufficientKarmaException when the user has insufficent rights
97 98
     *                                    for the operation
98 99
     * @throws MetacatInaccessibleException when the metacat server can not be
99 100
     *                                    reached or does not respond
......
109 110
     *
110 111
     * @param docid the docid to update
111 112
     * @param xmlDocument a Reader for accessing the XML text to be updated
112
     * @param schema a Reader for accessing the DTD or XML Schema for 
113
     * @param schema a Reader for accessing the DTD or XML Schema for
113 114
     *               the document
114 115
     * @return the metacat response message
115
     * @throws InsufficientKarmaException when the user has insufficent rights 
116
     * @throws InsufficientKarmaException when the user has insufficent rights
116 117
     *                                    for the operation
117 118
     * @throws MetacatInaccessibleException when the metacat server can not be
118 119
     *                                    reached or does not respond
......
124 125
        MetacatInaccessibleException;
125 126

  
126 127
    /**
128
     * Upload an XML document into the repository.
129
     *
130
     * @param docid the docid to insert the document
131
     * @param xmlDocument a Reader for accessing the document to be inserted
132
     * @return the metacat response message
133
     * @throws InsufficientKarmaException when the user has insufficent rights
134
     *                                    for the operation
135
     * @throws MetacatInaccessibleException when the metacat server can not be
136
     *                                    reached or does not respond
137
     * @throws MetacatException when the metacat server generates another error
138
     * @throws IOException when there is an error reading the xml document
139
     */
140
    public String upload(String docid, File file)
141
        throws InsufficientKarmaException, MetacatException, IOException,
142
        MetacatInaccessibleException;
143

  
144
    /**
127 145
     * Delete an XML document in the repository.
128 146
     *
129 147
     * @param docid the docid to delete
130 148
     * @return the metacat response message
131
     * @throws InsufficientKarmaException when the user has insufficent rights 
149
     * @throws InsufficientKarmaException when the user has insufficent rights
132 150
     *                                    for the operation
133 151
     * @throws MetacatInaccessibleException when the metacat server can not be
134 152
     *                                    reached or does not respond
......
154 172
    public String getSessionId();
155 173

  
156 174
    /**
157
     * Set the session identifier for this session.  This identifier was 
158
     * previously established with a call to login.  To continue to use the 
175
     * Set the session identifier for this session.  This identifier was
176
     * previously established with a call to login.  To continue to use the
159 177
     * same session, set the session id before making a call to one of the
160 178
     * metacat access methods (e.g., read, query, insert, etc.).
161 179
     *

Also available in: Unified diff