phing-tasks-system
[ class tree: phing-tasks-system ] [ index: phing-tasks-system ] [ all elements ]

Class: PropertyTask

Source Location: /tasks/system/PropertyTask.php

Class Overview

ProjectComponent
   |
   --Task
      |
      --PropertyTask

Task for setting properties in buildfiles.


Author(s):

Version:

  • $Revision: 552 $

Copyright:

  • � 2001,2002 THYRELL. All rights reserved

Variables

Methods


Inherited Variables

Inherited Methods

Class: Task

Task::getDescription()
Returns the textual description of the task
Task::getLocation()
Returns the location within the buildfile this task occurs. Used by BuildException to give detailed error messages.
Task::getOwningTarget()
Returns the owning target of this task.
Task::getRegisterSlot()
Returns a name
Task::getRuntimeConfigurableWrapper()
Returns the wrapper object for runtime configuration
Task::getTaskName()
Returns the name of task, used only for log messages
Task::getTaskType()
Returns the name of the task under which it was invoked, usually the XML tagname
Task::init()
Called by the parser to let the task initialize properly.
Task::log()
Provides a project level log event to the task.
Task::main()
Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.
Task::maybeConfigure()
Configure this task if it hasn't been done already.
Task::perform()
Perfrom this task
Task::setDescription()
Sets a textual description of the task
Task::setLocation()
Sets the location within the buildfile this task occurs. Called by the parser to set location information.
Task::setOwningTarget()
Sets the owning target this task belongs to.
Task::setRuntimeConfigurableWrapper()
Sets the wrapper object this task should use for runtime configurable elements.
Task::setTaskName()
Sets the name of this task for log messages
Task::setTaskType()
Sets the type of the task. Usually this is the name of the XML tag

Class: ProjectComponent

ProjectComponent::getProject()
Returns a reference to current project
ProjectComponent::log()
Logs a message with the given priority.
ProjectComponent::setProject()
References the project to the current component.

Class Details

[line 34]
Task for setting properties in buildfiles.



Tags:

author:  Hans Lellelid <hans@xmpl.org>
author:  Andreas Aderhold <andi@binarycloud.com>
version:  $Revision: 552 $
copyright:  � 2001,2002 THYRELL. All rights reserved


[ Top ]


Class Variables

$env =

[line 43]



Tags:

access:  protected

Type:   mixed


[ Top ]

$fallback =

[line 47]



Tags:

access:  protected

Type:   mixed


[ Top ]

$file =

[line 44]



Tags:

access:  protected

Type:   mixed


[ Top ]

$name =

[line 37]

name of the property



Tags:

access:  protected

Type:   mixed


[ Top ]

$override =  false

[line 50]

Whether to force overwrite of existing property.



Tags:

access:  protected

Type:   mixed


[ Top ]

$prefix =

[line 46]



Tags:

access:  protected

Type:   mixed


[ Top ]

$ref =

[line 45]



Tags:

access:  protected

Type:   mixed


[ Top ]

$reference =

[line 42]



Tags:

access:  protected

Type:   mixed


[ Top ]

$userProperty =  false

[line 53]

Whether property should be treated as "user" property.



Tags:

access:  protected

Type:   mixed


[ Top ]

$value =

[line 40]

value of the property



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


method addProperties [line 262]

void addProperties( $props)

iterate through a set of properties,

resolve them then assign them




Tags:

access:  protected


Parameters:

   $props  

[ Top ]

method addProperty [line 279]

void addProperty( string $name, string $value)

add a name value pair to the project property set



Tags:

access:  protected


Parameters:

string   $name   name of property
string   $value   value to set

[ Top ]

method addText [line 80]

void addText( $value, string $values)

Sets value of property to CDATA tag contents.



Tags:

since:  2.2.0
access:  public


Parameters:

string   $values  
   $value  

[ Top ]

method getEnvironment [line 154]

void getEnvironment( )



[ Top ]

method getFallback [line 192]

void getFallback( )



[ Top ]

method getFile [line 98]

void getFile( )

Get the PhingFile that is being used as property source.



[ Top ]

method getName [line 63]

void getName( )

Get property component name.



[ Top ]

method getOverride [line 177]

void getOverride( )



[ Top ]

method getPrefix [line 128]

string getPrefix( )



Tags:

since:  2.0
access:  public


[ Top ]

method getRefid [line 106]

void getRefid( )



[ Top ]

method getUserProperty [line 169]

void getUserProperty( )



[ Top ]

method getValue [line 85]

void getValue( )

Get the value of current property component.



[ Top ]

method loadEnvironment [line 245]

void loadEnvironment( string $prefix)

load the environment values



Tags:

access:  protected


Parameters:

string   $prefix   prefix to place before them

[ Top ]

method loadFile [line 299]

void loadFile( $file)

load properties from a file.



Tags:

access:  protected


Parameters:

PhingFile   $file  

[ Top ]

method main [line 200]

void main( )

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




Overrides Task::main() (Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.)

[ Top ]

method parsePropertyString [line 402]

void parsePropertyString( string $value, array &$fragments, array &$propertyRefs)

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.




Tags:

access:  protected


Parameters:

string   $value   The string to be scanned for property references
array   &$fragments   The found fragments
array   &$propertyRefs   The found refs

[ Top ]

method resolveAllProperties [line 321]

void resolveAllProperties( $props)

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



Tags:

access:  protected


Parameters:

Properties   $props   The collection of Properties that need to be resolved.

[ Top ]

method setEnvironment [line 150]

void setEnvironment( env $env)

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:

env   $env   prefix

[ Top ]

method setFallback [line 188]

void setFallback( Project $p)



Parameters:

Project   $p  

[ Top ]

method setFile [line 90]

void setFile( $file)

Set a file to use as the source for properties.



Parameters:

   $file  

[ Top ]

method setName [line 58]

void setName( $name)

Sets a the name of current property component



Parameters:

   $name  

[ Top ]

method setOverride [line 173]

void setOverride( $v)



Parameters:

   $v  

[ Top ]

method setPrefix [line 117]

void setPrefix( string $prefix)

Prefix to apply to properties loaded using
.

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




Tags:

since:  2.0
access:  public


Parameters:

string   $prefix   prefix string

[ Top ]

method setRefid [line 102]

void setRefid( $ref)



Parameters:

Reference   $ref  

[ Top ]

method setUserProperty [line 165]

void setUserProperty( boolean $v)

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:

boolean   $v  

[ Top ]

method setValue [line 71]

void setValue( mixed $value)

Sets a the value of current property component.



Parameters:

mixed   $value   Value of name, all scalars allowed

[ Top ]

method toString [line 181]

void toString( )



[ Top ]


Documentation generated on Mon, 19 Oct 2009 10:51:50 +0200 by phpDocumentor 1.4.3