source: other-projects/trunk/gs3-webservices-democlient/src/GS3Fedora/org/greenstone/fedora/services/FedoraToGS3Interface.java@ 15222

Last change on this file since 15222 was 15222, checked in by ak19, 16 years ago

Greenstone3 web services demo-clientadded to GS3's other-projects

File size: 15.1 KB
Line 
1/**
2 *#########################################################################
3 * FedoraToGS3Interface.java - works with the demo-client for Greenstone 3,
4 * of the Greenstone digital library suite from the New Zealand Digital
5 * Library Project at the * University of Waikato, New Zealand.
6 * <BR><BR>
7 * Copyright (C) 2008 New Zealand Digital Library Project
8 * <BR><BR>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 * <BR><BR>
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *########################################################################
19 */
20
21package org.greenstone.fedora.services;
22
23import java.util.Map;
24
25
26/**
27 * The following methods return the same data as FedoraGS3DL, but formatted as
28 * Greenstone Response-Message XML. This way our java-client can parse
29 * the returned XML in the same way and store them in the same datastructures.
30 * @author ak19
31*/
32public interface FedoraToGS3Interface // extends FedoraGS3DL
33{
34 /** Interface declaring some string constants of literals to look for */
35 public interface Constants {
36 public static final String GS3FilePathMacro = "_httpdocimg_";
37 /** Prefix of the (img) files associated with Greenstone documents
38 * in the Fedora repository */
39 public static final String ASSOCFILEPREFIX = "FG";
40
41 /** names of query form controls */
42 public static final String MAXDOCS = "maxDocs";
43 public static final String QUERY = "query";
44 public static final String SIMPLEFIELD_ATT = "simpleField";
45 public static final String OCCURS_ATT = "occurs";
46 public static final String FIELDNAME_ATT = "fieldName";
47 public static final String NUM_DOCS_MATCHED = "numDocsMatched";
48
49 /** Field search names and separator used externally */
50 public static final String ALL_FIELDS = "allFields";
51 public static final String DOC_TITLES = "docTitles"; // doc titles only
52 public static final String ALL_TITLES = "allTitles"; // all titles, section & doc
53 public static final String FULLTEXT = "fullText";
54 public static final String COMMA = ",";
55 }
56
57 /* DESCRIBE SERVICES */
58 /** @return a GS3 response message for a describe services request:
59 * indicating the list of services supported by the Fedora-Greenstone
60 * interface. These are DocumentContentRetrieve, DocumentMetadataRetrieve,
61 * DocumentStructureRetrieve, BrowseByLetter - as indicated by member
62 * variable serviceNames. */
63 public String getServiceList();
64
65 /** @return a GS3 describe response message listing the collections and
66 * collection-specific metadata stored in the Fedora-Greenstone repository. */
67 public String getCollectionList();
68
69 /** @return a GS3 describe response message for a collection in the
70 * Fedora-Greenstone repository.
71 * @param collectionName - the name of the collection that is to be described.
72 * It will be converted to a fedora collection pid, which is of the form
73 * "greenstone:&lt;collectionName&gt;-collection". */
74 public String describeCollection(String collectionName);
75
76 /** @return a GS3 describe response message for the services of a collection
77 * in the Fedora-Greenstone repository. So far, these services are the same for
78 * all fedora collections: they are the services given in member variable
79 * serviceNames: DocumentContent/Metadata/StructureRetrieve, browse.
80 * @param collectionName - the name of the collection whose services are to
81 * be described. It will be converted to a fedora collection pid, which is of
82 * the form "greenstone:&lt;collectionName&gt;-collection". */
83 public String describeCollectionServices(String collectionName);
84
85 /**
86 * All collections in this Digital Library (Fedora Repository) share
87 * the same services, so this method returns the same as
88 * describeService(serviceName).
89 * @return a GS3 describe response message for the requested service
90 * of the given collection. DocumentContent/Metadata/StructureRetrieve
91 * return nothing special except their names; browse (and any query)
92 * return more complex XML responses.
93 * @param collectionName - the name of the collection whose service is to
94 * be described. It will be converted to a fedora collection pid, which is of
95 * the form "greenstone:&lt;collectionName&gt;-collection".
96 * @param serviceName - the name of the service in the collection which is to
97 * be described. */
98 public String describeCollectionService(String collectionName,
99 String serviceName);
100
101 /** All collections in this Digital Library (Fedora Repository) share
102 * the same services, so this method returns the same as
103 * describeCollectionService(collName, serviceName).
104 * @return a GS3 describe response message for the requested service
105 * of the given collection. DocumentContent/Metadata/StructureRetrieve
106 * return nothing special except their names; browse (and any query)
107 * return more complex XML responses.
108 * All collections in this Digital Library (Fedora Repository) share
109 * the same services, so this method returns the same as
110 * describeService(serviceName).
111 * @param serviceName - the name of the service in the collection which is to
112 * be described.*/
113 public String describeService(String serviceName);
114
115 /* RETRIEVE SERVICE: DOCUMENT CONTENT RETRIEVE */
116
117 /** Given a list of document identifiers that are either docPIDs or
118 * concatenations of docPID+sectionID, this method retrieves their contents.
119 * @param docID is expected to be of the form
120 * "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-&lt;sectionNumber&gt;" or
121 * "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;"
122 * If it is "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;", then the content for
123 * "greenstone:&lt;collectionName&gt;-1" ("greenstone:&lt;collectionName&gt;-Section1")
124 * is returned. */
125 public String getContent(String docID);
126
127 /** Given a document identifier that is either a docPID or a concatenation
128 * of docPID+sectionID, this method retrieves the content for it.
129 * @param docIDs an array of document IDs where each is expected to be of the
130 * form "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-&lt;sectionNumber&gt;"
131 * or "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;"
132 * If it is "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;", then the content for
133 * "greenstone:&lt;collectionName&gt;-1" ("greenstone:&lt;collectionName&gt;-Section1")
134 * is returned. */
135 public String getContent(String[] docIDs);
136
137 /* RETRIEVE SERVICE: DOCUMENT STRUCTURE RETRIEVE */
138
139 /** @return the documentStructure of the document or section given by docID.
140 * The structure is returned in the XML format of a Greenstone3
141 * DocumentStructureRetrieve response message. This method returns the entire
142 * subSection of the docID (that is, all descendents included).
143 * @param docID the identifier for the document whose structure is required.
144 * This is either of the format "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;"
145 * OR "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-"
146 * where "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-1" is the same as
147 * "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;" and will return the same response */
148 public String getDocumentStructure(String docID);
149
150 /** @return a view of the structure of the document or section given by docID
151 * which contains only the section and its direct children. This structure is
152 * returned in the XML format of a Greenstone3 DocumentStructureRetrieve
153 * response message.
154 * @param docID the identifier for the document whose structure is required.
155 * This is of the format "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;"
156 * OR "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-"
157 * where "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-1" is the same as
158 * "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;" and will return the same response */
159 public String getChildren(String docID);
160
161 /** @return the documentStructure of the documents or sections given by docIDs.
162 * The structure is returned in the XML format of a Greenstone3
163 * DocumentStructureRetrieve response message. This method returns the entire
164 * subSection of each docID (that is, all descendents included).
165 * @param docIDs an array of document identifiers whose structures are requested
166 * These are of the format "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;"
167 * OR "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-&lt;sectionNumber&gt;"
168 * where "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-1" is the same as
169 * "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;" and will return the same response */
170 public String getDocumentStructure(String[] docIDs);
171
172 /** @return the documentStructure of the documents or sections given by docIDs
173 * but only the sections and their children (not any further descendents).
174 * The structure is returned in the XML format of a Greenstone3
175 * DocumentStructureRetrieve response message.
176 * @param docIDs an array of document identifiers whose structures are requested
177 * These are of the format "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;"
178 * OR "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-&lt;sectionNumber&gt;"
179 * where "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;-1" is the same as
180 * "greenstone:&lt;collectionName&gt;-&lt;docPID&gt;" and will return the same response */
181 public String getChildren(String[] docIDs);
182
183
184 /* RETRIEVE SERVICE: DOCUMENT METADATA RETRIEVE */
185
186 /** Given a list of collectionIDs, returns a GS3 DocumentMetadataRetrieve
187 * response message that gives the metadata for each collection identified
188 * @param collIDs is an array of fedora pids identifying collections in the
189 * fedora repository
190 * @return a GS3 DocumentMetadataRetrieve response message containing the
191 * EX metadata for all the requested collections */
192 public String getCollectionMetadata(String[] collIDs);
193
194 /** Given a list of document identifiers, a GS3 DocumentMetadataRetrieve
195 * response message is returned containing the metadata for each document.
196 * @param docIDs is an array of document identifiers (docID can either be &lt;pid&gt;s
197 * items (documents) in the fedora repository, or "&lt;pid&gt;-sectionNumber".
198 * @return a GS3 DocumentMetadataRetrieve response message containing the
199 * EX, DC, DLS metadata for all the requested documents */
200 public String getDocumentMetadata(String[] docIDs);
201
202 /** Given a collectionID, returns a GS3 DocumentMetadataRetrieve
203 * response message that gives the metadata for the collection identified
204 * @param collID is a fedora pid identifying a collection in its repository
205 * @return a GS3 DocumentMetadataRetrieve response message containing the
206 * EX metadata for the requested collection */
207 public String getCollectionMetadata(String collID);
208
209 /** Given a document identifier, returns a GS3 DocumentMetadataRetrieve
210 * response message containing the metadata for the document.
211 * @param docID is a document identifier (docID can either be a &lt;pid&gt;
212 * of an item (document) in the fedora repository, or it can be
213 * "&lt;pid&gt;-sectionNumber".
214 * @return a GS3 DocumentMetadataRetrieve response message containing the
215 * EX, DC, DLS metadata for all the requested document */
216 public String getDocumentMetadata(String docID);
217
218 /** @return a greenstone DocumentMetadataRetrieve response for the
219 * documents or collections indicated by the docIDsOrCollIDs.
220 * @param docIDsOrCollIDs is an array of identifiers which may be either the
221 * fedora pids for collections, or otherwise may be a document identifier.
222 * In the last case, the document ID may consist of either
223 * "documentPID-sectionNumber" or may just be just fedora documentPID */
224 public String getMetadata(String[] docIDsOrCollIDs);
225
226 /** Given a document identifier, returns a GS3 DocumentMetadataRetrieve
227 * response message containing ONLY the Title metadata for the document.
228 * @param docID is a document identifier (docID can either be a &lt;pid&gt;
229 * of an item (document) in the fedora repository, or it can be
230 * "&lt;pid&gt;-sectionNumber".
231 * @return a GS3 DocumentMetadataRetrieve response message containing the
232 * Title metadata for the requested document */
233 public String getTitleMetadata(String docID);
234
235 /** Given a document identifier, returns a GS3 DocumentMetadataRetrieve
236 * response message containing ONLY the Title metadata for the documents.
237 * @param docIDs is a list of document identifiers (where docID can either be
238 * a &lt;pid&gt; of an item (document) in the fedora repository, or it can be
239 * "&lt;pid&gt;-sectionNumber".
240 * @return a GS3 DocumentMetadataRetrieve response message containing the
241 * Title metadata for all the requested documents */
242 public String getTitleMetadata(String[] docIDs);
243
244 /* BROWSE AND QUERY SERVICES */
245
246 /** This method performs something equivalent to a greenstone3
247 * ClassifierBrowseMetadataRetrieve on the classifierNodeIDs
248 * @param classNodeIDs are the IDs of the classifierNode for which the metadata
249 * needs to be returned
250 * @return a GS3 ClassifierBrowseMetadataRetrieve response message which
251 * lists the metadata for all the classifierNodes passed as parameter.*/
252 public String browseMetadataRetrieve(String[] classNodeIDs);
253
254 /** This method performs the implemented browse operation: allowing the
255 * user to browse the titles of documents in the given collection by letter
256 * and returning the results.
257 * @param classifierID is the id of the classifier on which to browse. In
258 * this case, the classifier indicates whether we browse titles by letter, or
259 * browse (documents) by collection; and it is of the form &lt;CL(letter)&gt;.
260 * @param collectionName is the name of the collection whose documents
261 * starting with the given letter will be returned.
262 * @return a GS3 DocumentStructureRetrieve response message which lists all
263 * the documents that start with the letter indicated by parameter classifier.
264 */
265 public String browse(String collectionName, String classifierID);
266
267 /* @returns the document identifiers returned for a search on the titles of
268 * documents that contain the given term in their title */
269 //public String queryTitle(String termInTitle) throws Exception;
270
271 /** @return a String representing Greenstone3 XML for a query process
272 * response returning the results for the query denoted by parameter
273 * nameValParamsMap.
274 * @param nameValParamsMap is a Map of name and value pairs for all the
275 * query field data values. The names match the field names that
276 * describeCollectionService() would have returned for the query service.
277 * @param collection is the name of the collection
278 * @param service is the name of the query service
279 * This method is only ever called when any of the services in the digital
280 * library described themselves as type=query. Therefore any digital
281 * libraries that have no query services, can just return emtpy message
282 * strings (or even "") since this method will never be called on them
283 * anyway. */
284 public String query(String collection, String service,
285 Map nameValParamsMap);
286}
Note: See TracBrowser for help on using the repository browser.