View Javadoc
1   package org.apache.maven.plugin.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.plugin.assembly.model.GroupVersionAlignment;
23  import org.apache.maven.plugin.assembly.model.Repository;
24  import org.apache.maven.shared.repository.model.RepositoryInfo;
25  
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  /**
30   * @version $Id: RepoInfoWrapper.java 1639422 2014-11-13 18:08:07Z krosenvold $
31   */
32  public class RepoInfoWrapper
33      implements RepositoryInfo
34  {
35  
36      private final Repository repo;
37  
38      private List<GroupVersionAlignmentWrapper> 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      public List<String> getExcludes()
52      {
53          return repo.getExcludes();
54      }
55  
56      /**
57       * {@inheritDoc}
58       */
59      public List<GroupVersionAlignmentWrapper> getGroupVersionAlignments()
60      {
61          final List<GroupVersionAlignment> alignments = repo.getGroupVersionAlignments();
62  
63          if ( convertedAlignments == null || alignments.size() != convertedAlignments.size() )
64          {
65              final List<GroupVersionAlignmentWrapper> l =
66                  new ArrayList<GroupVersionAlignmentWrapper>( alignments.size() );
67  
68              for ( final GroupVersionAlignment alignment : alignments )
69              {
70                  l.add( new GroupVersionAlignmentWrapper( alignment ) );
71              }
72  
73              convertedAlignments = l;
74          }
75  
76          return convertedAlignments;
77      }
78  
79      /**
80       * {@inheritDoc}
81       */
82      public List<String> getIncludes()
83      {
84          return repo.getIncludes();
85      }
86  
87      /**
88       * {@inheritDoc}
89       */
90      public String getScope()
91      {
92          return repo.getScope();
93      }
94  
95      /**
96       * {@inheritDoc}
97       */
98      public boolean isIncludeMetadata()
99      {
100         return repo.isIncludeMetadata();
101     }
102 
103 }