001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  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     */
018    
019    package org.apache.hadoop.registry.client.types;
020    
021    import org.apache.hadoop.classification.InterfaceAudience;
022    import org.apache.hadoop.classification.InterfaceStability;
023    
024    /**
025     * Enum of address types -as integers.
026     * Why integers and not enums? Cross platform serialization as JSON
027     */
028    @InterfaceAudience.Public
029    @InterfaceStability.Evolving
030    public interface AddressTypes {
031    
032      /**
033       * hostname/FQDN and port pair: {@value}.
034       * The host/domain name and port are set as separate strings in the address
035       * list, e.g.
036       * <pre>
037       *   ["namenode.example.org", "50070"]
038       * </pre>
039       */
040      public static final String ADDRESS_HOSTNAME_AND_PORT = "host/port";
041      public static final String ADDRESS_HOSTNAME_FIELD = "host";
042      public static final String ADDRESS_PORT_FIELD = "port";
043    
044    
045      /**
046       * Path <code>/a/b/c</code> style: {@value}.
047       * The entire path is encoded in a single entry
048       *
049       * <pre>
050       *   ["/users/example/dataset"]
051       * </pre>
052       */
053      public static final String ADDRESS_PATH = "path";
054    
055    
056    
057      /**
058       * URI entries: {@value}.
059       * <pre>
060       *   ["http://example.org"]
061       * </pre>
062       */
063      public static final String ADDRESS_URI = "uri";
064    
065      /**
066       * Zookeeper addresses as a triple : {@value}.
067       * <p>
068       * These are provide as a 3 element tuple of: hostname, port
069       * and optionally path (depending on the application)
070       * <p>
071       *   A single element would be
072       * <pre>
073       *   ["zk1","2181","/registry"]
074       * </pre>
075       *  An endpoint with multiple elements would list them as
076       * <pre>
077       *   [
078       *    ["zk1","2181","/registry"]
079       *    ["zk2","1600","/registry"]
080       *   ]
081       * </pre>
082       *
083       * the third element in each entry , the path, MUST be the same in each entry.
084       * A client reading the addresses of an endpoint is free to pick any
085       * of the set, so they must be the same.
086       *
087       */
088      public static final String ADDRESS_ZOOKEEPER = "zktriple";
089    
090      /**
091       * Any other address: {@value}.
092       */
093      public static final String ADDRESS_OTHER = "";
094    }