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
|
---|
21 | package org.nzdl.gsdl.service;
|
---|
22 |
|
---|
23 | import java.util.Map;
|
---|
24 | import java.util.Set;
|
---|
25 | import 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: 2178 $
|
---|
37 | */
|
---|
38 | abstract 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 | System.err.println("here" + this);
|
---|
71 | return service.getCollectionSet();
|
---|
72 | }
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Check if ORB knows of this collection.
|
---|
76 | * @param name the name of a collecion to be searched for.
|
---|
77 | * @return boolean <TT>true</TT> if collection is found, else <TT>false</TT>.
|
---|
78 | */
|
---|
79 | public boolean hasCollection( String _name ) {
|
---|
80 | return service.hasCollection(_name);
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * Check if ORB can communicate with of this collection.
|
---|
86 | * @param name the name of a collecion to be pinged.
|
---|
87 | * @return boolean <TT>true</TT> if collection returned ping, else
|
---|
88 | * <TT>false</TT>.
|
---|
89 | */
|
---|
90 | public boolean pingCollection( String _name ) {
|
---|
91 | return service.pingCollection(_name);
|
---|
92 | }
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Extract information on this collection into a
|
---|
96 | * {@link NzdlCollectionInfo NzdlCollectionInfo} object
|
---|
97 | * @param name the collection to be retrieved.
|
---|
98 | * @return an instance of
|
---|
99 | * {@link NzdlCollectionInfo NzdlCollectionInfo} containing data on a
|
---|
100 | * collection
|
---|
101 | */
|
---|
102 | public NzdlCollectionInfo getCollectionInfo( String _name ) {
|
---|
103 | return service.getCollectionInfo(_name);
|
---|
104 | }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Returns the set of filters for the service object.
|
---|
108 | * @param name the collection name
|
---|
109 | * @return a set of strings that name the filters, for example
|
---|
110 | * BrowseFilter, QueryFilter and NullFilter.
|
---|
111 | */
|
---|
112 | public Set getFilterSet( String _name ) {
|
---|
113 | return service.getFilterSet(_name);
|
---|
114 | }
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * @param name the collection name
|
---|
118 | * @return the Set of (name, value) value pairs for all metadata
|
---|
119 | * associated with a collection
|
---|
120 | */
|
---|
121 | public Set getMetaTagSet( String _name ) {
|
---|
122 | return service.getMetaTagSet(_name);
|
---|
123 | }
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * Returns the Greenstone Markup Language (GML) text for a particular
|
---|
127 | * document from a collection.
|
---|
128 | * @param name the name of the collection.
|
---|
129 | * @param docID the document identity string
|
---|
130 | * @return the GML document in the form of a string.
|
---|
131 | */
|
---|
132 | public String getDocument( String _name, String _docID ) {
|
---|
133 | return service.getDocument(_name, _docID);
|
---|
134 | }
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * Returns the set of value(s) for a metatag from a particular document.
|
---|
138 | * @param name collection name
|
---|
139 | * @param docID the document identifier.
|
---|
140 | * @param metaTag the metatag name such as: Title, Author, Date and Images.
|
---|
141 | * @return The set of value(s) for the requested metatag and document. In
|
---|
142 | * cases such as Title, Author, Date there will probably be only one value
|
---|
143 | * per document.
|
---|
144 | */
|
---|
145 | public Set getMetaData( String _name, String _docID, String _metaTag ) {
|
---|
146 | return service.getMetaData( _name, _docID, _metaTag );
|
---|
147 | }
|
---|
148 |
|
---|
149 | /**
|
---|
150 | * Returns a map of value(s) for a metatag from a list of documents.
|
---|
151 | * @param name collection name
|
---|
152 | * @param docIDs a list of document identifier strings.
|
---|
153 | * @param metaTag the metatag name such as: Title, Author, Date and Images.
|
---|
154 | * @return The map of value(s) for the requested metatag and document. In
|
---|
155 | * cases such as Title, Author, Date there will probably be only one value
|
---|
156 | * per document.
|
---|
157 | */
|
---|
158 | public Map getMetaData( String _name, List _docIDs, String _metaTag ) {
|
---|
159 | return service.getMetaData( _name, _docIDs, _metaTag );
|
---|
160 | }
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * Services a {@link NzdlRequest NzdlRequest} to a collection and places
|
---|
164 | * the results into a {@link NzdlResponse NzdlResponse} object. <br>
|
---|
165 | * Pre: Created instances of NzdlRequest and NzdlResponse. <br>
|
---|
166 | * Post: Placed the result data into NzdlResponse object.
|
---|
167 | * @param name the collection name.
|
---|
168 | * @param request an instance of NzdlRequest with query data to be serviced
|
---|
169 | * @param response an instance of NzdlResponse. where the results of
|
---|
170 | * sevciving the query will be placed
|
---|
171 | */
|
---|
172 | public void service( String _name, NzdlRequest _request,
|
---|
173 | NzdlResponse _response ) {
|
---|
174 | service.service(_name,_request,_response);
|
---|
175 | }
|
---|
176 |
|
---|
177 | }
|
---|