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.Service;
23:
24: /**
25: * <p> This service provides unique identifiers for the instance of
26: * Turbine, and for objects it creates.
27: *
28: * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
29: * @version $Id: UniqueIdService.java 534527 2007-05-02 16:10:59Z tv $
30: */
31: public interface UniqueIdService extends Service {
32: String SERVICE_NAME = "UniqueIdService";
33:
34: /**
35: * <p> Returs an identifer of this Turbine instance that is unique
36: * both on the server and worldwide.
37: *
38: * @return A String with the instance identifier.
39: */
40: String getInstanceId();
41:
42: /**
43: * <p> Returns an identifier that is unique within this turbine
44: * instance, but does not have random-like apearance.
45: *
46: * <p> This method is intended to work fast; it can be used for
47: * creating names of temporary files.
48: *
49: * @return A String with the non-random looking instance
50: * identifier.
51: * */
52: String getUniqueId();
53:
54: /**
55: * <p> Returns a unique identifier that looks like random data.
56: *
57: * <p> This method provides indentifiers in a way that makes it
58: * hard to guess or count, but still ensures their uniqueness
59: * within this instance of Turbine. It can be used for generating
60: * cookies or other data that travels back and forth between
61: * server and browser, and is potentialy security sensitive.
62: *
63: * @return A String with the random looking instance identifier.
64: */
65: String getPseudorandomId();
66: }
|