KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > services > uniqueid > UniqueIdService


1 package org.apache.turbine.services.uniqueid;
2
3 /*
4  * Copyright 2001-2004 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,v 1.5.2.2 2004/05/20 03:06:48 seade Exp $
27  */

28 public interface UniqueIdService
29         extends Service
30 {
31     String JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc getPseudorandomId();
65 }
66
Popular Tags