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

Class: CapsuleTask

Source Location: /tasks/ext/CapsuleTask.php

Class Overview

ProjectComponent
   |
   --Task
      |
      --CapsuleTask

A phing task for generating output by using Capsule.


Author(s):

Version:

  • $Id: CapsuleTask.php 557 2009-08-29 13:54:38Z mrook $

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 37]
A phing task for generating output by using Capsule.

This is based on the interface to TexenTask from Apache's Velocity engine.




Tags:

author:  Hans Lellelid <hans@xmpl.org>
version:  $Id: CapsuleTask.php 557 2009-08-29 13:54:38Z mrook $
copyright:  � 2001,2002 THYRELL. All rights reserved


[ Top ]


Class Variables

$assignedVars = array()

[line 49]

Any vars assigned via the build file.



Tags:

var:  AssignedVar[]
access:  protected

Type:   array


[ Top ]

$context =

[line 43]

Capsule "template" engine.



Tags:

access:  protected

Type:   Capsule


[ Top ]

$contextProperties =

[line 114]

<p>

These are properties that are fed into the initial context from a properties file. This is simply a convenient way to set some values that you wish to make available in the context. </p> <p> These values are not critical, like the template path or output path, but allow a convenient way to set a value that may be specific to a particular generation task. </p> <p> For example, if you are generating scripts to allow user to automatically create a database, then you might want the

  1. $databaseName
to be placed in the initial context so that it is available in a script that might look something like the following:
  1. <pre>
  2.  #!bin/sh
  3.  
  4.  echo mysqladmin create $databaseName
  5.  </pre>
The value of
  1. $databaseName
isn't critical to output, and you obviously don't want to change the ant task to simply take a database name. So initial context values can be set with properties file.




Tags:

access:  protected

Type:   array


[ Top ]

$controlTemplate =

[line 57]

This is the control template that governs the output.

It may or may not invoke the services of worker templates.




Tags:

access:  protected

Type:   string


[ Top ]

$outputDirectory =

[line 71]

This is where texen will place all the output that is a product of the generation process.



Tags:

access:  protected

Type:   string


[ Top ]

$outputFile =

[line 78]

This is the file where the generated text will be placed.



Tags:

access:  protected

Type:   string


[ Top ]

$templatePath =

[line 64]

This is where Velocity will look for templates using the file template loader.



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


method cleanup [line 448]

void cleanup( )

A hook method called at the end of #execute() which can be overridden to perform any necessary cleanup activities (such as the release of database connections, etc.). By default, does nothing.



Tags:

throws:  Exception Problem cleaning up.
access:  protected


[ Top ]

method createAssign [line 284]

void createAssign( )

Creates an "AssignedVar" class.



Tags:

access:  public


[ Top ]

method getContextProperties [line 277]

Properties getContextProperties( )

Get the context properties that will be fed into the initial context be the generating process starts.



Tags:

access:  public


[ Top ]

method getControlTemplate [line 136]

string getControlTemplate( )

Get the control template for the generating process.



Tags:

access:  public


[ Top ]

method getOutputDirectory [line 203]

string getOutputDirectory( )

Get the output directory.



Tags:

access:  public


[ Top ]

method getOutputFile [line 222]

string getOutputFile( )

Get the output file for the generation process.



Tags:

access:  public


[ Top ]

method getTemplatePath [line 174]

string getTemplatePath( )

Get the path where Velocity will look for templates using the file template loader.



Tags:

access:  public


[ Top ]

method initControlContext [line 301]

Smarty initControlContext( )

Creates a Smarty object.



Tags:

return:  initialized (cleared) Smarty context.
throws:  Exception the execute method will catch and rethrow as a
access:  public


[ Top ]

method main [line 316]

void main( )

Execute the input script with Velocity



Tags:

throws:  BuildException BuildExceptions are thrown when required attributes are missing. Exceptions thrown by Velocity are rethrown as BuildExceptions.
access:  public


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 populateInitialContext [line 435]

void populateInitialContext( $context)

Place useful objects into the initial context.



Tags:

throws:  Exception Error while populating context. The #main() method will catch and rethrow as a
.
access:  protected


Parameters:

Capsule   $context   The context to populate, as retrieved from #initControlContext().

[ Top ]

method setContextProperties [line 233]

void setContextProperties( string $file)

Set the context properties that will be fed into the initial context be the generating process starts.



Tags:

access:  public


Parameters:

string   $file  

[ Top ]

method setControlTemplate [line 127]

void setControlTemplate( string $controlTemplate)

[REQUIRED] Set the control template for the generating process.



Tags:

access:  public


Parameters:

string   $controlTemplate  

[ Top ]

method setOutputDirectory [line 185]

void setOutputDirectory( $outputDirectory)

[REQUIRED] Set the output directory. It will be created if it doesn't exist.



Tags:

throws:  Exception
access:  public


Parameters:

PhingFile   $outputDirectory  

[ Top ]

method setOutputFile [line 213]

void setOutputFile( string $outputFile)

[REQUIRED] Set the output file for the generation process.



Tags:

access:  public


Parameters:

string   $outputFile   (TODO: change this to File)

[ Top ]

method setTemplatePath [line 147]

void setTemplatePath( $templatePath)

[REQUIRED] Set the path where Velocity will look for templates using the file template loader.



Tags:

throws:  Exception
access:  public


Parameters:

   $templatePath  

[ Top ]


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