source: other-projects/trunk/gs3-webservices-democlient/src/GS3DemoClient/org/greenstone/gs3client/dlservices/FedoraServicesAPIA.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: 9.1 KB
Line 
1/**
2 *#########################################################################
3 * FedoraServicesAPIA.java - part of 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.gs3client.dlservices;
22
23import java.util.Map;
24import org.greenstone.gs3client.data.DocumentNodeData;
25import org.greenstone.fedora.services.*;
26
27/**
28 * FedoraServicesAPIA implements DigitalLibraryServicesAPIA for enabling the
29 * Java-client to access a Fedora repository of Greenstone digital objects.
30 * This is made possible by its use of the FedoraGS3.jar file's functionality,
31 * as made available through the FedoraGS3Connection class.
32 * @author ak19
33*/
34public class FedoraServicesAPIA extends FedoraGS3Connection
35 implements DigitalLibraryServicesAPIA
36{
37 /** Default constructor */
38 public FedoraServicesAPIA() throws Exception {
39 super(DigitalLibraryServicesAPIA.propertiesFile);
40 }
41
42 /** @return the name of this digital library for displaying in the client */
43 public String getDisplayName() {
44 return "Fedora";
45 }
46
47 /** @return the directory path to the associated files of the given document
48 * node. For instance, the base url of a JEditorPane's HTML documents can be
49 * set to this. */
50 public String getAssocFileBaseURL(DocumentNodeData docNode) {
51 return super.getAssocFileBaseURL()
52 + super.getDocPIDFromDocID(docNode.nodeID) + "/";
53 }
54
55 /** @return Greenstone3 XML describe response message with information
56 * about collections contained and services (and any serviceRacks) supported
57 * by the Digital library. */
58 public String describe() {
59 return this.getCollectionList();
60 }
61
62 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
63 * containing all the metadata of all the documents indicated by docIDs
64 * @param collection is the name of the collection
65 * @param docIDs is an array of document identifiers of documents whose
66 * metadata is requested */
67 public String retrieveDocumentMetadata(String collection, String[] docIDs) {
68 return this.getDocumentMetadata(docIDs);
69 }
70
71 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
72 * containing all the metadata of the document denoted by docID
73 * @param collection is the name of the collection
74 * @param docID is the document identifier of the document whose metadata is
75 * requested */
76 public String retrieveDocumentMetadata(String collection, String docID) {
77 return this.getDocumentMetadata(docID);
78 }
79
80 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
81 * containing only the title metadata of the documents denoted by docIDs
82 * @param collection is the name of the collection
83 * @param docIDs is an array of document identifiers of documents whose titles
84 * are requested */
85 public String retrieveTitleMetadata(String collection, String[] docIDs) {
86 return this.getTitleMetadata(docIDs);
87 }
88
89 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
90 * containing only the title metadata of the document denoted by docID
91 * @param collection is the name of the collection
92 * @param docID is the document identifier of the document whose titles is
93 * requested */
94 public String retrieveTitleMetadata(String collection, String docID) {
95 return this.getTitleMetadata(docID);
96 }
97
98
99 /** @return a String representing Greenstone3 DocumentContentRetrieve XML
100 * containing the document contents of the documents indicated by docIDs
101 * @param collection is the name of the collection
102 * @param docIDs is an array of document identifiers of documents whose (text)
103 * contents are requested */
104 public String retrieveDocumentContent(String collection, String[] docIDs) {
105 return this.getContent(docIDs);
106 }
107
108 /** @return a String representing Greenstone3 DocumentContentRetrieve XML
109 * containing the document contents of the document indicated by docID
110 * @param collection is the name of the collection
111 * @param docID is the document identifier of the document whose (text)
112 * content is requested */
113 public String retrieveDocumentContent(String collection, String docID) {
114 return this.getContent(docID);
115 }
116
117 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
118 * containing the document structure of the documents indicated by docIDs:
119 * this means all their descendents
120 * @param collection is the name of the collection
121 * @param docIDs is an array of document identifiers of documents whose
122 * hierarchical structures are requested */
123 public String retrieveDocumentStructure(String collection, String[] docIDs) {
124 return this.getDocumentStructure(docIDs);
125 }
126
127 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
128 * containing the document structure of the document indicated by docID:
129 * this means all its descendents
130 * @param collection is the name of the collection
131 * @param docID is the document identifier of the document whose hierarchical
132 * structure is requested*/
133 public String retrieveDocumentStructure(String collection, String docID) {
134 return this.getDocumentStructure(docID);
135 }
136
137 // UNUSED by the client, but still a very useful method:
138 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
139 * containing a view of the document structure of the documents denoted by
140 * docs where only the requested documents and their direct children are
141 * returned.
142 * @param collection is the name of the collection
143 * @param docIDs is an array of document identifiers of documents whose
144 * hierarchical structures are requested */
145 public String retrieveDocumentChildren(String collection, String[] docIDs) {
146 return this.getChildren(docIDs);
147 }
148
149 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
150 * containing a view of the document structure of the document denoted by
151 * docID where only the document and its direct children are returned.
152 * @param collection is the name of the collection
153 * @param docID is the document identifier of the document whose hierarchical
154 * structure is requested */
155 public String retrieveDocumentChildren(String collection, String docID) {
156 return this.getChildren(docID);
157 }
158
159 /** @return a String representing Greenstone3 ClassifierBrowse XML
160 * giving the entire *structure* of the classification denoted by
161 * classifierID (including the structures of document descendents of
162 * the classifier).
163 * @param classifierID is of the form CL# where the number (#) marks
164 * out structured sections like CL1.1.3 or CL2
165 * @param collection is the name of the collection
166 * @param service is the name of the browse service (=ClassifierBrowse usually)
167 */
168 public String retrieveBrowseStructure(
169 String collection, String service, String classifierID)
170 {
171 return this.browse(collection, classifierID);
172 }
173
174 /** @return a String representing Greenstone3
175 * ClassifierBrowseMetadataRetrieve XML giving all the metadata for
176 * all the subclassifiers denoted by nodeIDs.
177 * @param nodeIDs is of the form CL#.# where the number (#) marks
178 * out structured sections like CL2.1.3. NodeIDs are generally subsections
179 * of top-level classifierNodes (CL#, e.g. CL3).
180 * @param collection is the name of the collection
181 * @param service is the name of the Browse's MetadataRetrieve service
182 * (usually the browse service is ClassifierBrowse, in which case it always
183 * has a retrieve service called ClassifierBrowseMetadataRetrieve) */
184 public String retrieveBrowseMetadata(
185 String collection, String service, String[] nodeIDs)
186 {
187 return this.browseMetadataRetrieve(nodeIDs);
188 }
189
190 /** @return a String representing Greenstone3 XML for a query process
191 * response returning the results for the query denoted by parameter
192 * nameValParamsMap.
193 * @param nameValParamsMap is a Map of name and value pairs for all the
194 * query field data values. The names match the field names that
195 * describeCollectionService() would have returned for the query service.
196 * @param collection is the name of the collection
197 * @param service is the name of the query service
198 * This method is only ever called when any of the services in the digital
199 * library described themselves as type=query. Therefore any digital
200 * libraries that have no query services, can just return emtpy message
201 * strings (or even "") since this method will never be called on them
202 * anyway. */
203 public String query(String collection, String service,
204 Map nameValParamsMap)
205 {
206 return super.query(collection, service, nameValParamsMap);
207 }
208}
Note: See TracBrowser for help on using the repository browser.