This project has retired. For details please refer to its Attic page.
AbstractManagedRepository 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  
23  import java.nio.file.Path;
24  import java.util.Collections;
25  import java.util.HashSet;
26  import java.util.Locale;
27  import java.util.Set;
28  
29  /**
30   * Simple implementation of a managed repository.
31   */
32  public abstract class AbstractManagedRepository extends AbstractRepository implements EditableManagedRepository
33  {
34      private boolean blocksRedeployment = false;
35      private ManagedRepositoryContent content;
36      private Set<ReleaseScheme> activeReleaseSchemes = new HashSet<>(  );
37      private Set<ReleaseScheme> uActiveReleaseSchemes = Collections.unmodifiableSet( activeReleaseSchemes );
38  
39      public AbstractManagedRepository( RepositoryType type, String id, String name, Path basePath )
40      {
41          super( type, id, name, basePath );
42      }
43  
44      public AbstractManagedRepository( Locale primaryLocale, RepositoryType type, String id, String name, Path basePath )
45      {
46          super( primaryLocale, type, id, name, basePath );
47      }
48  
49      @Override
50      public ManagedRepositoryContent getContent( )
51      {
52          return content;
53      }
54  
55      @Override
56      public void setContent(ManagedRepositoryContent content) {
57          this.content = content;
58      }
59  
60      @Override
61      public void setBlocksRedeployment( boolean blocksRedeployment )
62      {
63          this.blocksRedeployment = blocksRedeployment;
64      }
65  
66      @Override
67      public boolean blocksRedeployments( )
68      {
69          return blocksRedeployment;
70      }
71  
72      @Override
73      public Set<ReleaseScheme> getActiveReleaseSchemes( )
74      {
75          return uActiveReleaseSchemes;
76      }
77  
78      @Override
79      public void addActiveReleaseScheme( ReleaseScheme scheme )
80      {
81          this.activeReleaseSchemes.add(scheme);
82      }
83  
84      @Override
85      public void removeActiveReleaseScheme( ReleaseScheme scheme )
86      {
87          this.activeReleaseSchemes.remove(scheme);
88      }
89  
90      @Override
91      public void clearActiveReleaseSchemes( )
92      {
93          this.activeReleaseSchemes.clear();
94      }
95  }