1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Copyright: 2000 Regents of the University of California and the
|
4
|
* National Center for Ecological Analysis and Synthesis
|
5
|
*
|
6
|
* '$Author: tao $'
|
7
|
* '$Date: 2003-09-02 17:00:38 -0700 (Tue, 02 Sep 2003) $'
|
8
|
* '$Revision: 1808 $'
|
9
|
*
|
10
|
* This program is free software; you can redistribute it and/or modify
|
11
|
* it under the terms of the GNU General Public License as published by
|
12
|
* the Free Software Foundation; either version 2 of the License, or
|
13
|
* (at your option) any later version.
|
14
|
*
|
15
|
* This program is distributed in the hope that it will be useful,
|
16
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
* GNU General Public License for more details.
|
19
|
*
|
20
|
* You should have received a copy of the GNU General Public License
|
21
|
* along with this program; if not, write to the Free Software
|
22
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
*/
|
24
|
|
25
|
package edu.ucsb.nceas.metacat.stringclient.impl;
|
26
|
|
27
|
/**
|
28
|
* This interface provides methods for initializing and logging in to a
|
29
|
* Metacat server, and then querying, reading, transforming, inserting,
|
30
|
* updating and deleting documents from that server.
|
31
|
*/
|
32
|
public interface MetacatString
|
33
|
{
|
34
|
/**
|
35
|
* Method used to log in to a metacat server. Implementations will need
|
36
|
* to cache a cookie value to make the session persistent. Each time a
|
37
|
* call is made to one of the other methods (e.g., read), the cookie will
|
38
|
* need to be passed back to the metacat server along with the request.
|
39
|
*
|
40
|
* @param username the username of the user, like an LDAP DN
|
41
|
* @param password the password for that user for authentication
|
42
|
*/
|
43
|
public void login(String username, String password);
|
44
|
|
45
|
/**
|
46
|
* Method used to log out a metacat server. When Metacat server will end
|
47
|
* the session when this call is invoken.
|
48
|
*
|
49
|
* @throws MetacatInaccessibleException when the metacat server can not be
|
50
|
* reached or does not respond
|
51
|
*/
|
52
|
public void logout();
|
53
|
|
54
|
/**
|
55
|
* Read an XML document from the metacat server session, accessed by docid,
|
56
|
* and returned as a String.
|
57
|
*
|
58
|
* @param docid the identifier of the document to be read
|
59
|
* @return a String for accessing the document
|
60
|
*/
|
61
|
public String read(String docid);
|
62
|
|
63
|
/**
|
64
|
* Query the metacat document store with the given metacat-compatible
|
65
|
* query document, and return the result set as a String
|
66
|
*/
|
67
|
public String query(String xmlQuery);
|
68
|
|
69
|
/**
|
70
|
* Insert an XML document into the repository.
|
71
|
*
|
72
|
* @param docid the docid to insert the document
|
73
|
* @param xmlDocument a String for accessing the XML document to be inserted
|
74
|
* @param schema a String for accessing the DTD or XML Schema for
|
75
|
* the document
|
76
|
* @return the metacat response message
|
77
|
*/
|
78
|
public String insert(String docid, String xmlDocument, String schema);
|
79
|
|
80
|
/**
|
81
|
* Update an XML document in the repository.
|
82
|
*
|
83
|
* @param docid the docid to update
|
84
|
* @param xmlDocument a String for accessing the XML text to be updated
|
85
|
* @param schema a String for accessing the DTD or XML Schema for
|
86
|
* the document
|
87
|
* @return the metacat response message
|
88
|
*/
|
89
|
public String update(String docid, String xmlDocument, String schema);
|
90
|
|
91
|
/**
|
92
|
* Delete an XML document in the repository.
|
93
|
*
|
94
|
* @param docid the docid to delete
|
95
|
* @return the metacat response message
|
96
|
* @throws InsufficientKarmaException when the user has insufficent rights
|
97
|
* for the operation
|
98
|
* @throws MetacatInaccessibleException when the metacat server can not be
|
99
|
* reached or does not respond
|
100
|
* @throws MetacatException when the metacat server generates another error
|
101
|
*/
|
102
|
public String delete(String docid);
|
103
|
|
104
|
/**
|
105
|
* When the MetacatFactory creates an instance it needs to set the
|
106
|
* MetacatUrl to which connections should be made.
|
107
|
*
|
108
|
* @param metacatUrl the URL for the metacat server
|
109
|
*/
|
110
|
public void setMetacatUrl(String metacatUrl);
|
111
|
}
|