tasks/system/PropertyTask.php

Show: inherited
Table of Contents

Task for setting properties in buildfiles.

Author
Andreas Aderhold  
Author
Hans Lellelid  
Package
phing.tasks.system  
Version
$Id: e6d7123b6331d5032ad1e67967cf54ef2aae3f7f $  

\PropertyTask

Package: phing\tasks\system

Task for setting properties in buildfiles.

Use {@link Project#createTask} to register a new Task.

Parent(s)
\Task < \ProjectComponent
Children
\XmlPropertyTask
Author
Andreas Aderhold  
Author
Hans Lellelid  
Copyright
2001,2002 THYRELL. All rights reserved  
Version
$Id: e6d7123b6331d5032ad1e67967cf54ef2aae3f7f $  

Properties

Propertyprotectedstring  $description= ''
inherited

Description of the task

Inherited from: \Task::$$description
Details
Type
string
Inherited_from
\Task::$$description  
Propertyprotected  $env= ''
Details
Type
n/a
Propertyprotected  $fallback= ''
Details
Type
n/a
Propertyprotected  $file= ''
Details
Type
n/a
Propertyprotected\Location  $location= ''
inherited

Stored buildfile location

Inherited from: \Task::$$location
Details
Type
\Location
Inherited_from
\Task::$$location  
Propertyprotected  $name= ''

name of the property

Details
Type
n/a
Propertyprotected  $override= 'false'

Whether to force overwrite of existing property.

Default valuefalseDetails
Type
n/a
Propertyprotected  $prefix= ''
Details
Type
n/a
Propertyprotected\Project  $project= 'null'
inherited

Holds a reference to the project that a project component (a task, a target, etc.) belongs to

A reference to the current project instanceInherited from: \ProjectComponent::$$project\Task::$$project
Default valuenullDetails
Type
\Project
Inherited_from
\ProjectComponent::$$project  
Inherited_from
\Task::$$project  
Propertyprotected  $ref= ''
Details
Type
n/a
Propertyprotected  $reference= ''
Details
Type
n/a
Propertyprotected\Target  $target= ''
inherited

Owning Target object

Inherited from: \Task::$$target
Details
Type
\Target
Inherited_from
\Task::$$target  
Propertyprotectedstring  $taskName= ''
inherited

Taskname for logger

Inherited from: \Task::$$taskName
Details
Type
string
Inherited_from
\Task::$$taskName  
Propertyprotectedstring  $taskType= ''
inherited

Internal taskname (req)

Inherited from: \Task::$$taskType
Details
Type
string
Inherited_from
\Task::$$taskType  
Propertyprotected  $userProperty= 'false'

Whether property should be treated as "user" property.

Default valuefalseDetails
Type
n/a
Propertyprotected  $value= ''

value of the property

Details
Type
n/a
Propertyprotected\RuntimeConfigurable  $wrapper= ''
inherited

Wrapper of the task

Inherited from: \Task::$$wrapper
Details
Type
\RuntimeConfigurable
Inherited_from
\Task::$$wrapper  

Methods

methodprotectedaddProperties(  $props ) : void

iterate through a set of properties, resolve them then assign them

Parameters
Name Type Description
$props
methodprotectedaddProperty( string $name, string $value ) : void

add a name value pair to the project property set

Parameters
Name Type Description
$name string

name of property

$value string

value to set

methodpublicaddText(  $value ) : void

Sets value of property to CDATA tag contents.

Parameters
Name Type Description
$value
Details
Since
2.2.0  
methodpublicgetDescription( ) : string
inherited

Returns the textual description of the task

Inherited from: \Task::getDescription()
Returns
Type Description
string The text description of the task
methodpublicgetEnvironment( ) : void

methodpublicgetFallback( ) : void

methodpublicgetFile( ) : void

Get the PhingFile that is being used as property source.

methodpublicgetLocation( ) : \Location
inherited

Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

Inherited from: \Task::getLocation()
Returns
Type Description
\Location The location object describing the position of this task within the buildfile.
methodpublicgetName( ) : void

Get property component name.

methodpublicgetOverride( ) : void

methodpublicgetOwningTarget( ) : \Target
inherited

Returns the owning target of this task.

Inherited from: \Task::getOwningTarget()
Returns
Type Description
\Target The target object that owns this task
methodpublicgetPrefix( ) : string

Returns
Type Description
string
Details
Since
2.0  
methodpublicgetProject( ) : \Project
inherited

Returns a reference to current project

Inherited from: \ProjectComponent::getProject()\Task::getProject()
Returns
Type Description
\Project Reference to current porject object
methodpublicgetRefid( ) : void

methodprotectedgetRegisterSlot( string $slotName ) : void
inherited

Returns a name

Inherited from: \Task::getRegisterSlot()
Parameters
Name Type Description
$slotName string
methodpublicgetRuntimeConfigurableWrapper( ) : \RuntimeConfigurable
inherited

Returns the wrapper object for runtime configuration

Inherited from: \Task::getRuntimeConfigurableWrapper()
Returns
Type Description
\RuntimeConfigurable The wrapper object used by this task
methodpublicgetTaskName( ) : string
inherited

Returns the name of task, used only for log messages

Inherited from: \Task::getTaskName()
Returns
Type Description
string Name of this task
methodpublicgetTaskType( ) : string
inherited

Returns the name of the task under which it was invoked, usually the XML tagname

Inherited from: \Task::getTaskType()
Returns
Type Description
string The type of this task (XML Tag)
methodpublicgetUserProperty( ) : void

methodpublicgetValue( ) : void

Get the value of current property component.

methodpublicinit( ) : void
inherited

Called by the parser to let the task initialize properly.

Inherited from: \Task::init()

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

Throws
Exception Description
\BuildException
methodprotectedloadEnvironment( string $prefix ) : void

load the environment values

Parameters
Name Type Description
$prefix string

prefix to place before them

methodprotectedloadFile( \PhingFile $file ) : void

load properties from a file.

Parameters
Name Type Description
$file \PhingFile
methodpubliclog( string $msg, integer $level = Project::MSG_INFO ) : void
inherited

Provides a project level log event to the task.

Inherited from: \Task::log()
Parameters
Name Type Description
$msg string

The message to log

$level integer

The priority of the message

Details
See
\BuildEvent  
See
\BuildListener  
methodpublicmain( ) : void

set the property in the project to the value.

if the task was give a file or env attribute here is where it is loaded

methodpublicmaybeConfigure( ) : void
inherited

Configure this task if it hasn't been done already.

Inherited from: \Task::maybeConfigure()
methodprotectedparsePropertyString( string $value, array $fragments, array $propertyRefs ) : void

This method will parse a string containing ${value} style property values into two lists. The first list is a collection of text fragments, while the other is a set of string property names null entries in the first list indicate a property reference from the second list.

This is slower than regex, but useful for this class, which has to handle multiple parsing passes for properties.

Parameters
Name Type Description
$value string

The string to be scanned for property references

$fragments array

&$fragments The found fragments

$propertyRefs array

&$propertyRefs The found refs

methodpublicperform( ) : void
inherited

Perfrom this task

Inherited from: \Task::perform()
methodprotectedresolveAllProperties( \Properties $props ) : void

Given a Properties object, this method goes through and resolves any references to properties within the object.

Parameters
Name Type Description
$props \Properties

The collection of Properties that need to be resolved.

methodpublicsetDescription( string $desc ) : void
inherited

Sets a textual description of the task

Inherited from: \Task::setDescription()
Parameters
Name Type Description
$desc string

The text describing the task

methodpublicsetEnvironment( \env $env ) : void

the prefix to use when retrieving environment variables.

Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".

<

p> Note that if you supply a property name with a final "." it will not be doubled. ie environment="myenv." will still allow access of environment variables through "myenv.PATH" and "myenv.TERM". This functionality is currently only implemented on select platforms. Feel free to send patches to increase the number of platforms this functionality is supported on ;).
Note also that properties are case sensitive, even if the environment variables on your operating system are not, e.g. it will be ${env.Path} not ${env.PATH} on Windows 2000.

