org.apache.turbine.services.uniqueid
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: TurbineUniqueIdService.java,v 1.1.1.1 2001/08/16 05:09:23 jvanzyl Exp $
Author:
Rafal Krzewski

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, properties, 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()
           Returs an identifer 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(RunData data)
           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, 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, registerNatives, 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, 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)

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

Overrides:
init in class TurbineBaseService
Parameters:
data - A Turbine RunData object.

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()

Returs an identifer 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, addres, 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-2002 Apache Software Foundation. All Rights Reserved.