001    // $HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/ogcwebservices/getcapabilities/Operation.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    package org.deegree.ogcwebservices.getcapabilities;
044    
045    import java.io.Serializable;
046    
047    import org.deegree.owscommon.OWSDomainType;
048    
049    /**
050     * Represents the definition of an <code>Operation</code> in the capabilities document of an
051     * OGC-web service according to the <code>OWS Common
052     * Implementation Specification 0.2</code> (and
053     * <code>owsOperationsMetadata.xsd</code>).
054     * <p>
055     * It consists of a mandatory <code>name</code> attribute and the following elements: <table
056     * border="1">
057     * <tr>
058     * <th>Name</th>
059     * <th>Occurences</th>
060     * <th>Function</th>
061     * </tr>
062     * <tr>
063     * <td>ows:DCP</td>
064     * <td align="center">1-*</td>
065     * <td>Unordered list of Distributed Computing Platforms (DCPs) supported for this operation. At
066     * present, only the HTTP DCP is defined, so this element will appear only once.</td>
067     * </tr>
068     * <tr>
069     * <td>Parameter</td>
070     * <td align="center">0-*</td>
071     * <td>Optional unordered list of parameter domains that each apply to this operation which this
072     * server implements. If one of these Parameter elements has the same "name" attribute as a
073     * Parameter element in the OperationsMetadata element, this Parameter element shall override the
074     * other one for this operation. The list of required and optional parameter domain limitations for
075     * this operation shall be specified in the Implementation Specification for this service.</td>
076     * </tr>
077     * <tr>
078     * <td>ows:Metadata</td>
079     * <td align="center">0-*</td>
080     * <td>Optional unordered list of additional metadata about this operation and its' implementation.
081     * A list of required and optional metadata elements for this operation should be specified in the
082     * Implementation Specification for this service. (Informative: This metadata might specify the
083     * operation request parameters or provide the XML Schemas for the operation request.)</td>
084     * </tr>
085     * </table>
086     * 
087     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
088     * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
089     * @author last edited by: $Author: apoth $
090     * 
091     * @version 1.0. $Revision: 9345 $, $Date: 2007-12-27 17:22:25 +0100 (Do, 27 Dez 2007) $
092     * 
093     * @since 2.0
094     */
095    
096    public class Operation implements Serializable {
097    
098        private String name;
099    
100        private DCPType[] dcps;
101    
102        private OWSDomainType[] parameters;
103    
104        private Object[] metadata;
105    
106        /**
107         * Creates a new <code>Operation</code> instance that has no <code>Parameter</code>
108         * information.
109         * 
110         * @param name
111         * @param dcps
112         */
113        public Operation( String name, DCPType[] dcps ) {
114            this( name, dcps, new OWSDomainType[0] );
115        }
116    
117        /**
118         * Creates a new <code>Operation</code> instance with <code>Parameter</code> information.
119         * 
120         * @param name
121         * @param dcpTypes
122         * @param parameters
123         */
124        public Operation( String name, DCPType[] dcpTypes, OWSDomainType[] parameters ) {
125            this.name = name;
126            this.dcps = dcpTypes;
127            this.parameters = parameters;
128        }
129    
130        /**
131         * Returns the name of the <code>Operation</code>.
132         * 
133         * @return the name of the <code>Operation</code>.
134         */
135        public String getName() {
136            return name;
137        }
138    
139        /**
140         * Sets the name of the <code>Operation</code>.
141         * 
142         * @param name
143         */
144        public void setName( String name ) {
145            this.name = name;
146        }
147    
148        /**
149         * Returns the <code>DCP</code> definitions for the <code>Operation</code>.
150         * 
151         * @return the <code>DCP</code> definitions for the <code>Operation</code>.
152         */
153        public DCPType[] getDCPs() {
154            return dcps;
155        }
156    
157        /**
158         * Sets the <code>DCP</code> definitions for the <code>Operation</code>.
159         * 
160         * @param dcpTypes
161         */
162        public void setDCPs( DCPType[] dcpTypes ) {
163            this.dcps = dcpTypes;
164        }
165    
166        /**
167         * Returns the specified <code>Parameter</code> value for the <code>Operation</code>.
168         * 
169         * @param name
170         */
171        public OWSDomainType getParameter( String name ) {
172            for ( int i = 0; i < parameters.length; i++ ) {
173                if ( parameters[i].getName().equals( name ) ) {
174                    return parameters[i];
175                }
176            }
177            return null;
178        }
179    
180        /**
181         * Returns all <code>Parameters</code> of the <code>Operation</code>.
182         * 
183         * @return all <code>Parameters</code> of the <code>Operation</code>.
184         */
185        public OWSDomainType[] getParameters() {
186            return parameters;
187        }
188    
189        /**
190         * Sets the <code>Parameters</code> of the <code>Operation</code>.
191         * 
192         * @param parameters
193         */
194        public void setParameters( OWSDomainType[] parameters ) {
195            this.parameters = parameters;
196        }
197    
198        /**
199         * @return Returns the metadata.
200         */
201        public Object[] getMetadata() {
202            return metadata;
203        }
204    
205        /**
206         * @param metadata
207         *            The metadata to set.
208         */
209        public void setMetadata( Object[] metadata ) {
210            this.metadata = metadata;
211        }
212    
213    }