[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * $Id: BuildEvent.php 3076 2006-12-18 08:52:12Z fabien $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/system/lang/EventObject.php'; 23 24 /** 25 * Encapsulates a build specific event. 26 * 27 * <p>We have three sources of events all handled by this class: 28 * 29 * <ul> 30 * <li>Project level events</li> 31 * <li>Target level events</li> 32 * <li>Task level events</li> 33 * </ul> 34 * 35 * <p> Events are all fired from the project class by creating an event object 36 * using this class and passing it to the listeners. 37 * 38 * @author Andreas Aderhold <andi@binarycloud.com> 39 * @author Hans Lellelid <hans@xmpl.org> 40 * @version $Revision: 1.10 $ 41 * @package phing 42 */ 43 class BuildEvent extends EventObject { 44 45 /** 46 * A reference to the project 47 * @var Project 48 */ 49 protected $project; 50 51 /** 52 * A reference to the target 53 * @var Target 54 */ 55 protected $target; 56 57 /** 58 * A reference to the task 59 * 60 * @var Task 61 */ 62 protected $task; 63 64 /** 65 * The message of this event, if the event is a message 66 * @var string 67 * @access private 68 */ 69 protected $message = null; 70 71 /** 72 * The priority of the message 73 * 74 * @var string 75 * @see $message 76 * @access private 77 */ 78 protected $priority = PROJECT_MSG_VERBOSE; 79 80 /** 81 * The execption that caused the event, if any 82 * 83 * @var object 84 * @access private 85 */ 86 protected $exception = null; 87 88 /** 89 * Construct a BuildEvent for a project, task or target source event 90 * 91 * @param object project the project that emitted the event. 92 * @access public 93 */ 94 function __construct($source) { 95 parent::__construct($source); 96 if ($source instanceof Project) { 97 $this->project = $source; 98 $this->target = null; 99 $this->task = null; 100 } elseif ($source instanceof Target) { 101 $this->project = $source->getProject(); 102 $this->target = $source; 103 $this->task = null; 104 } elseif ($source instanceof Task) { 105 $this->project = $source->getProject(); 106 $this->target = $source->getOwningTarget(); 107 $this->task = $source; 108 } else { 109 throw new Exception("Can not construct BuildEvent, unknown source given."); 110 } 111 } 112 113 /** 114 * Sets the message with details and the message priority for this event. 115 * 116 * @param string The string message of the event 117 * @param integer The priority this message should have 118 */ 119 function setMessage($message, $priority) { 120 $this->message = (string) $message; 121 $this->priority = (int) $priority; 122 } 123 124 /** 125 * Set the exception that was the cause of this event. 126 * 127 * @param Exception The exception that caused the event 128 */ 129 function setException($exception) { 130 $this->exception = $exception; 131 } 132 133 /** 134 * Returns the project instance that fired this event. 135 * 136 * The reference to the project instance is set by the constructor if this 137 * event was fired from the project class. 138 * 139 * @return Project The project instance that fired this event 140 */ 141 function getProject() { 142 return $this->project; 143 } 144 145 /** 146 * Returns the target instance that fired this event. 147 * 148 * The reference to the target instance is set by the constructor if this 149 * event was fired from the target class. 150 * 151 * @return object The target that fired this event 152 * @access public 153 */ 154 function getTarget() { 155 return $this->target; 156 } 157 158 /** 159 * Returns the target instance that fired this event. 160 * 161 * The reference to the task instance is set by the constructor if this 162 * event was fired within a task. 163 * 164 * @return object The task that fired this event 165 * @access public 166 */ 167 function getTask() { 168 return $this->task; 169 } 170 171 /** 172 * Returns the logging message. This field will only be set for 173 * "messageLogged" events. 174 * 175 * @return string The log message 176 * @access public 177 */ 178 function getMessage() { 179 return $this->message; 180 } 181 182 /** 183 * Returns the priority of the logging message. This field will only 184 * be set for "messageLogged" events. 185 * 186 * @return integer The message priority 187 * @access public 188 */ 189 function getPriority() { 190 return $this->priority; 191 } 192 193 /** 194 * Returns the exception that was thrown, if any. 195 * This field will only be set for "taskFinished", "targetFinished", and 196 * "buildFinished" events. 197 * 198 * @see BuildListener::taskFinished() 199 * @see BuildListener::targetFinished() 200 * @see BuildListener::buildFinished() 201 */ 202 function getException() { 203 return $this->exception; 204 } 205 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |