01: package org.apache.turbine.services.uniqueid;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
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.TurbineServices;
20:
21: /**
22: * This is a facade class for {@link UniqueIdService}.
23: *
24: * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
25: * @version $Id: TurbineUniqueId.java 264148 2005-08-29 14:21:04Z henning $
26: */
27: public abstract class TurbineUniqueId {
28: /**
29: * Utility method for accessing the service
30: * implementation
31: *
32: * @return a UniqueIdService implementation instance
33: */
34: protected static UniqueIdService getService() {
35: return (UniqueIdService) TurbineServices.getInstance()
36: .getService(UniqueIdService.SERVICE_NAME);
37: }
38:
39: /**
40: * <p> Returs an identifer of this Turbine instance that is unique
41: * both on the server and worldwide.
42: *
43: * @return A String with the instance identifier.
44: */
45: public static String getInstanceId() {
46: return getService().getInstanceId();
47: }
48:
49: /**
50: * <p> Returns an identifier that is unique within this turbine
51: * instance, but does not have random-like apearance.
52: *
53: * @return A String with the non-random looking instance
54: * identifier.
55: */
56: public static String getUniqueId() {
57: return getService().getUniqueId();
58: }
59:
60: /**
61: * <p> Returns a unique identifier that looks like random data.
62: *
63: * @return A String with the random looking instance identifier.
64: */
65: public static String getPseudorandomId() {
66: return getService().getPseudorandomId();
67: }
68: }
|