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