001    // $HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/getcapabilities/Operation.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    package org.deegree.ogcwebservices.getcapabilities;
037    
038    import java.io.Serializable;
039    
040    import org.deegree.owscommon.OWSDomainType;
041    
042    /**
043     * Represents the definition of an <code>Operation</code> in the capabilities document of an
044     * OGC-web service according to the <code>OWS Common
045     * Implementation Specification 0.2</code> (and
046     * <code>owsOperationsMetadata.xsd</code>).
047     * <p>
048     * It consists of a mandatory <code>name</code> attribute and the following elements: <table
049     * border="1">
050     * <tr>
051     * <th>Name</th>
052     * <th>Occurences</th>
053     * <th>Function</th>
054     * </tr>
055     * <tr>
056     * <td>ows:DCP</td>
057     * <td align="center">1-*</td>
058     * <td>Unordered list of Distributed Computing Platforms (DCPs) supported for this operation. At
059     * present, only the HTTP DCP is defined, so this element will appear only once.</td>
060     * </tr>
061     * <tr>
062     * <td>Parameter</td>
063     * <td align="center">0-*</td>
064     * <td>Optional unordered list of parameter domains that each apply to this operation which this
065     * server implements. If one of these Parameter elements has the same "name" attribute as a
066     * Parameter element in the OperationsMetadata element, this Parameter element shall override the
067     * other one for this operation. The list of required and optional parameter domain limitations for
068     * this operation shall be specified in the Implementation Specification for this service.</td>
069     * </tr>
070     * <tr>
071     * <td>ows:Metadata</td>
072     * <td align="center">0-*</td>
073     * <td>Optional unordered list of additional metadata about this operation and its' implementation.
074     * A list of required and optional metadata elements for this operation should be specified in the
075     * Implementation Specification for this service. (Informative: This metadata might specify the
076     * operation request parameters or provide the XML Schemas for the operation request.)</td>
077     * </tr>
078     * </table>
079     *
080     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
081     * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
082     * @author last edited by: $Author: mschneider $
083     *
084     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
085     *
086     * @since 2.0
087     */
088    
089    public class Operation implements Serializable {
090    
091        private static final long serialVersionUID = -4092984827471246029L;
092    
093        private String name;
094    
095        private DCPType[] dcps;
096    
097        private OWSDomainType[] parameters;
098    
099        private Object[] metadata;
100    
101        /**
102         * Creates a new <code>Operation</code> instance that has no <code>Parameter</code>
103         * information.
104         *
105         * @param name
106         * @param dcps
107         */
108        public Operation( String name, DCPType[] dcps ) {
109            this( name, dcps, new OWSDomainType[0] );
110        }
111    
112        /**
113         * Creates a new <code>Operation</code> instance with <code>Parameter</code> information.
114         *
115         * @param name
116         * @param dcpTypes
117         * @param parameters
118         */
119        public Operation( String name, DCPType[] dcpTypes, OWSDomainType[] parameters ) {
120            this.name = name;
121            this.dcps = dcpTypes;
122            this.parameters = parameters;
123        }
124    
125        /**
126         * Returns the name of the <code>Operation</code>.
127         *
128         * @return the name of the <code>Operation</code>.
129         */
130        public String getName() {
131            return name;
132        }
133    
134        /**
135         * Sets the name of the <code>Operation</code>.
136         *
137         * @param name
138         */
139        public void setName( String name ) {
140            this.name = name;
141        }
142    
143        /**
144         * Returns the <code>DCP</code> definitions for the <code>Operation</code>.
145         *
146         * @return the <code>DCP</code> definitions for the <code>Operation</code>.
147         */
148        public DCPType[] getDCPs() {
149            return dcps;
150        }
151    
152        /**
153         * Sets the <code>DCP</code> definitions for the <code>Operation</code>.
154         *
155         * @param dcpTypes
156         */
157        public void setDCPs( DCPType[] dcpTypes ) {
158            this.dcps = dcpTypes;
159        }
160    
161        /**
162         * Returns the specified <code>Parameter</code> value for the <code>Operation</code>.
163         *
164         * @param name
165         * @return the domain type value
166         */
167        public OWSDomainType getParameter( String name ) {
168            for ( int i = 0; i < parameters.length; i++ ) {
169                if ( parameters[i].getName().equals( name ) ) {
170                    return parameters[i];
171                }
172            }
173            return null;
174        }
175    
176        /**
177         * Returns all <code>Parameters</code> of the <code>Operation</code>.
178         *
179         * @return all <code>Parameters</code> of the <code>Operation</code>.
180         */
181        public OWSDomainType[] getParameters() {
182            return parameters;
183        }
184    
185        /**
186         * Sets the <code>Parameters</code> of the <code>Operation</code>.
187         *
188         * @param parameters
189         */
190        public void setParameters( OWSDomainType[] parameters ) {
191            this.parameters = parameters;
192        }
193    
194        /**
195         * @return Returns the metadata.
196         */
197        public Object[] getMetadata() {
198            return metadata;
199        }
200    
201        /**
202         * @param metadata
203         *            The metadata to set.
204         */
205        public void setMetadata( Object[] metadata ) {
206            this.metadata = metadata;
207        }
208    
209    }