Class TurbineUniqueIdService
- java.lang.Object
-
- org.apache.turbine.services.BaseInitable
-
- org.apache.turbine.services.BaseService
-
- org.apache.turbine.services.TurbineBaseService
-
- org.apache.turbine.services.uniqueid.TurbineUniqueIdService
-
- All Implemented Interfaces:
Initable
,Service
,UniqueIdService
public class TurbineUniqueIdService extends TurbineBaseService implements UniqueIdService
This is an implementation of
UniqueIdService
.- Version:
- $Id$
- Author:
- Rafal Krzewski, Henning P. Schmiedehausen
-
-
Field Summary
-
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, serviceBroker
-
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
-
Fields inherited from interface org.apache.turbine.services.Service
SERVICE_NAME
-
Fields inherited from interface org.apache.turbine.services.uniqueid.UniqueIdService
SERVICE_NAME
-
-
Constructor Summary
Constructors Constructor Description TurbineUniqueIdService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getInstanceId()
Returns an identifier of this Turbine instance that is unique both on the server and worldwide.String
getPseudorandomId()
Returns a unique identifier that looks like random data.String
getUniqueId()
Returns an identifier that is unique within this turbine instance, but does not have random-like appearance.void
init()
Initializes the service upon first Turbine.doGet() invocation.void
shutdown()
Writes a message to the log upon system shutdown.-
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init
-
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
-
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
-
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
-
-
-
-
Constructor Detail
-
TurbineUniqueIdService
public TurbineUniqueIdService()
-
-
Method Detail
-
init
public void init() throws InitializationException
Initializes the service upon first Turbine.doGet() invocation.
- Specified by:
init
in interfaceInitable
- Overrides:
init
in classTurbineBaseService
- Throws:
InitializationException
- if initialization of this class was not successful.
-
shutdown
public void shutdown()
Writes a message to the log upon system shutdown.
- Specified by:
shutdown
in interfaceInitable
- Overrides:
shutdown
in classTurbineBaseService
-
getInstanceId
public String getInstanceId()
Returns an identifier of this Turbine instance that is unique both on the server and worldwide. This identifier is computed as an MD5 sum of the URL (including schema, address, port if different that 80/443 respectively, context and servlet name). There is an overwhelming probability that this id will be different that all other Turbine instances online.
- Specified by:
getInstanceId
in interfaceUniqueIdService
- Returns:
- A String with the instance identifier.
-
getUniqueId
public String getUniqueId()
Returns an identifier that is unique within this turbine instance, but does not have random-like appearance.
- Specified by:
getUniqueId
in interfaceUniqueIdService
- Returns:
- A String with the non-random looking instance identifier.
-
getPseudorandomId
public String getPseudorandomId()
Returns a unique identifier that looks like random data.
- Specified by:
getPseudorandomId
in interfaceUniqueIdService
- Returns:
- A String with the random looking instance identifier.
-
-