Parameters
Name Type Description
$env \env

prefix

methodpublicsetFallback( \Project $p ) : void

Parameters
Name Type Description
$p \Project
methodpublicsetFile(  $file ) : void

Set a file to use as the source for properties.

Parameters
Name Type Description
$file
methodpublicsetLocation( \Location $location ) : void
inherited

Sets the location within the buildfile this task occurs. Called by the parser to set location information.

Inherited from: \Task::setLocation()
Parameters
Name Type Description
$location \Location

The location object describing the position of this task within the buildfile.

methodpublicsetName(  $name ) : void

Sets a the name of current property component

Parameters
Name Type Description
$name
methodpublicsetOverride(  $v ) : void

Parameters
Name Type Description
$v
methodpublicsetOwningTarget( \Target $target ) : void
inherited

Sets the owning target this task belongs to.

Inherited from: \Task::setOwningTarget()
Parameters
Name Type Description
$target \Target

Reference to owning target

methodpublicsetPrefix( string $prefix ) : void

Prefix to apply to properties loaded using file.

A "." is appended to the prefix if not specified.

Parameters
Name Type Description
$prefix string

prefix string

Details
Since
2.0  
methodpublicsetProject( \Project $project ) : void
inherited

References the project to the current component.

Inherited from: \ProjectComponent::setProject()\Task::setProject()
Parameters
Name Type Description
$project \Project

The reference to the current project

methodpublicsetRefid(  $ref ) : void

Parameters
Name Type Description
$ref
methodpublicsetRuntimeConfigurableWrapper( \RuntimeConfigurable $wrapper ) : void
inherited

Sets the wrapper object this task should use for runtime configurable elements.

Inherited from: \Task::setRuntimeConfigurableWrapper()
Parameters
Name Type Description
$wrapper \RuntimeConfigurable

The wrapper object this task should use

methodpublicsetTaskName( string $name ) : string
inherited

Sets the name of this task for log messages

Inherited from: \Task::setTaskName()
Parameters
Name Type Description
$name string
Returns
Type Description
string A string representing the name of this task for log
methodpublicsetTaskType( string $name ) : void
inherited

Sets the type of the task. Usually this is the name of the XML tag

Inherited from: \Task::setTaskType()
Parameters
Name Type Description
$name string

The type of this task (XML Tag)

methodpublicsetUserProperty( boolean $v ) : void

Set whether this is a user property (ro).

This is deprecated in Ant 1.5, but the userProperty attribute of the class is still being set via constructor, so Phing will allow this method to function.

Parameters
Name Type Description
$v boolean
methodpublicsetValue( mixed $value ) : void

Sets a the value of current property component.

Parameters
Name Type Description
$value mixed

Value of name, all scalars allowed

methodpublictoString( ) : void

Documentation was generated by DocBlox 0.18.1.