source: trunk/java-client/org/nzdl/gsdl/service/NzdlWrapper.java@ 2316

Last change on this file since 2316 was 2284, checked in by say1, 23 years ago

Cross collection searching

  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
Line 
1/*
2 * NzdlWrapper.java
3 * Copyright (C) 2001 New Zealand Digital Library Project
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20//the package we're in
21package org.nzdl.gsdl.service;
22
23import java.util.Map;
24import java.util.Set;
25import java.util.List;
26
27
28/**
29 * A Wrapper around an NzdlService object that adds functionality.
30 *
31 * Typically one or more of the methods will be overridden to
32 * add that functionality
33 *
34 * @author Brett Sheeran ([email protected]) (comments)
35 * @author Stuart Yeates ([email protected])
36 * @version $Revision: 2284 $
37 */
38abstract public class NzdlWrapper
39 extends java.lang.Object
40 implements NzdlService {
41
42 private NzdlService service = null;
43 /**
44 * The bean constructor ...
45 */
46 public NzdlWrapper() {
47 this.service = null;
48 }
49 /**
50 * The normal constructor
51 */
52 public NzdlWrapper(NzdlService service) {
53 this.service = service;
54 }
55
56 /**
57 * Allow the client to configure a CORBA server.
58 * @param key the parameter to be set.
59 * @param values what that parameter will be set to.
60 */
61 public void configure( String _key, Set _values ) {
62 service.configure(_key, _values);
63 }
64
65 /**
66 * Obtain the set of collection names for a Greenstone library.
67 * @return A set of collection names in string format.
68 */
69 public Set getCollectionSet( ) {
70 return service.getCollectionSet();
71 }
72
73 /**
74 * Check if ORB knows of this collection.
75 * @param name the name of a collecion to be searched for.
76 * @return boolean <TT>true</TT> if collection is found, else <TT>false</TT>.
77 */
78 public boolean hasCollection( String _name ) {
79 return service.hasCollection(_name);
80 }
81
82
83 /**
84 * Check if ORB can communicate with of this collection.
85 * @param name the name of a collecion to be pinged.
86 * @return boolean <TT>true</TT> if collection returned ping, else
87 * <TT>false</TT>.
88 */
89 public boolean pingCollection( String _name ) {
90 return service.pingCollection(_name);
91 }
92
93 /**
94 * Extract information on this collection into a
95 * {@link NzdlCollectionInfo NzdlCollectionInfo} object
96 * @param name the collection to be retrieved.
97 * @return an instance of
98 * {@link NzdlCollectionInfo NzdlCollectionInfo} containing data on a
99 * collection
100 */
101 public NzdlCollectionInfo getCollectionInfo( String _name ) {
102 return service.getCollectionInfo(_name);
103 }
104
105 /**
106 * Returns the set of filters for the service object.
107 * @param name the collection name
108 * @return a set of strings that name the filters, for example
109 * BrowseFilter, QueryFilter and NullFilter.
110 */
111 public Set getFilterSet( String _name ) {
112 return service.getFilterSet(_name);
113 }
114
115 /**
116 * @param name the collection name
117 * @return the Set of (name, value) value pairs for all metadata
118 * associated with a collection
119 */
120 public Set getMetaTagSet( String _name ) {
121 return service.getMetaTagSet(_name);
122 }
123
124 /**
125 * Returns the Greenstone Markup Language (GML) text for a particular
126 * document from a collection.
127 * @param name the name of the collection.
128 * @param docID the document identity string
129 * @return the GML document in the form of a string.
130 */
131 public String getDocument( String _name, String _docID ) {
132 return service.getDocument(_name, _docID);
133 }
134
135 /**
136 * Returns the set of value(s) for a metatag from a particular document.
137 * @param name collection name
138 * @param docID the document identifier.
139 * @param metaTag the metatag name such as: Title, Author, Date and Images.
140 * @return The set of value(s) for the requested metatag and document. In
141 * cases such as Title, Author, Date there will probably be only one value
142 * per document.
143 */
144 public Set getMetaData( String _name, String _docID, String _metaTag ) {
145 return service.getMetaData( _name, _docID, _metaTag );
146 }
147
148 /**
149 * Returns a map of value(s) for a metatag from a list of documents.
150 * @param name collection name
151 * @param docIDs a list of document identifier strings.
152 * @param metaTag the metatag name such as: Title, Author, Date and Images.
153 * @return The map of value(s) for the requested metatag and document. In
154 * cases such as Title, Author, Date there will probably be only one value
155 * per document.
156 */
157 public Map getMetaData( String _name, List _docIDs, String _metaTag ) {
158 return service.getMetaData( _name, _docIDs, _metaTag );
159 }
160
161 /**
162 * Services a {@link NzdlRequest NzdlRequest} to a collection and places
163 * the results into a {@link NzdlResponse NzdlResponse} object. <br>
164 * Pre: Created instances of NzdlRequest and NzdlResponse. <br>
165 * Post: Placed the result data into NzdlResponse object.
166 * @param name the collection name.
167 * @param request an instance of NzdlRequest with query data to be serviced
168 * @param response an instance of NzdlResponse. where the results of
169 * sevciving the query will be placed
170 */
171 public void service( String _name, NzdlRequest _request,
172 NzdlResponse _response ) {
173 service.service(_name,_request,_response);
174 }
175
176}
Note: See TracBrowser for help on using the repository browser.