##### General Information

- Overview
- Features
- Specification
- Getting Started
- Howto Build Turbine
- Changes

##### Documentation

- Services
  - Assembler Broker Service
  - Avalon Component Service
  - Crypto Service
  - Cache Service
  - Component Service
  - Factory Service
  - Intake Service
  - JSON-RPC Service
  - JSP Service
  - Localization Service
  - MimeType Service
  - Naming Service
  - Parser Service
  - Pool Service
  - Pull Service
  - RunData Service
  - Scheduler Service
  - Security Service
  - Servlet Service
  - Session Service
  - Template Service
  - Torque Security Service
  - Torque Security Service Schema
  - UI Service
  - Unique ID Service
  - Upload Service
  - Velocity Service
  - XML-RPC Service
  - XSLT Service
- Howtos
- Wiki
- JavaDocs

##### Development

- Proposals
- How To Help
- Todo

##### Project Documentation

- Project Information
- Project Reports

##### Apache

- Apache Website
- License
- How the ASF works
- Sponsorship
- Thanks
- Security

## Unique ID Service

The UniqueId Service is an identifier generator that provides access to Turbine instance specific ID's in several different formats.

## Configuration

    # -------------------------------------------------------------------
    #
    #  S E R V I C E S
    #
    # -------------------------------------------------------------------
    # Classes for Turbine Services should be defined here.
    # Format: services.[name].classname=[implementing class]
    #
    # To specify properties of a service use the following syntax:
    # service.[name].[property]=[value]

    services.UniqueIdService.classname=org.apache.turbine.services.uniqueid.TurbineUniqueIdService
    .
    .
    .

## Usage

The Facade class, TurbineUniqueId, exposes three methods that produce unique identifiers:

- getInstanceId() returns an identifier for this Turbine instance that is unique both on the server and worldwide.
- getPseudorandomId() returns a unique identifier that looks like random data.
- getUniqueId() returns an identifier that is unique within this instance but does not have random-like appearance.

As an example of the output for these Id's, the following is a screen:

     public class IdExample extends VelocityScreen
     {

        public void doBuildTemplate(RunData data , Context context)
            throws Exception
        {

            context.put("instanceid", TurbineUniqueId.getInstanceId());
            context.put("pseudorandomid", TurbineUniqueId.getPseudorandomId());
            context.put("uniqueid", TurbineUniqueId.getUniqueId());

            super.doBuildTemplate(data,context);

        }
     }

With the Velocity template IdExample.vm being:

     InstanceId() Output example  = $instanceid

     <br />

     PseudorandomId() Output example  = $pseudorandom

     <br />

     UniqueId() Output example  = $uniqueid

The output is:

     InstanceId() Output example  = EC77218EC1291E714260FDF04BCB5008
     PseudorandomId() Output example  = otzhj954w1
     UniqueId() Output example  = 00000000

Internally Turbine uses the service for naming of temporary files stored on the server as part of the Upload Service. The FileItem is named with the getInstanceId() method to avoid temporary file clashes until the system retrieves the file.