001package org.apache.archiva.repository.base; 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 org.apache.archiva.repository.EditableManagedRepository; 024import org.apache.archiva.repository.ManagedRepositoryContent; 025import org.apache.archiva.repository.ReleaseScheme; 026import org.apache.archiva.repository.RepositoryType; 027import org.apache.archiva.repository.storage.RepositoryStorage; 028 029import java.util.Collections; 030import java.util.HashSet; 031import java.util.Locale; 032import java.util.Set; 033 034/** 035 * Simple implementation of a managed repository. 036 */ 037public abstract class AbstractManagedRepository extends AbstractRepository implements EditableManagedRepository 038{ 039 private boolean blocksRedeployment = false; 040 private ManagedRepositoryContent content; 041 private Set<ReleaseScheme> activeReleaseSchemes = new HashSet<>( ); 042 private Set<ReleaseScheme> uActiveReleaseSchemes = Collections.unmodifiableSet( activeReleaseSchemes ); 043 044 public AbstractManagedRepository( RepositoryType type, String id, String name, RepositoryStorage storage) 045 { 046 super( type, id, name, storage ); 047 } 048 049 public AbstractManagedRepository( Locale primaryLocale, RepositoryType type, String id, String name, RepositoryStorage storage ) 050 { 051 super( primaryLocale, type, id, name, storage ); 052 } 053 054 @Override 055 public ManagedRepositoryContent getContent( ) 056 { 057 return content; 058 } 059 060 @Override 061 public void setContent(ManagedRepositoryContent content) { 062 this.content = content; 063 } 064 065 @Override 066 public void setBlocksRedeployment( boolean blocksRedeployment ) 067 { 068 this.blocksRedeployment = blocksRedeployment; 069 } 070 071 @Override 072 public boolean blocksRedeployments( ) 073 { 074 return blocksRedeployment; 075 } 076 077 @Override 078 public Set<ReleaseScheme> getActiveReleaseSchemes( ) 079 { 080 return uActiveReleaseSchemes; 081 } 082 083 @Override 084 public void addActiveReleaseScheme( ReleaseScheme scheme ) 085 { 086 this.activeReleaseSchemes.add(scheme); 087 } 088 089 @Override 090 public void removeActiveReleaseScheme( ReleaseScheme scheme ) 091 { 092 this.activeReleaseSchemes.remove(scheme); 093 } 094 095 @Override 096 public void clearActiveReleaseSchemes( ) 097 { 098 this.activeReleaseSchemes.clear(); 099 } 100 101 102}