1 package org.apache.archiva.repository.base;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 import org.apache.archiva.components.registry.RegistryException;
21 import org.apache.archiva.configuration.ArchivaConfiguration;
22 import org.apache.archiva.configuration.Configuration;
23 import org.apache.archiva.configuration.ConfigurationListener;
24 import org.apache.archiva.configuration.IndeterminateConfigurationException;
25 import org.springframework.stereotype.Service;
27 import java.util.concurrent.locks.ReentrantReadWriteLock;
30 * This is just a simple wrapper to access the archiva configuration used by the registry and associated classes
32 * @author Martin Stockhammer <martin_s@apache.org>
34 @Service("configurationHandler#default")
35 public class ConfigurationHandler
37 public static final String REGISTRY_EVENT_TAG = "repositoryRegistry";
39 private ArchivaConfiguration archivaConfiguration;
41 final ReentrantReadWriteLock lock = new ReentrantReadWriteLock( );
43 public ConfigurationHandler( ArchivaConfiguration archivaConfiguration ) {
44 this.archivaConfiguration = archivaConfiguration;
47 public void addListener( ConfigurationListener listener ) {
48 this.archivaConfiguration.addListener( listener );
51 public ArchivaConfiguration getArchivaConfiguration( )
53 return archivaConfiguration;
56 public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
58 this.archivaConfiguration = archivaConfiguration;
61 public Configuration getBaseConfiguration() {
62 return archivaConfiguration.getConfiguration( );
65 public void save(Configuration configuration, String eventTag) throws IndeterminateConfigurationException, RegistryException
67 archivaConfiguration.save( configuration, eventTag);
70 public void save(Configuration configuration) throws IndeterminateConfigurationException, RegistryException
72 archivaConfiguration.save( configuration, "" );
75 public ReentrantReadWriteLock getLock() {