001package org.apache.turbine.services.uniqueid;
002
003
004/*
005 * Licensed to the Apache Software Foundation (ASF) under one
006 * or more contributor license agreements.  See the NOTICE file
007 * distributed with this work for additional information
008 * regarding copyright ownership.  The ASF licenses this file
009 * to you under the Apache License, Version 2.0 (the
010 * "License"); you may not use this file except in compliance
011 * with the License.  You may obtain a copy of the License at
012 *
013 *   http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing,
016 * software distributed under the License is distributed on an
017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018 * KIND, either express or implied.  See the License for the
019 * specific language governing permissions and limitations
020 * under the License.
021 */
022
023
024import org.apache.turbine.services.Service;
025
026/**
027 * <p> This service provides unique identifiers for the instance of
028 * Turbine, and for objects it creates.
029 *
030 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
031 * @version $Id$
032 */
033public interface UniqueIdService
034        extends Service
035{
036    /** The service name */
037    String SERVICE_NAME = "UniqueIdService";
038
039    /**
040     * <p> Returns an identifier of this Turbine instance that is unique
041     * both on the server and worldwide.
042     *
043     * @return A String with the instance identifier.
044     */
045    String getInstanceId();
046
047    /**
048     * <p> Returns an identifier that is unique within this Turbine
049     * instance, but does not have random-like appearance.
050     *
051     * <p> This method is intended to work fast; it can be used for
052     * creating names of temporary files.
053     *
054     * @return A String with the non-random looking instance
055     * identifier.
056     * */
057    String getUniqueId();
058
059    /**
060     * <p> Returns a unique identifier that looks like random data.
061     *
062     * <p> This method provides identifiers in a way that makes it
063     * hard to guess or count, but still ensures their uniqueness
064     * within this instance of Turbine.  It can be used for generating
065     * cookies or other data that travels back and forth between
066     * server and browser, and is potentially security sensitive.
067     *
068     * @return A String with the random looking instance identifier.
069     */
070    String getPseudorandomId();
071}