This project has retired. For details please refer to its Attic page.
BasicRemoteRepository xref
View Javadoc
1   package org.apache.archiva.repository;
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.archiva.repository.features.IndexCreationFeature;
23  import org.apache.archiva.repository.features.RemoteIndexFeature;
24  import org.slf4j.Logger;
25  import org.slf4j.LoggerFactory;
26  
27  import java.nio.file.Path;
28  import java.util.Locale;
29  
30  /**
31   *
32   * Just a helper class, mainly used for unit tests.
33   *
34   *
35   */
36  public class BasicRemoteRepository extends AbstractRemoteRepository
37  
38  {
39      Logger log = LoggerFactory.getLogger(BasicRemoteRepository.class);
40  
41      RemoteIndexFeature remoteIndexFeature = new RemoteIndexFeature();
42      IndexCreationFeature indexCreationFeature = new IndexCreationFeature(true);
43  
44  
45      static final StandardCapabilities CAPABILITIES = new StandardCapabilities( new ReleaseScheme[] {
46          ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT
47      }, new String[] {"default"}, new String[0], new String[] {
48          RemoteIndexFeature.class.toString(),
49              IndexCreationFeature.class.toString()
50      }, true, true, true, true, true  );
51  
52      public BasicRemoteRepository( String id, String name, Path basePath )
53      {
54          super( RepositoryType.MAVEN, id, name, basePath);
55          initFeatures();
56      }
57  
58      public BasicRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name, Path basePath )
59      {
60          super( primaryLocale, type, id, name, basePath );
61          initFeatures();
62      }
63  
64      private void initFeatures() {
65          addFeature( remoteIndexFeature );
66          addFeature( indexCreationFeature );
67      }
68  
69      @Override
70      public boolean hasIndex( )
71      {
72          return true;
73      }
74  
75      @Override
76      public RepositoryCapabilities getCapabilities( )
77      {
78          return CAPABILITIES;
79      }
80  
81  
82  }