tasks/ext/XmlPropertyTask.php

Show: inherited
Table of Contents

Task for setting properties from an XML file in buildfiles.

Author
Jonathan Bond-Caron  
Link
http://ant.apache.org/manual/CoreTasks/xmlproperty.html  
Package
phing.tasks.ext  
Since
2.4.0  
Version
$Id: c7a3e7eff0b94828f9ec634c3612d89f2740fead $  

\XmlPropertyTask

Package: phing\tasks\ext

Task for setting properties from an XML file in buildfiles.

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

Parent(s)
\PropertyTask < \Task < \ProjectComponent
Author
Jonathan Bond-Caron  
Copyright
2001,2002 THYRELL. All rights reserved  
Link
http://ant.apache.org/manual/CoreTasks/xmlproperty.html  
Since
2.4.0  
Version
$Id: c7a3e7eff0b94828f9ec634c3612d89f2740fead $  

Properties

Propertyprivate  $_collapseAttr= 'false'
Default valuefalseDetails
Type
n/a
Propertyprivate  $_delimiter= '',''
Default value','Details
Type
n/a
Propertyprivate  $_keepRoot= 'true'
Default valuetrueDetails
Type
n/a
Propertyprivate  $_required= 'false'
Default valuefalseDetails
Type
n/a
Propertyprotectedstring  $description= ''
inherited

Description of the task

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

Stored buildfile location

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

name of the property

Inherited from: \PropertyTask::$$name
Details
Type
n/a
Inherited_from
\PropertyTask::$$name  
Propertyprotected  $override= 'false'
inherited

Whether to force overwrite of existing property.

Inherited from: \PropertyTask::$$override
Default valuefalseDetails
Type
n/a
Inherited_from
\PropertyTask::$$override  
Propertyprotected  $prefix= ''
inheritedInherited from: \PropertyTask::$$prefix
Details
Type
n/a
Inherited_from
\PropertyTask::$$prefix  
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\PropertyTask::$$project
Default valuenullDetails
Type
\Project
Inherited_from
\ProjectComponent::$$project  
Inherited_from
\Task::$$project  
Inherited_from
\PropertyTask::$$project  
Propertyprotected  $ref= ''
inheritedInherited from: \PropertyTask::$$ref
Details
Type
n/a
Inherited_from
\PropertyTask::$$ref  
Propertyprotected  $reference= ''
inheritedInherited from: \PropertyTask::$$reference
Details
Type
n/a
Inherited_from
\PropertyTask::$$reference  
Propertyprotected\Target  $target= ''
inherited

Owning Target object

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

Taskname for logger

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

Internal taskname (req)

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

Whether property should be treated as "user" property.

Inherited from: \PropertyTask::$$userProperty
Default valuefalseDetails
Type
n/a
Inherited_from
\PropertyTask::$$userProperty  
Propertyprotected  $value= ''
inherited

value of the property

Inherited from: \PropertyTask::$$value
Details
Type
n/a
Inherited_from
\PropertyTask::$$value  
Propertyprotected\RuntimeConfigurable  $wrapper= ''
inherited

Wrapper of the task

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

Methods

methodprotected_addNode( \SimpleXMLElement $node, array $path, \Properties $prop ) : void

Adds an XML node

Parameters
Name Type Description
$node \SimpleXMLElement
$path array

Path to this node

$prop \Properties

Properties will be added as they are found (by reference here)

methodprotected_getProperties( string $filePath ) : \Properties

Parses an XML file and returns properties

Parameters
Name Type Description
$filePath string
Returns
Type Description
\Properties
methodprotectedaddProperties(  $props ) : void
inherited

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

Inherited from: \PropertyTask::addProperties()
Parameters
Name Type Description
$props
methodprotectedaddProperty( string $name, string $value ) : void
inherited

add a name value pair to the project property set

Inherited from: \PropertyTask::addProperty()
Parameters
Name Type Description
$name string

name of property

$value string

value to set

methodpublicaddText(  $value ) : void
inherited

Sets value of property to CDATA tag contents.

Inherited from: \PropertyTask::addText()
Parameters
Name Type Description
$value
Details
Since
2.2.0  
methodpublicgetCollapseAttributes( ) : bool

Returns
Type Description
bool
methodpublicgetDelimiter( ) : string

Returns
Type Description
string
methodpublicgetDescription( ) : string
inherited

Returns the textual description of the task

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

Inherited from: \PropertyTask::getEnvironment()
methodpublicgetFallback( ) : void
inherited

Inherited from: \PropertyTask::getFallback()
methodpublicgetFile( ) : void

Get the PhingFile that is being used as property source.

methodpublicgetKeepRoot( ) : bool

Returns
Type Description
bool
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()\PropertyTask::getLocation()
Returns
Type Description
\Location The location object describing the position of this task within the buildfile.
methodpublicgetName( ) : void
inherited

