1 package org.apache.turbine.services.uniqueid;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.turbine.services.TurbineServices;
22
23 /***
24 * This is a facade class for {@link UniqueIdService}.
25 *
26 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
27 * @version $Id: TurbineUniqueId.java 222043 2004-12-06 17:47:33Z painter $
28 */
29 public abstract class TurbineUniqueId
30 {
31 /***
32 * Utility method for accessing the service
33 * implementation
34 *
35 * @return a UniqueIdService implementation instance
36 */
37 protected static UniqueIdService getService()
38 {
39 return (UniqueIdService) TurbineServices
40 .getInstance().getService(UniqueIdService.SERVICE_NAME);
41 }
42
43 /***
44 * <p> Returs an identifer of this Turbine instance that is unique
45 * both on the server and worldwide.
46 *
47 * @return A String with the instance identifier.
48 */
49 public static String getInstanceId()
50 {
51 return getService().getInstanceId();
52 }
53
54 /***
55 * <p> Returns an identifier that is unique within this turbine
56 * instance, but does not have random-like apearance.
57 *
58 * @return A String with the non-random looking instance
59 * identifier.
60 */
61 public static String getUniqueId()
62 {
63 return getService().getUniqueId();
64 }
65
66 /***
67 * <p> Returns a unique identifier that looks like random data.
68 *
69 * @return A String with the random looking instance identifier.
70 */
71 public static String getPseudorandomId()
72 {
73 return getService().getPseudorandomId();
74 }
75 }