View Javadoc

1   package org.apache.maven.continuum.xmlrpc.server;
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 java.util.HashMap;
23  import java.util.Map;
24  
25  public class AddingResultUtil
26  {
27      private static final Map<String, String> errorMap;
28  
29      static
30      {
31          errorMap = new HashMap<String, String>();
32          errorMap.put( "add.project.unknown.host.error", "The specified host is either unknown or inaccessible." );
33          errorMap.put( "add.project.connect.error", "Unable to connect to remote server." );
34          errorMap.put( "add.project.malformed.url.error", "The URL provided is malformed." );
35          errorMap.put( "add.project.field.required.error", "Either POM URL or Upload POM is required." );
36          errorMap.put( "add.project.xml.parse.error", "The XML content of the POM can not be parsed." );
37          errorMap.put( "add.project.extend.error", "Cannot use a POM with an ''extend'' element." );
38          errorMap.put( "add.project.missing.pom.error",
39                        "POM file does not exist. Either the POM you specified or one of its modules does not exist." );
40          errorMap.put( "add.project.missing.groupid.error", "Missing 'groupId' element in the POM." );
41          errorMap.put( "add.project.missing.artifactid.error", "Missing 'artifactId' element in the POM." );
42          errorMap.put( "add.project.missing.version.error", "Missing 'version' element in the POM." );
43          errorMap.put( "add.project.missing.name.error", "Missing 'name' element in the POM." );
44          errorMap.put( "add.project.missing.repository.error", "Missing 'repository' element in the POM." );
45          errorMap.put( "add.project.missing.scm.error", "Missing 'scm' element in the POM project." );
46          errorMap.put( "add.project.missing.scm.connection.error",
47                        "Missing 'connection' sub-element in the 'scm' element in the POM." );
48          errorMap.put( "add.project.missing.notifier.type.error",
49                        "Missing 'type' sub-element in the 'notifier' element in the POM." );
50          errorMap.put( "add.project.missing.notifier.configuration.error",
51                        "Missing 'configuration' sub-element in the 'notifier' element in the POM." );
52          errorMap.put( "add.project.metadata.transfer.error", "Transfer of Metadata has failed." );
53          errorMap.put( "add.project.validation.protocol.not_allowed",
54                        "The specified resource isn't a file or the protocol used isn't allowed." );
55          errorMap.put( "add.project.unauthorized.error",
56                        "You are not authorized to access the requested URL. Please verify that the correct username and password are provided." );
57          errorMap.put( "add.project.artifact.not.found.error",
58                        "Missing artifact trying to build the POM. Check that its parent POM is available or add it first in Continuum." );
59          errorMap.put( "add.project.project.building.error", "Unknown error trying to build POM." );
60          errorMap.put( "add.project.unknown.error",
61                        "The specified resource cannot be accessed. Please try again later or contact your administrator." );
62          errorMap.put( "add.project.nogroup.error", "No project group specified." );
63          errorMap.put( "add.project.duplicate.error", "Trying to add duplicate projects in the same project group." );
64      }
65  
66      public static String getErrorMessage( String error )
67      {
68          String message = errorMap.get( error );
69  
70          return message == null ? error : message;
71      }
72  }