source: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/dlservices/FedoraServicesAPIA.java@ 21812

Last change on this file since 21812 was 21812, checked in by ak19, 14 years ago

Added an additional constructor for FedoraServicesAPIA that can be used by Greenstone 3's FedoraService.java.

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