View Javadoc

1   package org.apache.maven.model.resolution;
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  /**
23   * Signals an error when resolving the path to an external model.
24   * 
25   * @author Benjamin Bentmann
26   */
27  public class UnresolvableModelException
28      extends Exception
29  {
30  
31      /**
32       * The group id of the unresolvable model.
33       */
34      private final String groupId;
35  
36      /**
37       * The artifact id of the unresolvable model.
38       */
39      private final String artifactId;
40  
41      /**
42       * The version of the unresolvable model.
43       */
44      private final String version;
45  
46      /**
47       * Creates a new exception with specified detail message and cause.
48       * 
49       * @param message The detail message, may be {@code null}.
50       * @param groupId The group id of the unresolvable model, may be {@code null}.
51       * @param artifactId The artifact id of the unresolvable model, may be {@code null}.
52       * @param version The version of the unresolvable model, may be {@code null}.
53       * @param cause The cause, may be {@code null}.
54       */
55      public UnresolvableModelException( String message, String groupId, String artifactId, String version,
56                                         Throwable cause )
57      {
58          super( message, cause );
59          this.groupId = ( groupId != null ) ? groupId : "";
60          this.artifactId = ( artifactId != null ) ? artifactId : "";
61          this.version = ( version != null ) ? version : "";
62      }
63  
64      /**
65       * Creates a new exception with specified detail message.
66       * 
67       * @param message The detail message, may be {@code null}.
68       * @param groupId The group id of the unresolvable model, may be {@code null}.
69       * @param artifactId The artifact id of the unresolvable model, may be {@code null}.
70       * @param version The version of the unresolvable model, may be {@code null}.
71       */
72      public UnresolvableModelException( String message, String groupId, String artifactId, String version )
73      {
74          super( message );
75          this.groupId = ( groupId != null ) ? groupId : "";
76          this.artifactId = ( artifactId != null ) ? artifactId : "";
77          this.version = ( version != null ) ? version : "";
78      }
79  
80      /**
81       * Gets the group id of the unresolvable model.
82       * 
83       * @return The group id of the unresolvable model, can be empty but never {@code null}.
84       */
85      public String getGroupId()
86      {
87          return groupId;
88      }
89  
90      /**
91       * Gets the artifact id of the unresolvable model.
92       * 
93       * @return The artifact id of the unresolvable model, can be empty but never {@code null}.
94       */
95      public String getArtifactId()
96      {
97          return artifactId;
98      }
99  
100     /**
101      * Gets the version of the unresolvable model.
102      * 
103      * @return The version of the unresolvable model, can be empty but never {@code null}.
104      */
105     public String getVersion()
106     {
107         return version;
108     }
109 
110 }