01: package org.apache.turbine.services.uniqueid;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
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: * Utility method for accessing the service
33: * implementation
34: *
35: * @return a UniqueIdService implementation instance
36: */
37: protected static UniqueIdService getService() {
38: return (UniqueIdService) TurbineServices.getInstance()
39: .getService(UniqueIdService.SERVICE_NAME);
40: }
41:
42: /**
43: * <p> Returs an identifer of this Turbine instance that is unique
44: * both on the server and worldwide.
45: *
46: * @return A String with the instance identifier.
47: */
48: public static String getInstanceId() {
49: return getService().getInstanceId();
50: }
51:
52: /**
53: * <p> Returns an identifier that is unique within this turbine
54: * instance, but does not have random-like apearance.
55: *
56: * @return A String with the non-random looking instance
57: * identifier.
58: */
59: public static String getUniqueId() {
60: return getService().getUniqueId();
61: }
62:
63: /**
64: * <p> Returns a unique identifier that looks like random data.
65: *
66: * @return A String with the random looking instance identifier.
67: */
68: public static String getPseudorandomId() {
69: return getService().getPseudorandomId();
70: }
71: }
|