001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2014-2024 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.metadata.identification;
019
020import org.opengis.util.CodeList;
021import org.opengis.annotation.UML;
022import org.opengis.geoapi.internal.Vocabulary;
023
024import static org.opengis.annotation.Obligation.CONDITIONAL;
025import static org.opengis.annotation.Specification.ISO_19115;
026
027
028/**
029 * Distributed computing platform (DCP) on which an operation has been implemented.
030 *
031 * @departure rename
032 *   Renamed from "{@code DCPList}" to "{@code DistributedComputingPlatform}" for the following reasons:
033 *   <ol>
034 *     <li>GeoAPI avoids the "{@code List}" suffix because instances of this class are not list.
035 *         The concept of list rather applies to the list of predefined static constants in this class.</li>
036 *     <li>"{@code DCP}" is an abbreviation, and Java usage is to avoid abbreviations unless they are well known.</li>
037 *   </ol>
038 *
039 * @author  Rémi Maréchal (Geomatys)
040 * @version 3.1
041 * @since   3.1
042 */
043@Vocabulary(capacity=10)
044@UML(identifier="DCPList", specification=ISO_19115)
045public final class DistributedComputingPlatform extends CodeList<DistributedComputingPlatform> {
046    /**
047     * Serial number for compatibility with different versions.
048     */
049    private static final long serialVersionUID = -5092358242686893115L;
050
051    /**
052     * Extensible Markup Language.
053     */
054    @UML(identifier="XML", obligation=CONDITIONAL, specification=ISO_19115)
055    public static final DistributedComputingPlatform XML = new DistributedComputingPlatform("XML");
056
057    /**
058     * Common Object Request Broker Architecture.
059     */
060    @UML(identifier="CORBA", obligation=CONDITIONAL, specification=ISO_19115)
061    public static final DistributedComputingPlatform CORBA = new DistributedComputingPlatform("CORBA");
062
063    /**
064     * Object - oriented programming language.
065     */
066    @UML(identifier="JAVA", obligation=CONDITIONAL, specification=ISO_19115)
067    public static final DistributedComputingPlatform JAVA = new DistributedComputingPlatform("JAVA");
068
069    /**
070     * Component Object Model.
071     */
072    @UML(identifier="COM", obligation=CONDITIONAL, specification=ISO_19115)
073    public static final DistributedComputingPlatform COM = new DistributedComputingPlatform("COM");
074
075    /**
076     * Structured Query Language.
077     */
078    @UML(identifier="SQL", obligation=CONDITIONAL, specification=ISO_19115)
079    public static final DistributedComputingPlatform SQL = new DistributedComputingPlatform("SQL");
080
081    /**
082     * Simple Object Access Protocole.
083     */
084    @UML(identifier="SOAP", obligation=CONDITIONAL, specification=ISO_19115)
085    public static final DistributedComputingPlatform SOAP = new DistributedComputingPlatform("SOAP");
086
087    /**
088     * ISO 23950.
089     */
090    @UML(identifier="Z3950", obligation=CONDITIONAL, specification=ISO_19115)
091    public static final DistributedComputingPlatform Z3950 = new DistributedComputingPlatform("Z3950");
092
093    /**
094     * Extensible Markup Language.
095     */
096    @UML(identifier="HTTP", obligation=CONDITIONAL, specification=ISO_19115)
097    public static final DistributedComputingPlatform HTTP = new DistributedComputingPlatform("HTTP");
098
099    /**
100     * File Transfert Protocol.
101     */
102    @UML(identifier="FTP", obligation=CONDITIONAL, specification=ISO_19115)
103    public static final DistributedComputingPlatform FTP = new DistributedComputingPlatform("FTP");
104
105    /**
106     * Web Services.
107     */
108    @UML(identifier="WebServices", obligation=CONDITIONAL, specification=ISO_19115)
109    public static final DistributedComputingPlatform WEB_SERVICES = new DistributedComputingPlatform("WEB_SERVICES");
110
111    /**
112     * Constructs an element of the given name.
113     *
114     * @param name  the name of the new element. This name shall not be in use by another element of this type.
115     */
116    private DistributedComputingPlatform(final String name) {
117        super(name);
118    }
119
120    /**
121     * Returns the list of {@code DistributedComputingPlatform}s.
122     *
123     * @return the list of codes declared in the current JVM.
124     */
125    public static DistributedComputingPlatform[] values() {
126        return values(DistributedComputingPlatform.class);
127    }
128
129    /**
130     * Returns the list of codes of the same kind as this code list element.
131     * Invoking this method is equivalent to invoking {@link #values()}, except that
132     * this method can be invoked on an instance of the parent {@code CodeList} class.
133     *
134     * @return all code {@linkplain #values() values} for this code list.
135     */
136    @Override
137    public DistributedComputingPlatform[] family() {
138        return values();
139    }
140
141    /**
142     * Returns the DCP List that matches the given string, or returns a new one if none match it.
143     * This methods returns the first instance (in declaration order) for which the {@linkplain #name() name}
144     * is {@linkplain String#equalsIgnoreCase(String) equals, ignoring case}, to the given name.
145     * If no existing instance is found, then a new one is created for the given name.
146     *
147     * @param  code  the name of the code to fetch or to create.
148     * @return a code matching the given name.
149     */
150    public static DistributedComputingPlatform valueOf(String code) {
151        return valueOf(DistributedComputingPlatform.class, code, DistributedComputingPlatform::new).get();
152    }
153}