org.apache.tools.ant.taskdefs.optional.perforce

Class P4Counter


public class P4Counter
extends P4Base

Obtains or sets the value of a counter.

When used in its base form (where only the counter name is provided), the counter value will be printed to the output stream. When the value is provided, the counter will be set to the value provided. When a property name is provided, the property will be filled with the value of the counter. You may not specify to both get and set the value of the counter in the same Task.

The user performing this task must have Perforce "review" permissions as defined by Perforce protections in order for this task to succeed. Example Usage:
<p4counter name="${p4.counter}" property=${p4.change}"/>

Field Summary

String
counter
name of the counter
String
property
name of an optional property
boolean
shouldSetProperty
flag telling whether a property should be set
boolean
shouldSetValue
flag telling whether the value of the counter should be set
int
value
new value for the counter

Fields inherited from class org.apache.tools.ant.taskdefs.optional.perforce.P4Base

P4Client, P4CmdOpts, P4Opts, P4Port, P4User, P4View, failOnError, shell, util

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

Method Summary

void
execute()
again, properties are mutable in this tsk
void
setName(String counter)
The name of the counter; required
void
setProperty(String property)
A property to be set with the value of the counter
void
setValue(int value)
The new value for the counter; optional.

Methods inherited from class org.apache.tools.ant.taskdefs.optional.perforce.P4Base

execP4Command, execP4Command, getErrorMessage, getInError, init, setClient, setCmdopts, setErrorMessage, setFailonerror, setGlobalopts, setInError, setPort, setUser, setView

Methods inherited from class org.apache.tools.ant.Task

execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

Methods inherited from class org.apache.tools.ant.ProjectComponent

getProject, log, log, setProject

Field Details

counter

public String counter
name of the counter


property

public String property
name of an optional property


shouldSetProperty

public boolean shouldSetProperty
flag telling whether a property should be set


shouldSetValue

public boolean shouldSetValue
flag telling whether the value of the counter should be set


value

public int value
new value for the counter

Method Details

execute

public void execute()
            throws BuildException
again, properties are mutable in this tsk
Overrides:
execute in interface Task

Throws:
BuildException - if the required parameters are not supplied.


setName

public void setName(String counter)
The name of the counter; required

Parameters:
counter - name of the counter


setProperty

public void setProperty(String property)
A property to be set with the value of the counter

Parameters:
property - the name of a property to set with the value of the counter


setValue

public void setValue(int value)
The new value for the counter; optional.

Parameters:
value - new value for the counter


Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.