001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/ogcwebservices/csw/capabilities/CatalogueOperationsMetadata.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2008 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/deegree/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstr. 19
030     53115 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041    
042     
043     ---------------------------------------------------------------------------*/
044    package org.deegree.ogcwebservices.csw.capabilities;
045    
046    import java.util.ArrayList;
047    import java.util.List;
048    
049    import org.deegree.ogcwebservices.csw.discovery.GetRepositoryItem;
050    import org.deegree.ogcwebservices.getcapabilities.Operation;
051    import org.deegree.ogcwebservices.getcapabilities.OperationsMetadata;
052    import org.deegree.owscommon.OWSDomainType;
053    
054    /**
055     * Represents the <code>OperationMetadata</code> part in the capabilities document of an OGC-CSW
056     * according to the <code>OpenGIS�
057     * Catalogue Services Specification 2.0</code>.
058     * <p>
059     * In addition to the <code>GetCapabilities</code> operation that all <code>OWS 0.2</code>
060     * compliant services must implement, it may define some or all of the following operations: <table
061     * border="1">
062     * <tr>
063     * <th>Name</th>
064     * <th>Mandatory?</th>
065     * <th>Function</th>
066     * </tr>
067     * <tr>
068     * <td>DescribeRecord</td>
069     * <td align="center">X</td>
070     * <td>Allows a client to discover elements of the information model supported by the target
071     * catalogue service.</td>
072     * </tr>
073     * <tr>
074     * <td>GetDomain</td>
075     * <td align="center">-</td>
076     * <td>The optional GetDomain operation is used to obtain runtime information about the range of
077     * values of a metadata record element or request parameter. The runtime range of values for a
078     * property or request parameter is typically much smaller than the value space for that property or
079     * parameter based on its static type definition. For example, a property or request parameter
080     * defined as a 16bit positive integer in a database may have a value space of 65535 distinct
081     * integers but the actual number of distinct values existing in the database may be much smaller.
082     * This type of runtime information about the range of values of a property or request parameter is
083     * useful for generating user interfaces with meaningful pick lists or for generating query
084     * predicates that have a higher chance of actually identifying a result set. It should be noted
085     * that the GetDomain operation is a �best-effort� operation. That is to say that a catalogue tries
086     * to generate useful information about the specified request parameter or property if it can. It is
087     * entirely possible that a catalogue may not be able to determine anything about the values of a
088     * property or request parameter in which case an empty response should be generated.</td>
089     * </tr>
090     * <tr>
091     * <td>GetRecords</td>
092     * <td align="center">X</td>
093     * <td>The primary means of resource discovery in the general model are the two operations search
094     * and present. In the HTTP protocol binding these are combined in the form of the mandatory
095     * GetRecords operation, which does a search and a piggybacked present.</td>
096     * </tr>
097     * <tr>
098     * <td>GetRecordById</td>
099     * <td align="center">X</td>
100     * <td>The mandatory GetRecordById request retrieves the default representation of catalogue
101     * records using their identifier. The GetRecordById operation is an implementation of the Present
102     * operation from the general model. This operation presumes that a previous query has been
103     * performed in order to obtain the identifiers that may be used with this operation. For example,
104     * records returned by a GetRecords operation may contain references to other records in the
105     * catalogue that may be retrieved using the GetRecordById operation. This operation is also a
106     * subset of the GetRecords operation, and is included as a convenient short form for retrieving and
107     * linking to records in a catalogue.</td>
108     * </tr>
109     * <tr>
110     * <td>Transaction</td>
111     * <td align="center">-</td>
112     * <td>The optional Transaction operation defines an interface for creating, modifying and deleting
113     * catalogue records. The specific payload being manipulated must be defined in a profile.</td>
114     * </tr>
115     * <tr>
116     * <td>Harvest</td>
117     * <td align="center">-</td>
118     * <td>The optional Harvest operation is an operation that "pulls" data into the catalogue. That
119     * is, this operation only references the data to be inserted or updated in the catalogue, and it is
120     * the job of the catalogue service to resolve the reference, fetch that data, and process it into
121     * the catalogue. The Harvest operation has two modes of operation, controlled by a flag in the
122     * request. The first mode of operation is a synchronous mode in which the CSW receives a Harvest
123     * request from the client, processes it immediately, and sends the results to the client while the
124     * client waits. The second mode of operation is asynchronous in that the server receives a Harvest
125     * request from the client, and sends the client an immediate acknowledgement that the request has
126     * been successfully received. The server can then process the Harvest request whenever it likes,
127     * taking as much time as is required and then send the results of the processing to a URI specified
128     * in the original Harvest request. This latter mode of operation is included to support Harvest
129     * requests that could run for a period of time longer than most HTTP timeout's will allow.
130     * Processing a Harvest request means that the CSW resolves the URI pointing to the metadata
131     * resource, parses the resource, and then creates or modifies metadata records in the catalogue in
132     * order to register the resource. This operation may be performed only once or periodically
133     * depending on how the client invokes the operation.</td>
134     * </tr>
135     * </table>
136     * 
137     * @see org.deegree.ogcwebservices.getcapabilities.OperationsMetadata
138     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
139     * @author last edited by: $Author: apoth $
140     * 
141     * @version $Revision: 9345 $, $Date: 2007-12-27 17:22:25 +0100 (Do, 27 Dez 2007) $
142     */
143    
144    public class CatalogueOperationsMetadata extends OperationsMetadata {
145    
146        public static final String DESCRIBE_RECORD_NAME = "DescribeRecord";
147    
148        public static final String GET_DOMAIN_NAME = "GetDomain";
149    
150        public static final String GET_RECORDS_NAME = "GetRecords";
151    
152        public static final String GET_RECORD_BY_ID_NAME = "GetRecordById";
153    
154        /**
155         * Identifier for a {@link GetRepositoryItem} request.
156         */
157        public static final String GET_REPOSITORY_ITEM = "GetRepositoryItem";
158    
159        public static final String TRANSACTION_NAME = "Transaction";
160    
161        public static final String HARVEST_NAME = "Harvest";
162    
163        private Operation describeRecord;
164    
165        private Operation getDomain;
166    
167        private Operation getRecords;
168    
169        private Operation getRecordById;
170    
171        private Operation transaction;
172    
173        private Operation harvest;
174    
175        /**
176         * Constructs a new <code>CatalogOperationsMetadata</code> from the given parameters.
177         * 
178         * @param getCapabilities
179         * @param describeRecord
180         * @param getDomain
181         * @param getRecords
182         * @param getRecordById
183         * @param transaction
184         * @param harvest
185         * @param parameters
186         * @param constraints
187         */
188        public CatalogueOperationsMetadata( Operation getCapabilities, Operation describeRecord, Operation getDomain,
189                                            Operation getRecords, Operation getRecordById, Operation transaction,
190                                            Operation harvest, OWSDomainType[] parameters, OWSDomainType[] constraints ) {
191            super( getCapabilities, parameters, constraints );
192            this.describeRecord = describeRecord;
193            this.getDomain = getDomain;
194            this.getRecords = getRecords;
195            this.getRecordById = getRecordById;
196            this.transaction = transaction;
197            this.harvest = harvest;
198        }
199    
200        /**
201         * Returns all <code>Operations</code>.
202         * 
203         * @return all <code>Operations</code>.
204         */
205        public Operation[] getOperations() {
206            List<Operation> list = new ArrayList<Operation>();
207            list.add( getCapabilitiesOperation );
208            list.add( describeRecord );
209            list.add( getRecords );
210            if ( getRecordById != null ) {
211                list.add( getRecordById );
212            }
213            if ( getDomain != null ) {
214                list.add( getDomain );
215            }
216            if ( transaction != null ) {
217                list.add( transaction );
218            }
219            if ( harvest != null ) {
220                list.add( harvest );
221            }
222            return list.toArray( new Operation[list.size()] );
223        }
224    
225        /**
226         * @return the describeRecord.
227         * 
228         */
229        public Operation getDescribeRecord() {
230            return describeRecord;
231        }
232    
233        /**
234         * @param describeRecord
235         *            The describeRecord to set.
236         * 
237         */
238        public void setDescribeRecord( Operation describeRecord ) {
239            this.describeRecord = describeRecord;
240        }
241    
242        /**
243         * @return the getDomain.
244         * 
245         */
246        public Operation getGetDomain() {
247            return getDomain;
248        }
249    
250        /**
251         * @param getDomain
252         *            The getDomain to set.
253         * 
254         */
255        public void setGetDomain( Operation getDomain ) {
256            this.getDomain = getDomain;
257        }
258    
259        /**
260         * @return the getRecordById.
261         * 
262         */
263        public Operation getGetRecordById() {
264            return getRecordById;
265        }
266    
267        /**
268         * @param getRecordById
269         *            The getRecordId to set.
270         * 
271         */
272        public void setGetRecordById( Operation getRecordById ) {
273            this.getRecordById = getRecordById;
274        }
275    
276        /**
277         * @return the getRecords.
278         * 
279         */
280        public Operation getGetRecords() {
281            return getRecords;
282        }
283    
284        /**
285         * @param getRecords
286         *            The getRecords to set.
287         * 
288         */
289        public void setGetRecords( Operation getRecords ) {
290            this.getRecords = getRecords;
291        }
292    
293        /**
294         * @return the harvest.
295         * 
296         */
297        public Operation getHarvest() {
298            return harvest;
299        }
300    
301        /**
302         * @param harvest
303         *            The harvest to set.
304         * 
305         */
306        public void setHarvest( Operation harvest ) {
307            this.harvest = harvest;
308        }
309    
310        /**
311         * @return the transaction.
312         * 
313         */
314        public Operation getTransaction() {
315            return transaction;
316        }
317    
318        /**
319         * @param transaction
320         *            The transaction to set.
321         * 
322         */
323        public void setTransaction( Operation transaction ) {
324            this.transaction = transaction;
325        }
326    
327    }