Get property component name.

Inherited from: \PropertyTask::getName()
methodpublicgetOverride( ) : void
inherited

Inherited from: \PropertyTask::getOverride()
methodpublicgetOwningTarget( ) : \Target
inherited

Returns the owning target of this task.

Inherited from: \Task::getOwningTarget()\PropertyTask::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()\PropertyTask::getProject()
Returns
Type Description
\Project Reference to current porject object
methodpublicgetRefid( ) : void
inherited

Inherited from: \PropertyTask::getRefid()
methodprotectedgetRegisterSlot( string $slotName ) : void
inherited

Returns a name

Inherited from: \Task::getRegisterSlot()\PropertyTask::getRegisterSlot()
Parameters
Name Type Description
$slotName string
methodpublicgetRequired( ) : string

Returns
Type Description
string
methodpublicgetRuntimeConfigurableWrapper( ) : \RuntimeConfigurable
inherited

Returns the wrapper object for runtime configuration

Inherited from: \Task::getRuntimeConfigurableWrapper()\PropertyTask::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()\PropertyTask::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()\PropertyTask::getTaskType()
Returns
Type Description
string The type of this task (XML Tag)
methodpublicgetUserProperty( ) : void
inherited

Inherited from: \PropertyTask::getUserProperty()
methodpublicgetValue( ) : void
inherited

Get the value of current property component.

Inherited from: \PropertyTask::getValue()
methodpublicinit( ) : void
inherited

Called by the parser to let the task initialize properly.

Inherited from: \Task::init()\PropertyTask::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
inherited

load the environment values

Inherited from: \PropertyTask::loadEnvironment()
Parameters
Name Type Description
$prefix string

prefix to place before them

methodprotectedloadFile( \PhingFile $file ) : void

load properties from an XML 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()\PropertyTask::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()\PropertyTask::maybeConfigure()
methodprotectedparsePropertyString( string $value, array $fragments, array $propertyRefs ) : void
inherited

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.

Inherited from: \PropertyTask::parsePropertyString()

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()\PropertyTask::perform()
methodprotectedresolveAllProperties( \Properties $props ) : void
inherited

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

Inherited from: \PropertyTask::resolveAllProperties()
Parameters
Name Type Description
$props \Properties

The collection of Properties that need to be resolved.

methodpublicsetCollapseAttributes( bool $yesNo ) : void

Treat attributes as nested elements.

Parameters
Name Type Description
$yesNo bool
methodpublicsetDelimiter( string $d ) : void

Delimiter for splitting multiple values.

Parameters
Name Type Description
$d string
methodpublicsetDescription( string $desc ) : void
inherited

Sets a textual description of the task

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

The text describing the task

methodpublicsetEnvironment( \env $env ) : void
inherited

the prefix to use when retrieving environment variables.

Inherited from: \PropertyTask::setEnvironment()

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
inherited

Inherited from: \PropertyTask::setFallback()
Parameters
Name Type Description
$p \Project
methodpublicsetFile(  $file ) : void

Set a file to use as the source for properties.

Parameters
Name Type Description
$file
methodpublicsetKeepRoot( bool $yesNo ) : void

Keep the xml root tag as the first value in the property name

Parameters
Name Type Description
$yesNo bool
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()\PropertyTask::setLocation()
Parameters
Name Type Description
$location \Location

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

methodpublicsetName(  $name ) : void
inherited

Sets a the name of current property component

Inherited from: \PropertyTask::setName()
Parameters
Name Type Description
$name
methodpublicsetOverride(  $v ) : void
inherited

Inherited from: \PropertyTask::setOverride()
Parameters
Name Type Description
$v
methodpublicsetOwningTarget( \Target $target ) : void
inherited

Sets the owning target this task belongs to.

Inherited from: \Task::setOwningTarget()\PropertyTask::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()\PropertyTask::setProject()
Parameters
Name Type Description
$project \Project

The reference to the current project

methodpublicsetRefid(  $ref ) : void
inherited

Inherited from: \PropertyTask::setRefid()
Parameters
Name Type Description
$ref
methodpublicsetRequired( string $d ) : void

File required or not.

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

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

Inherited from: \Task::setRuntimeConfigurableWrapper()\PropertyTask::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()\PropertyTask::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()\PropertyTask::setTaskType()
Parameters
Name Type Description
$name string

The type of this task (XML Tag)

methodpublicsetUserProperty( boolean $v ) : void
inherited

Set whether this is a user property (ro).

Inherited from: \PropertyTask::setUserProperty()

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
inherited

Sets a the value of current property component.

Inherited from: \PropertyTask::setValue()
Parameters
Name Type Description
$value mixed

Value of name, all scalars allowed

methodpublictoString( ) : void
inherited

Inherited from: \PropertyTask::toString()
Documentation was generated by DocBlox 0.18.1.