View Javadoc
1   package org.apache.maven.plugins.assembly.archive.phase.wrappers;
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.plugins.assembly.model.Repository;
23  import org.apache.maven.plugins.assembly.repository.model.GroupVersionAlignment;
24  import org.apache.maven.plugins.assembly.repository.model.RepositoryInfo;
25  
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  /**
30   * @version $Id: RepoInfoWrapper.html 1000516 2016-11-05 01:04:48Z olamy $
31   */
32  public class RepoInfoWrapper
33      implements RepositoryInfo
34  {
35  
36      private final Repository repo;
37  
38      private List<GroupVersionAlignment> convertedAlignments;
39  
40      /**
41       * @param repo The {@link Repository}
42       */
43      public RepoInfoWrapper( final Repository repo )
44      {
45          this.repo = repo;
46      }
47  
48      /**
49       * {@inheritDoc}
50       */
51      @Override
52      public List<String> getExcludes()
53      {
54          return repo.getExcludes();
55      }
56  
57      /**
58       * {@inheritDoc}
59       */
60      @Override
61      public List<GroupVersionAlignment> getGroupVersionAlignments()
62      {
63          final List<org.apache.maven.plugins.assembly.model.GroupVersionAlignment> alignments =
64              repo.getGroupVersionAlignments();
65  
66          if ( convertedAlignments == null || alignments.size() != convertedAlignments.size() )
67          {
68              final List<GroupVersionAlignment> l = new ArrayList<GroupVersionAlignment>( alignments.size() );
69  
70              for ( final org.apache.maven.plugins.assembly.model.GroupVersionAlignment alignment : alignments )
71              {
72                  l.add( new GroupVersionAlignmentWrapper( alignment ) );
73              }
74  
75              convertedAlignments = l;
76          }
77  
78          return convertedAlignments;
79      }
80  
81      /**
82       * {@inheritDoc}
83       */
84      @Override
85      public List<String> getIncludes()
86      {
87          return repo.getIncludes();
88      }
89  
90      /**
91       * {@inheritDoc}
92       */
93      @Override
94      public String getScope()
95      {
96          return repo.getScope();
97      }
98  
99      /**
100      * {@inheritDoc}
101      */
102     @Override
103     public boolean isIncludeMetadata()
104     {
105         return repo.isIncludeMetadata();
106     }
107 
108 }