All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.sis.console.IdentifierCommand Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.sis.console;

import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.EnumSet;
import java.util.Collections;
import java.util.ResourceBundle;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.Identifier;
import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.opengis.util.FactoryException;
import org.opengis.referencing.ReferenceSystem;
import org.apache.sis.internal.util.X364;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.resources.Vocabulary;

// Branch-dependent imports
import org.apache.sis.metadata.iso.DefaultMetadata;
import org.apache.sis.metadata.iso.DefaultIdentifier;


/**
 * The "identifier" sub-command.
 *
 * @author  Martin Desruisseaux (Geomatys)
 * @version 0.8
 * @since   0.3
 * @module
 */
final class IdentifierCommand extends FormattedOutputCommand {
    /**
     * The state to write in the left margin before the identifier.
     *
     * MAINTENANCE NOTE: if this enumeration is modified,
     * update {@code IdentifierState.properties} accordingly.
     */
    private enum State {
        VALID("   "), APPROXIMATE("~  "), AXIS_ORDER("!  "), MISMATCH("!! "), UNKNOWN("?  ");

        /** The string representation. */ final String text;
        private State(final String p) {this.text = p;};
    }

    /**
     * A row containing a metadata or CRS identifier, its name and a status flag.
     */
    private static class Row {
        /**
         * The two-letters state to write before the identifier.
         */
        final State state;

        /**
         * The identifier.
         */
        final String identifier;

        /**
         * A description to write after the identifier.
         */
        final CharSequence description;

        /**
         * Creates a row for the given elements.
         */
        Row(final State state, final String identifier, final CharSequence description) {
            this.state       = state;
            this.identifier  = identifier;
            this.description = description;
        }
    }

    /**
     * Work around for RFE #4093999 in Sun's bug database
     * ("Relax constraint on placement of this()/super() call in constructors").
     */
    @Workaround(library="JDK", version="1.7")
    private static EnumSet




© 2015 - 2025 Weber Informatics LLC | Privacy Policy