View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.properties.resource.maven.repository;
17  
18  import org.apache.maven.wagon.Wagon;
19  import org.apache.maven.wagon.providers.http.LightweightHttpWagon;
20  import org.apache.maven.wagon.providers.http.LightweightHttpsWagon;
21  import org.sonatype.aether.connector.wagon.WagonProvider;
22  
23  /**
24   * Mapper to support HTTP and HTTPS protocols.
25   */
26  class RepositoryWagonProvider implements WagonProvider
27  {
28    // ********************************* Fields *********************************
29  
30    // --- constants ------------------------------------------------------------
31  
32    // --- members --------------------------------------------------------------
33  
34    // ****************************** Initializer *******************************
35  
36    // ****************************** Constructors ******************************
37  
38    // ****************************** Inner Classes *****************************
39  
40    // ********************************* Methods ********************************
41  
42    // --- init -----------------------------------------------------------------
43  
44    // --- get&set --------------------------------------------------------------
45  
46    // --- business -------------------------------------------------------------
47  
48    /**
49     * {@inheritDoc}
50     */
51    @Override
52    public Wagon lookup(final String roleHint) throws Exception
53    {
54      if ("http".equals(roleHint))
55      {
56        return new LightweightHttpWagon();
57      }
58      else if ("https".equals(roleHint))
59      {
60        return new LightweightHttpsWagon();
61      }
62  
63      return null;
64    }
65  
66    /**
67     * {@inheritDoc}
68     */
69    @Override
70    public void release(final Wagon wagon)
71    {
72    }
73  
74    // --- object basics --------------------------------------------------------
75  
76  }