1 /* 2 * $Id$ 3 */ 4 5 package org.apache.maven.model; 6 7 //---------------------------------/ 8 //- Imported classes and packages -/ 9 //---------------------------------/ 10 11 import java.util.Date; 12 13 /** 14 * 15 * 16 * The <code><execution></code> element contains 17 * informations required for the 18 * execution of a plugin. 19 * 20 * 21 * 22 * @version $Revision$ $Date$ 23 */ 24 public class PluginExecution extends ConfigurationContainer 25 implements java.io.Serializable 26 { 27 28 29 //--------------------------/ 30 //- Class/Member Variables -/ 31 //--------------------------/ 32 33 /** 34 * The identifier of this execution for labelling the goals 35 * during the build, 36 * and for matching executions to merge during 37 * inheritance. 38 */ 39 private String id = "default"; 40 41 /** 42 * The build lifecycle phase to bind the goals in this 43 * execution to. If omitted, 44 * the goals will be bound to the default phase 45 * specified in their metadata. 46 */ 47 private String phase; 48 49 /** 50 * Field goals. 51 */ 52 private java.util.List goals; 53 54 55 //-----------/ 56 //- Methods -/ 57 //-----------/ 58 59 /** 60 * Method addGoal. 61 * 62 * @param string 63 */ 64 public void addGoal( String string ) 65 { 66 if ( !(string instanceof String) ) 67 { 68 throw new ClassCastException( "PluginExecution.addGoals(string) parameter must be instanceof " + String.class.getName() ); 69 } 70 getGoals().add( string ); 71 } //-- void addGoal( String ) 72 73 /** 74 * Method getGoals. 75 * 76 * @return java.util.List 77 */ 78 public java.util.List getGoals() 79 { 80 if ( this.goals == null ) 81 { 82 this.goals = new java.util.ArrayList(); 83 } 84 85 return this.goals; 86 } //-- java.util.List getGoals() 87 88 /** 89 * Get the identifier of this execution for labelling the goals 90 * during the build, 91 * and for matching executions to merge during 92 * inheritance. 93 * 94 * @return String 95 */ 96 public String getId() 97 { 98 return this.id; 99 } //-- String getId() 100 101 /** 102 * Get the build lifecycle phase to bind the goals in this 103 * execution to. If omitted, 104 * the goals will be bound to the default phase 105 * specified in their metadata. 106 * 107 * @return String 108 */ 109 public String getPhase() 110 { 111 return this.phase; 112 } //-- String getPhase() 113 114 /** 115 * Method removeGoal. 116 * 117 * @param string 118 */ 119 public void removeGoal( String string ) 120 { 121 if ( !(string instanceof String) ) 122 { 123 throw new ClassCastException( "PluginExecution.removeGoals(string) parameter must be instanceof " + String.class.getName() ); 124 } 125 getGoals().remove( string ); 126 } //-- void removeGoal( String ) 127 128 /** 129 * Set the goals to execute with the given configuration. 130 * 131 * @param goals 132 */ 133 public void setGoals( java.util.List goals ) 134 { 135 this.goals = goals; 136 } //-- void setGoals( java.util.List ) 137 138 /** 139 * Set the identifier of this execution for labelling the goals 140 * during the build, 141 * and for matching executions to merge during 142 * inheritance. 143 * 144 * @param id 145 */ 146 public void setId( String id ) 147 { 148 this.id = id; 149 } //-- void setId( String ) 150 151 /** 152 * Set the build lifecycle phase to bind the goals in this 153 * execution to. If omitted, 154 * the goals will be bound to the default phase 155 * specified in their metadata. 156 * 157 * @param phase 158 */ 159 public void setPhase( String phase ) 160 { 161 this.phase = phase; 162 } //-- void setPhase( String ) 163 164 165 166 public static final String DEFAULT_EXECUTION_ID = "default"; 167 168 169 private String modelEncoding = "UTF-8"; 170 171 /** 172 * Set an encoding used for reading/writing the model. 173 * 174 * @param modelEncoding the encoding used when reading/writing the model. 175 */ 176 public void setModelEncoding( String modelEncoding ) 177 { 178 this.modelEncoding = modelEncoding; 179 } 180 181 /** 182 * @return the current encoding used when reading/writing this model. 183 */ 184 public String getModelEncoding() 185 { 186 return modelEncoding; 187 } 188 }