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 615328 2008-01-25 20:25:05Z tv $
    32   */
    33  public interface UniqueIdService
    34          extends Service
    35  {
    36      String SERVICE_NAME = "UniqueIdService";
    37
    38      /**
    39       * <p> Returs an identifer of this Turbine instance that is unique
    40       * both on the server and worldwide.
    41       *
    42       * @return A String with the instance identifier.
    43       */
    44      String getInstanceId();
    45
    46      /**
    47       * <p> Returns an identifier that is unique within this turbine
    48       * instance, but does not have random-like apearance.
    49       *
    50       * <p> This method is intended to work fast; it can be used for
    51       * creating names of temporary files.
    52       *
    53       * @return A String with the non-random looking instance
    54       * identifier.
    55       * */
    56      String getUniqueId();
    57
    58      /**
    59       * <p> Returns a unique identifier that looks like random data.
    60       *
    61       * <p> This method provides indentifiers in a way that makes it
    62       * hard to guess or count, but still ensures their uniqueness
    63       * within this instance of Turbine.  It can be used for generating
    64       * cookies or other data that travels back and forth between
    65       * server and browser, and is potentialy security sensitive.
    66       *
    67       * @return A String with the random looking instance identifier.
    68       */
    69      String getPseudorandomId();
    70  }