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 1632869 2014-10-19 00:19:23Z khmarbaise $
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      /** {@inheritDoc} */
49      public List<String> getExcludes()
50      {
51          return repo.getExcludes();
52      }
53  
54      /** {@inheritDoc} */
55      public List<GroupVersionAlignmentWrapper> getGroupVersionAlignments()
56      {
57          final List<GroupVersionAlignment> alignments = repo.getGroupVersionAlignments();
58  
59          if ( convertedAlignments == null || alignments.size() != convertedAlignments.size() )
60          {
61              final List<GroupVersionAlignmentWrapper> l =
62                  new ArrayList<GroupVersionAlignmentWrapper>( alignments.size() );
63  
64              for ( final GroupVersionAlignment alignment : alignments )
65              {
66                  l.add( new GroupVersionAlignmentWrapper( alignment ) );
67              }
68  
69              convertedAlignments = l;
70          }
71  
72          return convertedAlignments;
73      }
74  
75      /** {@inheritDoc} */
76      public List<String> getIncludes()
77      {
78          return repo.getIncludes();
79      }
80  
81      /** {@inheritDoc} */
82      public String getScope()
83      {
84          return repo.getScope();
85      }
86  
87      /** {@inheritDoc} */
88      public boolean isIncludeMetadata()
89      {
90          return repo.isIncludeMetadata();
91      }
92  
93  }