org.apache.turbine.services.uniqueid
Class TurbineUniqueIdService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.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: TurbineUniqueIdService.java 534527 2007-05-02 16:10:59Z tv $
Author:
Rafal Krzewski, Henning P. Schmiedehausen

Field Summary
protected static int counter
           
protected static java.lang.String turbineId
          The identifier of this instance of turbine.
protected static java.lang.String turbineURL
           
 
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.uniqueid.UniqueIdService
SERVICE_NAME
 
Constructor Summary
TurbineUniqueIdService()
           
 
Method Summary
 java.lang.String getInstanceId()
           Returns an identifier of this Turbine instance that is unique both on the server and worldwide.
 java.lang.String getPseudorandomId()
           Returns a unique identifier that looks like random data.
 java.lang.String getUniqueId()
           Returns an identifier that is unique within this turbine instance, but does not have random-like apearance.
 void init()
           Initializes the service upon first Turbine.doGet() invocation.
 void init(RunData data)
          Performs early initialization.
 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.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
 

Field Detail

turbineId

protected static java.lang.String turbineId
The identifier of this instance of turbine.


turbineURL

protected static java.lang.String turbineURL

counter

protected static int counter
Constructor Detail

TurbineUniqueIdService

public TurbineUniqueIdService()
Method Detail

init

public void init(RunData data)
          throws InitializationException
Deprecated. Use init() instead

Description copied from class: TurbineBaseService
Performs early initialization.

Overrides:
init in class TurbineBaseService
Parameters:
data - An RunData to use for initialization activities.
Throws:
InitializationException - if initialization of this class was not successful.

init

public void init()
          throws InitializationException

Initializes the service upon first Turbine.doGet() invocation.

Specified by:
init in interface Initable
Overrides:
init in class TurbineBaseService
Throws:
InitializationException

shutdown

public void shutdown()

Writes a message to the log upon system shutdown.

Specified by:
shutdown in interface Initable
Overrides:
shutdown in class TurbineBaseService

getInstanceId

public java.lang.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 respecively, context and servlet name). There is an overwhelming probalility that this id will be different that all other Turbine instances online.

Specified by:
getInstanceId in interface UniqueIdService
Returns:
A String with the instance identifier.

getUniqueId

public java.lang.String getUniqueId()

Returns an identifier that is unique within this turbine instance, but does not have random-like apearance.

Specified by:
getUniqueId in interface UniqueIdService
Returns:
A String with the non-random looking instance identifier.

getPseudorandomId

public java.lang.String getPseudorandomId()

Returns a unique identifier that looks like random data.

Specified by:
getPseudorandomId in interface UniqueIdService
Returns:
A String with the random looking instance identifier.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.