001    package 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    
024    import 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: UniqueIdService.java 615328 2008-01-25 20:25:05Z tv $
032     */
033    public interface UniqueIdService
034            extends Service
035    {
036        String SERVICE_NAME = "UniqueIdService";
037    
038        /**
039         * <p> Returs an identifer of this Turbine instance that is unique
040         * both on the server and worldwide.
041         *
042         * @return A String with the instance identifier.
043         */
044        String getInstanceId();
045    
046        /**
047         * <p> Returns an identifier that is unique within this turbine
048         * instance, but does not have random-like apearance.
049         *
050         * <p> This method is intended to work fast; it can be used for
051         * creating names of temporary files.
052         *
053         * @return A String with the non-random looking instance
054         * identifier.
055         * */
056        String getUniqueId();
057    
058        /**
059         * <p> Returns a unique identifier that looks like random data.
060         *
061         * <p> This method provides indentifiers in a way that makes it
062         * hard to guess or count, but still ensures their uniqueness
063         * within this instance of Turbine.  It can be used for generating
064         * cookies or other data that travels back and forth between
065         * server and browser, and is potentialy security sensitive.
066         *
067         * @return A String with the random looking instance identifier.
068         */
069        String getPseudorandomId();
070    }