View Javadoc

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