View Javadoc

1   package org.apache.maven.plugin;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugin.descriptor.MojoDescriptor;
23  import org.codehaus.plexus.util.xml.Xpp3Dom;
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  /**
29   * Describes a single mojo invocation.
30   *
31   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
32   * @version $Id: MojoExecution.java 788791 2009-06-26 17:55:26Z jdcasey $
33   */
34  public class MojoExecution
35  {
36      public static final String DEFAULT_EXEC_ID_PREFIX = "default-";
37  
38      public static final String CLI_EXECUTION_ID = DEFAULT_EXEC_ID_PREFIX + "cli";
39  
40      // Execution ID needs to default to "default" to allow configuration of that execution alongside
41      // other executions.
42      private final String executionId;
43  
44      private final MojoDescriptor mojoDescriptor;
45  
46      private Xpp3Dom configuration;
47  
48      private List forkedExecutions = new ArrayList();
49  
50      private List reports;
51  
52      public MojoExecution( MojoDescriptor mojoDescriptor )
53      {
54          this.mojoDescriptor = mojoDescriptor;
55          this.configuration = null;
56          this.executionId = DEFAULT_EXEC_ID_PREFIX + mojoDescriptor.getGoal();
57      }
58  
59      public MojoExecution( MojoDescriptor mojoDescriptor, String executionId )
60      {
61          this.mojoDescriptor = mojoDescriptor;
62          this.executionId = executionId;
63          this.configuration = null;
64      }
65  
66      public MojoExecution( MojoDescriptor mojoDescriptor, Xpp3Dom configuration )
67      {
68          this.mojoDescriptor = mojoDescriptor;
69          this.configuration = configuration;
70          this.executionId = DEFAULT_EXEC_ID_PREFIX + mojoDescriptor.getGoal();
71      }
72  
73      public MojoExecution( MojoDescriptor mojoDescriptor, Xpp3Dom configuration, String executionId )
74      {
75          this.mojoDescriptor = mojoDescriptor;
76          this.configuration = configuration;
77          this.executionId = executionId;
78      }
79  
80      public String getExecutionId()
81      {
82          return executionId;
83      }
84  
85      public MojoDescriptor getMojoDescriptor()
86      {
87          return mojoDescriptor;
88      }
89  
90      public Xpp3Dom getConfiguration()
91      {
92          return configuration;
93      }
94  
95      public void addMojoExecution( MojoExecution execution )
96      {
97          forkedExecutions.add( execution );
98      }
99  
100     public void setReports( List reports )
101     {
102         this.reports = reports;
103     }
104 
105     public List getReports()
106     {
107         return reports;
108     }
109 
110     public List getForkedExecutions()
111     {
112         return forkedExecutions;
113     }
114 
115     public void setConfiguration( Xpp3Dom configuration )
116     {
117         this.configuration = configuration;
118     }
119 }