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

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

Additional constructor.

File size: 8.7 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 /** Unused constructor for clients: takes a different properties file */
49 public FedoraServicesAPIA(String protocol, String host, int port,
50 String fedoraServerUsername, String fedoraServerPassword) throws Exception {
51 super(protocol, host, port, fedoraServerUsername, fedoraServerPassword);
52 }
53
54 /** @return the name of this digital library for displaying in the client */
55 public String getDisplayName() {
56 return "Fedora";
57 }
58
59 /** @return the directory path to the associated files of the given document
60 * node. For instance, the base url of a JEditorPane's HTML documents can be
61 * set to this. */
62 public String getAssocFileBaseURL(DocumentNodeData docNode) {
63 return super.getAssocFileBaseURL()
64 + super.getDocPIDFromDocID(docNode.nodeID) + "/";
65 }
66
67 /** @return Greenstone3 XML describe response message with information
68 * about collections contained and services (and any serviceRacks) supported
69 * by the Digital library. */
70 public String describe() {
71 return this.getCollectionList();
72 }
73
74 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
75 * containing all the metadata of all the documents indicated by docIDs
76 * @param collection is the name of the collection
77 * @param docIDs is an array of document identifiers of documents whose
78 * metadata is requested */
79 public String retrieveDocumentMetadata(String collection, String[] docIDs) {
80 return this.getDocumentMetadata(docIDs);
81 }
82
83 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
84 * containing all the metadata of the document denoted by docID
85 * @param collection is the name of the collection
86 * @param docID is the document identifier of the document whose metadata is
87 * requested */
88 public String retrieveDocumentMetadata(String collection, String docID) {
89 return this.getDocumentMetadata(docID);
90 }
91
92 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
93 * containing only the title metadata of the documents denoted by docIDs
94 * @param collection is the name of the collection
95 * @param docIDs is an array of document identifiers of documents whose titles
96 * are requested */
97 public String retrieveTitleMetadata(String collection, String[] docIDs) {
98 return this.getTitleMetadata(docIDs);
99 }
100
101 /** @return a String representing Greenstone3 DocumentMetadataRetrieve XML
102 * containing only the title metadata of the document denoted by docID
103 * @param collection is the name of the collection
104 * @param docID is the document identifier of the document whose titles is
105 * requested */
106 public String retrieveTitleMetadata(String collection, String docID) {
107 return this.getTitleMetadata(docID);
108 }
109
110
111 /** @return a String representing Greenstone3 DocumentContentRetrieve XML
112 * containing the document contents of the documents indicated by docIDs
113 * @param collection is the name of the collection
114 * @param docIDs is an array of document identifiers of documents whose (text)
115 * contents are requested */
116 public String retrieveDocumentContent(String collection, String[] docIDs) {
117 return this.getContent(docIDs);
118 }
119
120 /** @return a String representing Greenstone3 DocumentContentRetrieve XML
121 * containing the document contents of the document indicated by docID
122 * @param collection is the name of the collection
123 * @param docID is the document identifier of the document whose (text)
124 * content is requested */
125 public String retrieveDocumentContent(String collection, String docID) {
126 return this.getContent(docID);
127 }
128
129 /** @return a String representing Greenstone3 DocumentStructureRetrieve XML
130 * containing the document structure of the documents indicated by docIDs:
131 * this means all their descendents
132 * @param collection is the name of the collection
133 * @param docIDs is an array of document identifiers of documents whose
134 * hierarchical structures are requested */
135 public String retrieveDocumentStructure(String collection, String[] docIDs) {
136 return this.getDocumentStructure(docIDs);
137 }
138
139 /** @return a String representing Greenstone3 DocumentStructureRetrieve XML
140 * containing the document structure of the document indicated by docID:
141 * this means all its descendents
142 * @param collection is the name of the collection
143 * @param docID is the document identifier of the document whose hierarchical
144 * structure is requested*/
145 public String retrieveDocumentStructure(String collection, String docID) {
146 return this.getDocumentStructure(docID);
147 }
148
149 // UNUSED by the client, but still a very useful method:
150 /** @return a String representing Greenstone3 DocumentStructureRetrieve XML
151 * containing a view of the document structure of the documents denoted by
152 * docs where only the requested documents and their direct children are
153 * returned.
154 * @param collection is the name of the collection
155 * @param docIDs is an array of document identifiers of documents whose
156 * hierarchical structures are requested */
157 public String retrieveDocumentChildren(String collection, String[] docIDs) {
158 return this.getChildren(docIDs);
159 }
160
161 /** @return a String representing Greenstone3 DocumentStructureRetrieve XML
162 * containing a view of the document structure of the document denoted by
163 * docID where only the document and its direct children are returned.
164 * @param collection is the name of the collection
165 * @param docID is the document identifier of the document whose hierarchical
166 * structure is requested */
167 public String retrieveDocumentChildren(String collection, String docID) {
168 return this.getChildren(docID);
169 }
170
171 /** @return a String representing Greenstone3 ClassifierBrowse XML
172 * giving the entire *structure* of the classification denoted by
173 * classifierID (including the structures of document descendents of
174 * the classifier).
175 * @param classifierIDs - each ID is of the form CL# where the number (#)
176 * marks out structured sections like CL1.1.3 or CL2
177 * @param collection is the name of the collection
178 * @param service is the name of the browse service (=ClassifierBrowse usually)
179 */
180 public String retrieveBrowseStructure(
181 String collection, String service, String[] classifierIDs)
182 {
183 return this.browse(collection, classifierIDs);
184 }
185
186 /** @return a String representing Greenstone3
187 * ClassifierBrowseMetadataRetrieve XML giving all the metadata for
188 * all the subclassifiers denoted by nodeIDs.
189 * @param nodeIDs is of the form CL#.# where the number (#) marks
190 * out structured sections like CL2.1.3. NodeIDs are generally subsections
191 * of top-level classifierNodes (CL#, e.g. CL3).
192 * @param collection is the name of the collection
193 * @param service is the name of the Browse's MetadataRetrieve service
194 * (usually the browse service is ClassifierBrowse, in which case it always
195 * has a retrieve service called ClassifierBrowseMetadataRetrieve) */
196 public String retrieveBrowseMetadata(
197 String collection, String service, String[] nodeIDs)
198 {
199 return this.browseMetadataRetrieve(nodeIDs);
200 }
201
202}
Note: See TracBrowser for help on using the repository browser.