View Javadoc

    1   package org.apache.turbine.services.uniqueid;
    2
    3
    4   /*
    5    * Licensed to the Apache Software Foundation (ASF) under one
    6    * or more contributor license agreements.  See the NOTICE file
    7    * distributed with this work for additional information
    8    * regarding copyright ownership.  The ASF licenses this file
    9    * to you under the Apache License, Version 2.0 (the
    10   * "License"); you may not use this file except in compliance
    11   * with the License.  You may obtain a copy of the License at
    12   *
    13   *   http://www.apache.org/licenses/LICENSE-2.0
    14   *
    15   * Unless required by applicable law or agreed to in writing,
    16   * software distributed under the License is distributed on an
    17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    18   * KIND, either express or implied.  See the License for the
    19   * specific language governing permissions and limitations
    20   * under the License.
    21   */
    22
    23
    24  import org.apache.turbine.services.Service;
    25
    26  /**
    27   * <p> This service provides unique identifiers for the instance of
    28   * Turbine, and for objects it creates.
    29   *
    30   * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
    31   * @version $Id: UniqueIdService.java 1706239 2015-10-01 13:18:35Z tv $
    32   */
    33  public interface UniqueIdService
    34          extends Service
    35  {
    36      /** The service name */
    37      String SERVICE_NAME = "UniqueIdService";
    38
    39      /**
    40       * <p> Returns an identifier of this Turbine instance that is unique
    41       * both on the server and worldwide.
    42       *
    43       * @return A String with the instance identifier.
    44       */
    45      String getInstanceId();
    46
    47      /**
    48       * <p> Returns an identifier that is unique within this Turbine
    49       * instance, but does not have random-like appearance.
    50       *
    51       * <p> This method is intended to work fast; it can be used for
    52       * creating names of temporary files.
    53       *
    54       * @return A String with the non-random looking instance
    55       * identifier.
    56       * */
    57      String getUniqueId();
    58
    59      /**
    60       * <p> Returns a unique identifier that looks like random data.
    61       *
    62       * <p> This method provides identifiers in a way that makes it
    63       * hard to guess or count, but still ensures their uniqueness
    64       * within this instance of Turbine.  It can be used for generating
    65       * cookies or other data that travels back and forth between
    66       * server and browser, and is potentially security sensitive.
    67       *
    68       * @return A String with the random looking instance identifier.
    69       */
    70      String getPseudorandomId();
    71  }