org.apache.commons.id.uuid.task
Class UUIDTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.commons.id.uuid.task.UUIDTask

public class UUIDTask
extends org.apache.tools.ant.Task

Simple Ant task to generate a UUID. See the following Ant script for usage:

  <project default="generate.uuid" name="uuid" basedir=".">
  
    <taskdef name="uuid" className="org.apache.commons.id.uuid.task.UUIDTask"/>
  
    <target name="generate.uuid" description="Generates a UUID">
      <uuid version="VERSION_ONE"/>
      <echo message="${uuid}"/> 
      <uuid version="VERSION_THREE"/> 
      <echo message="${uuid}"/>
      <uuid version="VERSION_FOUR"/> 
      <echo message="${uuid}"/>
      <uuid version="VERSION_FIVE"/> 
      <echo message="${uuid}"/>
    </target>
  </project>
 
The namespace urn:uuid:B4F00409-CEF8-4822-802C-DEB20704C365 and the name www.apache.org is used as default to generate the UUIDs for version 3 and 5.

Since:
1.0
Version:
$Id: UUIDTask.java 480488 2006-11-29 08:57:26Z bayard $

Nested Class Summary
static class UUIDTask.UUIDVersion
          The enum for the UUID version.
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
UUIDTask()
           
 
Method Summary
 void execute()
           
 void setName(java.lang.String name)
          Setter for the name used to generate a UUID version 3 or 5.
 void setNamespace(java.lang.String namespace)
          Setter for the namespace used to generate a UUID version 3 or 5.
 void setVersion(UUIDTask.UUIDVersion newVersion)
          Set the UUID version to generate.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UUIDTask

public UUIDTask()
Method Detail

setName

public void setName(java.lang.String name)
Setter for the name used to generate a UUID version 3 or 5.

Parameters:
name - the name ot use
Since:
1.0

setNamespace

public void setNamespace(java.lang.String namespace)
Setter for the namespace used to generate a UUID version 3 or 5.

Parameters:
namespace - the name ot use
Since:
1.0

setVersion

public void setVersion(UUIDTask.UUIDVersion newVersion)
Set the UUID version to generate.

Parameters:
newVersion - the UUID version
Since:
1.0

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException


Copyright 2003-2008 The Apache Software Foundation. All Rights Reserved.