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.Iterator;
28  import java.util.List;
29  
30  /**
31   * @version $Id: RepoInfoWrapper.java 999612 2010-09-21 20:34:50Z jdcasey $
32   */
33  public class RepoInfoWrapper
34      implements RepositoryInfo
35  {
36  
37      private final Repository repo;
38  
39      private List<GroupVersionAlignmentWrapper> convertedAlignments;
40  
41      public RepoInfoWrapper( final Repository repo )
42      {
43          this.repo = repo;
44      }
45  
46      public List<String> getExcludes()
47      {
48          return repo.getExcludes();
49      }
50  
51      public List<GroupVersionAlignmentWrapper> getGroupVersionAlignments()
52      {
53          final List<GroupVersionAlignment> alignments = repo.getGroupVersionAlignments();
54  
55          if ( convertedAlignments == null || alignments.size() != convertedAlignments.size() )
56          {
57              final List<GroupVersionAlignmentWrapper> l =
58                  new ArrayList<GroupVersionAlignmentWrapper>( alignments.size() );
59  
60              for ( final Iterator<GroupVersionAlignment> it = alignments.iterator(); it.hasNext(); )
61              {
62                  final GroupVersionAlignment alignment = it.next();
63  
64                  l.add( new GroupVersionAlignmentWrapper( alignment ) );
65              }
66  
67              convertedAlignments = l;
68          }
69  
70          return convertedAlignments;
71      }
72  
73      public List<String> getIncludes()
74      {
75          return repo.getIncludes();
76      }
77  
78      public String getScope()
79      {
80          return repo.getScope();
81      }
82  
83      public boolean isIncludeMetadata()
84      {
85          return repo.isIncludeMetadata();
86      }
87  
88  }