View Javadoc

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