001package org.apache.archiva.repository; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 023import java.nio.file.Path; 024import java.util.Collections; 025import java.util.HashSet; 026import java.util.Locale; 027import java.util.Set; 028 029/** 030 * Simple implementation of a managed repository. 031 */ 032public abstract class AbstractManagedRepository extends AbstractRepository implements EditableManagedRepository 033{ 034 private boolean blocksRedeployment = false; 035 private ManagedRepositoryContent content; 036 private Set<ReleaseScheme> activeReleaseSchemes = new HashSet<>( ); 037 private Set<ReleaseScheme> uActiveReleaseSchemes = Collections.unmodifiableSet( activeReleaseSchemes ); 038 039 public AbstractManagedRepository( RepositoryType type, String id, String name, Path basePath ) 040 { 041 super( type, id, name, basePath ); 042 } 043 044 public AbstractManagedRepository( Locale primaryLocale, RepositoryType type, String id, String name, Path basePath ) 045 { 046 super( primaryLocale, type, id, name, basePath ); 047 } 048 049 @Override 050 public ManagedRepositoryContent getContent( ) 051 { 052 return content; 053 } 054 055 @Override 056 public void setContent(ManagedRepositoryContent content) { 057 this.content = content; 058 } 059 060 @Override 061 public void setBlocksRedeployment( boolean blocksRedeployment ) 062 { 063 this.blocksRedeployment = blocksRedeployment; 064 } 065 066 @Override 067 public boolean blocksRedeployments( ) 068 { 069 return blocksRedeployment; 070 } 071 072 @Override 073 public Set<ReleaseScheme> getActiveReleaseSchemes( ) 074 { 075 return uActiveReleaseSchemes; 076 } 077 078 @Override 079 public void addActiveReleaseScheme( ReleaseScheme scheme ) 080 { 081 this.activeReleaseSchemes.add(scheme); 082 } 083 084 @Override 085 public void removeActiveReleaseScheme( ReleaseScheme scheme ) 086 { 087 this.activeReleaseSchemes.remove(scheme); 088 } 089 090 @Override 091 public void clearActiveReleaseSchemes( ) 092 { 093 this.activeReleaseSchemes.clear(); 094 } 095}