View Javadoc

1   package org.apache.maven.shared.utils.cli.javatool;
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.shared.utils.cli.CommandLineException;
23  import org.apache.maven.shared.utils.cli.Commandline;
24  
25  /**
26   * Describes the result of a {@link JavaTool} invocation.
27   *
28   * @author Tony Chemit <chemit@codelutin.com>
29   * @since 0.5
30   */
31  public class JavaToolResult
32  {
33      /**
34       * The exception that prevented to execute the command line, will be <code>null</code> if jarSigner could be
35       * successfully started.
36       */
37      private CommandLineException executionException;
38  
39      /**
40       * The exit code reported by the Maven invocation.
41       */
42      private int exitCode = Integer.MIN_VALUE;
43  
44      /**
45       * The command line used to obtain this result.
46       */
47      private Commandline commandline;
48  
49      /**
50       * Gets the exit code from the tool invocation. A non-zero value indicates a build failure. <strong>Note:</strong>
51       * This value is undefined if {@link #getExecutionException()} reports an exception.
52       *
53       * @return The exit code from the tool invocation.
54       */
55      public int getExitCode()
56      {
57          return exitCode;
58      }
59  
60      /**
61       * Gets the command line used.
62       *
63       * @return The command line used
64       */
65      public Commandline getCommandline()
66      {
67          return commandline;
68      }
69  
70      /**
71       * Gets the exception that possibly occurred during the execution of the command line.
72       *
73       * @return The exception that prevented to invoke tool or <code>null</code> if the command line was successfully
74       * processed by the operating system.
75       */
76      public CommandLineException getExecutionException()
77      {
78          return executionException;
79      }
80  
81      /**
82       * Sets the exit code reported by the tool invocation.
83       *
84       * @param exitCode The exit code reported by the tool invocation.
85       */
86      public void setExitCode( int exitCode )
87      {
88          this.exitCode = exitCode;
89      }
90  
91      /**
92       * Sets the exception that prevented to execute the command line.
93       *
94       * @param executionException The exception that prevented to execute the command line, may be <code>null</code>.
95       */
96      public void setExecutionException( CommandLineException executionException )
97      {
98          this.executionException = executionException;
99      }
100 
101     /**
102      * Set the commandline used to obtain this result.
103      *
104      * @param commandline the commandline used to obtain this result
105      */
106     public void setCommandline( Commandline commandline )
107     {
108         this.commandline = commandline;
109     }
110 }