--- /dev/null
+package org.apache.archiva.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Generic interface for mapping DTOs
+ *
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public interface ModelMapper<S,T>
+{
+ /**
+ * Converts the source instance to a new instance of the target type.
+ * @param source the source instance
+ * @return a new instance of the target type
+ */
+ T map(S source);
+
+ /**
+ * Updates the target instance based on the source instance
+ * @param source the source instance
+ * @param target the target instance
+ */
+ void update( S source, T target );
+
+
+ /**
+ * Converts the target instance back to the source type
+ * @param target the target instance
+ * @return a new instance of the source type
+ */
+ S reverseMap(T target);
+
+ /**
+ * Updates the source instance based on the target instance
+ * @param target the target instance
+ * @param source the source instance
+ */
+ void reverseUpdate( T target, S source);
+
+ /**
+ * Returns the class name of the source type
+ * @return the source type
+ */
+ Class<S> getSourceType();
+
+ /**
+ * Returns the class name of the target type
+ * @return the target type
+ */
+ Class<T> getTargetType();
+
+ /**
+ * Returns <code>true</code>, if the given type are the same or supertype of the mapping types.
+ * @param sourceType
+ * @param targetType
+ * @param <S>
+ * @param <T>
+ * @return
+ */
+ <S, T> boolean supports( Class<S> sourceType, Class<T> targetType );
+
+}
--- /dev/null
+package org.apache.archiva.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Interface that returns a given DTO mapper.
+ *
+ * @author Martin Schreier <martin_s@apache.org>
+ *
+ * @param <SB> The base source type for the model mapper
+ * @param <TB> The base target type for the model mapper
+ */
+public interface ModelMapperFactory<SB,TB>
+{
+ /**
+ * Returns a mapper for the given source and target type. If no mapper is registered for this combination,
+ * it will throw a {@link IllegalArgumentException}
+ * @param sourceType the source type for the mapping
+ * @param targetType the destination type
+ * @param <S> source type
+ * @param <T> destination type
+ * @return the mapper instance
+ */
+ <S extends SB, T extends TB> ModelMapper<S, T> getMapper( Class<S> sourceType, Class<T> targetType ) throws IllegalArgumentException;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>archiva-configuration-model</artifactId>
+ <name>Archiva Base :: Configuration :: Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class AbstractRepositoryConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class AbstractRepositoryConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The repository identifier.
+ *
+ */
+ private String id;
+
+ /**
+ *
+ * The repository type. Currently only MAVEN type
+ * is known.
+ *
+ */
+ private String type = "MAVEN";
+
+ /**
+ *
+ * The descriptive name of the repository.
+ *
+ */
+ private String name;
+
+ /**
+ *
+ * The layout of the repository. Valid values are
+ * "default" and "legacy".
+ *
+ */
+ private String layout = "default";
+
+ /**
+ *
+ * The directory for the indexes of this
+ * repository.
+ *
+ */
+ private String indexDir = "";
+
+ /**
+ *
+ * The directory for the packed indexes of this
+ * repository.
+ *
+ */
+ private String packedIndexDir = "";
+
+ /**
+ *
+ * The description of this repository.
+ *
+ */
+ private String description = "";
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the description of this repository.
+ *
+ * @return String
+ */
+ public String getDescription()
+ {
+ return this.description;
+ } //-- String getDescription()
+
+ /**
+ * Get the repository identifier.
+ *
+ * @return String
+ */
+ public String getId()
+ {
+ return this.id;
+ } //-- String getId()
+
+ /**
+ * Get the directory for the indexes of this repository.
+ *
+ * @return String
+ */
+ public String getIndexDir()
+ {
+ return this.indexDir;
+ } //-- String getIndexDir()
+
+ /**
+ * Get the layout of the repository. Valid values are "default"
+ * and "legacy".
+ *
+ * @return String
+ */
+ public String getLayout()
+ {
+ return this.layout;
+ } //-- String getLayout()
+
+ /**
+ * Get the descriptive name of the repository.
+ *
+ * @return String
+ */
+ public String getName()
+ {
+ return this.name;
+ } //-- String getName()
+
+ /**
+ * Get the directory for the packed indexes of this repository.
+ *
+ * @return String
+ */
+ public String getPackedIndexDir()
+ {
+ return this.packedIndexDir;
+ } //-- String getPackedIndexDir()
+
+ /**
+ * Get the repository type. Currently only MAVEN type is known.
+ *
+ * @return String
+ */
+ public String getType()
+ {
+ return this.type;
+ } //-- String getType()
+
+ /**
+ * Set the description of this repository.
+ *
+ * @param description
+ */
+ public void setDescription( String description )
+ {
+ this.description = description;
+ } //-- void setDescription( String )
+
+ /**
+ * Set the repository identifier.
+ *
+ * @param id
+ */
+ public void setId( String id )
+ {
+ this.id = id;
+ } //-- void setId( String )
+
+ /**
+ * Set the directory for the indexes of this repository.
+ *
+ * @param indexDir
+ */
+ public void setIndexDir( String indexDir )
+ {
+ this.indexDir = indexDir;
+ } //-- void setIndexDir( String )
+
+ /**
+ * Set the layout of the repository. Valid values are "default"
+ * and "legacy".
+ *
+ * @param layout
+ */
+ public void setLayout( String layout )
+ {
+ this.layout = layout;
+ } //-- void setLayout( String )
+
+ /**
+ * Set the descriptive name of the repository.
+ *
+ * @param name
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ } //-- void setName( String )
+
+ /**
+ * Set the directory for the packed indexes of this repository.
+ *
+ * @param packedIndexDir
+ */
+ public void setPackedIndexDir( String packedIndexDir )
+ {
+ this.packedIndexDir = packedIndexDir;
+ } //-- void setPackedIndexDir( String )
+
+ /**
+ * Set the repository type. Currently only MAVEN type is known.
+ *
+ * @param type
+ */
+ public void setType( String type )
+ {
+ this.type = type;
+ } //-- void setType( String )
+
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = 37 * result + ( id != null ? id.hashCode() : 0 );
+ return result;
+ }
+
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof AbstractRepositoryConfiguration ) )
+ {
+ return false;
+ }
+
+ AbstractRepositoryConfiguration that = (AbstractRepositoryConfiguration) other;
+ boolean result = true;
+ result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
+ return result;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class AbstractRepositoryConnectorConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class AbstractRepositoryConnectorConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The Repository Source for this connector.
+ *
+ */
+ private String sourceRepoId;
+
+ /**
+ *
+ * The Repository Target for this connector.
+ *
+ */
+ private String targetRepoId;
+
+ /**
+ *
+ * The network proxy ID to use for this connector.
+ *
+ */
+ private String proxyId;
+
+ /**
+ * Field blackListPatterns.
+ */
+ private java.util.List<String> blackListPatterns;
+
+ /**
+ * Field whiteListPatterns.
+ */
+ private java.util.List<String> whiteListPatterns;
+
+ /**
+ * Field policies.
+ */
+ private java.util.Map policies;
+
+ /**
+ * Field properties.
+ */
+ private java.util.Map properties;
+
+ /**
+ *
+ * If the the repository proxy connector is
+ * disabled or not
+ * .
+ */
+ private boolean disabled = false;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addBlackListPattern.
+ *
+ * @param string
+ */
+ public void addBlackListPattern( String string )
+ {
+ getBlackListPatterns().add( string );
+ } //-- void addBlackListPattern( String )
+
+ /**
+ * Method addPolicy.
+ *
+ * @param key
+ * @param value
+ */
+ public void addPolicy( String key, String value )
+ {
+ getPolicies().put( key, value );
+ } //-- void addPolicy( Object, String )
+
+ /**
+ * Method addProperty.
+ *
+ * @param key
+ * @param value
+ */
+ public void addProperty( String key, String value )
+ {
+ getProperties().put( key, value );
+ } //-- void addProperty( Object, String )
+
+ /**
+ * Method addWhiteListPattern.
+ *
+ * @param string
+ */
+ public void addWhiteListPattern( String string )
+ {
+ getWhiteListPatterns().add( string );
+ } //-- void addWhiteListPattern( String )
+
+ /**
+ * Method getBlackListPatterns.
+ *
+ * @return List
+ */
+ public java.util.List<String> getBlackListPatterns()
+ {
+ if ( this.blackListPatterns == null )
+ {
+ this.blackListPatterns = new java.util.ArrayList<String>();
+ }
+
+ return this.blackListPatterns;
+ } //-- java.util.List<String> getBlackListPatterns()
+
+ /**
+ * Method getPolicies.
+ *
+ * @return Map
+ */
+ public java.util.Map<String, String> getPolicies()
+ {
+ if ( this.policies == null )
+ {
+ this.policies = new java.util.HashMap();
+ }
+
+ return this.policies;
+ } //-- java.util.Map getPolicies()
+
+ /**
+ * Method getProperties.
+ *
+ * @return Map
+ */
+ public java.util.Map<String, String> getProperties()
+ {
+ if ( this.properties == null )
+ {
+ this.properties = new java.util.HashMap();
+ }
+
+ return this.properties;
+ } //-- java.util.Map getProperties()
+
+ /**
+ * Get the network proxy ID to use for this connector.
+ *
+ * @return String
+ */
+ public String getProxyId()
+ {
+ return this.proxyId;
+ } //-- String getProxyId()
+
+ /**
+ * Get the Repository Source for this connector.
+ *
+ * @return String
+ */
+ public String getSourceRepoId()
+ {
+ return this.sourceRepoId;
+ } //-- String getSourceRepoId()
+
+ /**
+ * Get the Repository Target for this connector.
+ *
+ * @return String
+ */
+ public String getTargetRepoId()
+ {
+ return this.targetRepoId;
+ } //-- String getTargetRepoId()
+
+ /**
+ * Method getWhiteListPatterns.
+ *
+ * @return List
+ */
+ public java.util.List<String> getWhiteListPatterns()
+ {
+ if ( this.whiteListPatterns == null )
+ {
+ this.whiteListPatterns = new java.util.ArrayList<String>();
+ }
+
+ return this.whiteListPatterns;
+ } //-- java.util.List<String> getWhiteListPatterns()
+
+ /**
+ * Get if the the repository proxy connector is disabled or
+ * not.
+ *
+ * @return boolean
+ */
+ public boolean isDisabled()
+ {
+ return this.disabled;
+ } //-- boolean isDisabled()
+
+ /**
+ * Method removeBlackListPattern.
+ *
+ * @param string
+ */
+ public void removeBlackListPattern( String string )
+ {
+ getBlackListPatterns().remove( string );
+ } //-- void removeBlackListPattern( String )
+
+ /**
+ * Method removeWhiteListPattern.
+ *
+ * @param string
+ */
+ public void removeWhiteListPattern( String string )
+ {
+ getWhiteListPatterns().remove( string );
+ } //-- void removeWhiteListPattern( String )
+
+ /**
+ * Set the list of blacklisted patterns for this connector.
+ *
+ * @param blackListPatterns
+ */
+ public void setBlackListPatterns( java.util.List<String> blackListPatterns )
+ {
+ this.blackListPatterns = blackListPatterns;
+ } //-- void setBlackListPatterns( java.util.List )
+
+ /**
+ * Set if the the repository proxy connector is disabled or
+ * not.
+ *
+ * @param disabled
+ */
+ public void setDisabled( boolean disabled )
+ {
+ this.disabled = disabled;
+ } //-- void setDisabled( boolean )
+
+ /**
+ * Set policy configuration for the connector.
+ *
+ * @param policies
+ */
+ public void setPolicies( java.util.Map policies )
+ {
+ this.policies = policies;
+ } //-- void setPolicies( java.util.Map )
+
+ /**
+ * Set configuration for the connector.
+ *
+ * @param properties
+ */
+ public void setProperties( java.util.Map properties )
+ {
+ this.properties = properties;
+ } //-- void setProperties( java.util.Map )
+
+ /**
+ * Set the network proxy ID to use for this connector.
+ *
+ * @param proxyId
+ */
+ public void setProxyId( String proxyId )
+ {
+ this.proxyId = proxyId;
+ } //-- void setProxyId( String )
+
+ /**
+ * Set the Repository Source for this connector.
+ *
+ * @param sourceRepoId
+ */
+ public void setSourceRepoId( String sourceRepoId )
+ {
+ this.sourceRepoId = sourceRepoId;
+ } //-- void setSourceRepoId( String )
+
+ /**
+ * Set the Repository Target for this connector.
+ *
+ * @param targetRepoId
+ */
+ public void setTargetRepoId( String targetRepoId )
+ {
+ this.targetRepoId = targetRepoId;
+ } //-- void setTargetRepoId( String )
+
+ /**
+ * Set the list of whitelisted patterns for this connector.
+ *
+ * @param whiteListPatterns
+ */
+ public void setWhiteListPatterns( java.util.List<String> whiteListPatterns )
+ {
+ this.whiteListPatterns = whiteListPatterns;
+ } //-- void setWhiteListPatterns( java.util.List )
+
+
+ /**
+ * Obtain a specific policy from the underlying connector.
+ *
+ * @param policyId the policy id to fetch.
+ * @param defaultValue the default value for the policy id.
+ * @return the configured policy value (or default value if not found).
+ */
+ public String getPolicy( String policyId, String defaultValue )
+ {
+ if ( this.getPolicies() == null )
+ {
+ return null;
+ }
+
+ Object value = this.getPolicies().get( policyId );
+
+ if ( value == null )
+ {
+ return defaultValue;
+ }
+
+ return (String) value;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * Archiva default settings.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class ArchivaDefaultConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field defaultCheckPaths.
+ */
+ private java.util.List<RepositoryCheckPath> defaultCheckPaths;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addDefaultCheckPath.
+ *
+ * @param repositoryCheckPath
+ */
+ public void addDefaultCheckPath( RepositoryCheckPath repositoryCheckPath )
+ {
+ getDefaultCheckPaths().add( repositoryCheckPath );
+ } //-- void addDefaultCheckPath( RepositoryCheckPath )
+
+ /**
+ * Method getDefaultCheckPaths.
+ *
+ * @return List
+ */
+ public java.util.List<RepositoryCheckPath> getDefaultCheckPaths()
+ {
+ if ( this.defaultCheckPaths == null )
+ {
+ this.defaultCheckPaths = new java.util.ArrayList<RepositoryCheckPath>();
+ }
+
+ return this.defaultCheckPaths;
+ } //-- java.util.List<RepositoryCheckPath> getDefaultCheckPaths()
+
+ /**
+ * Method removeDefaultCheckPath.
+ *
+ * @param repositoryCheckPath
+ */
+ public void removeDefaultCheckPath( RepositoryCheckPath repositoryCheckPath )
+ {
+ getDefaultCheckPaths().remove( repositoryCheckPath );
+ } //-- void removeDefaultCheckPath( RepositoryCheckPath )
+
+ /**
+ * Set the default check paths for certain remote repositories.
+ *
+ * @param defaultCheckPaths
+ */
+ public void setDefaultCheckPaths( java.util.List<RepositoryCheckPath> defaultCheckPaths )
+ {
+ this.defaultCheckPaths = defaultCheckPaths;
+ } //-- void setDefaultCheckPaths( java.util.List )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ *
+ * The runtime configuration.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class ArchivaRuntimeConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * the url failure cache configuration.
+ */
+ private CacheConfiguration urlFailureCacheConfiguration;
+
+ /**
+ * the FileLocking configuration.
+ */
+ private FileLockConfiguration fileLockConfiguration;
+
+ /**
+ * The base directory where the archiva data is stored. If not
+ * set, the appserver.base is used.
+ */
+ private String dataDirectory;
+
+ /**
+ * The base directory for local storage of repository data. If
+ * not set, it's ${dataDirectory}/repositories.
+ */
+ private String repositoryBaseDirectory;
+
+ /**
+ * The base directory for local storage of remote repository
+ * data. If not set, it's ${dataDirectory}/remotes.
+ */
+ private String remoteRepositoryBaseDirectory;
+
+ /**
+ * The base directory for local storage of repository group files.
+ * If not set, it's ${dataDirectory}/groups
+ */
+ private String repositoryGroupBaseDirectory;
+
+ /**
+ * The default language used for setting internationalized
+ * strings.
+ */
+ private String defaultLanguage = "en-US";
+
+ /**
+ * Comma separated list of language patterns. Sorted by
+ * priority descending. Used for display of internationalized
+ * strings.
+ */
+ private String languageRange = "en,fr,de";
+
+ /**
+ * List of checksum types (algorithms) that should be applied to repository artifacts.
+ */
+ private List<String> checksumTypes = new ArrayList(Arrays.asList("MD5","SHA1","SHA256"));
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the base directory where the archiva data is stored. If
+ * not set, the appserver.base is used.
+ *
+ * @return String
+ */
+ public String getDataDirectory()
+ {
+ return this.dataDirectory;
+ } //-- String getDataDirectory()
+
+ /**
+ * Get the default language used for setting internationalized
+ * strings.
+ *
+ * @return String
+ */
+ public String getDefaultLanguage()
+ {
+ return this.defaultLanguage;
+ } //-- String getDefaultLanguage()
+
+ /**
+ * Get the FileLocking configuration.
+ *
+ * @return FileLockConfiguration
+ */
+ public FileLockConfiguration getFileLockConfiguration()
+ {
+ return this.fileLockConfiguration;
+ } //-- FileLockConfiguration getFileLockConfiguration()
+
+ /**
+ * Get comma separated list of language patterns. Sorted by
+ * priority descending. Used for display of internationalized
+ * strings.
+ *
+ * @return String
+ */
+ public String getLanguageRange()
+ {
+ return this.languageRange;
+ } //-- String getLanguageRange()
+
+ /**
+ * Get the base directory for local storage of remote
+ * repository data. If not set, it's ${dataDirectory}/remotes.
+ *
+ * @return String
+ */
+ public String getRemoteRepositoryBaseDirectory()
+ {
+ return this.remoteRepositoryBaseDirectory;
+ } //-- String getRemoteRepositoryBaseDirectory()
+
+ /**
+ * Get the base directory for local storage of repository data.
+ * If not set, it's ${dataDirectory}/repositories.
+ *
+ * @return String
+ */
+ public String getRepositoryBaseDirectory()
+ {
+ return this.repositoryBaseDirectory;
+ } //-- String getRepositoryBaseDirectory()
+
+ /**
+ * Get the base directory for local storage of repository group data.
+ * If not set it's ${dataDirectory}/groups
+ *
+ * @return The path to the directory. Either a absolute path, or a path
+ * relative to ${dataDirectory}
+ */
+ public String getRepositoryGroupBaseDirectory() {
+ return this.repositoryGroupBaseDirectory;
+ }
+
+ /**
+ * Get the url failure cache configuration.
+ *
+ * @return CacheConfiguration
+ */
+ public CacheConfiguration getUrlFailureCacheConfiguration()
+ {
+ return this.urlFailureCacheConfiguration;
+ } //-- CacheConfiguration getUrlFailureCacheConfiguration()
+
+ /**
+ * Set the base directory where the archiva data is stored. If
+ * not set, the appserver.base is used.
+ *
+ * @param dataDirectory
+ */
+ public void setDataDirectory( String dataDirectory )
+ {
+ this.dataDirectory = dataDirectory;
+ } //-- void setDataDirectory( String )
+
+ /**
+ * Set the default language used for setting internationalized
+ * strings.
+ *
+ * @param defaultLanguage
+ */
+ public void setDefaultLanguage( String defaultLanguage )
+ {
+ this.defaultLanguage = defaultLanguage;
+ } //-- void setDefaultLanguage( String )
+
+ /**
+ * Set the FileLocking configuration.
+ *
+ * @param fileLockConfiguration
+ */
+ public void setFileLockConfiguration( FileLockConfiguration fileLockConfiguration )
+ {
+ this.fileLockConfiguration = fileLockConfiguration;
+ } //-- void setFileLockConfiguration( FileLockConfiguration )
+
+ /**
+ * Set comma separated list of language patterns. Sorted by
+ * priority descending. Used for display of internationalized
+ * strings.
+ *
+ * @param languageRange
+ */
+ public void setLanguageRange( String languageRange )
+ {
+ this.languageRange = languageRange;
+ } //-- void setLanguageRange( String )
+
+ /**
+ * Set the base directory for local storage of remote
+ * repository data. If not set, it's ${dataDirectory}/remotes.
+ *
+ * @param remoteRepositoryBaseDirectory
+ */
+ public void setRemoteRepositoryBaseDirectory( String remoteRepositoryBaseDirectory )
+ {
+ this.remoteRepositoryBaseDirectory = remoteRepositoryBaseDirectory;
+ } //-- void setRemoteRepositoryBaseDirectory( String )
+
+ /**
+ * Set the base directory for local storage of repository data.
+ * If not set, it's ${dataDirectory}/repositories.
+ *
+ * @param repositoryBaseDirectory
+ */
+ public void setRepositoryBaseDirectory( String repositoryBaseDirectory )
+ {
+ this.repositoryBaseDirectory = repositoryBaseDirectory;
+ } //-- void setRepositoryBaseDirectory( String )
+
+
+ public void setRepositoryGroupBaseDirectory(String repositoryGroupBaseDirectory) {
+ this.repositoryGroupBaseDirectory = repositoryGroupBaseDirectory;
+ }
+
+ /**
+ * Set the url failure cache configuration.
+ *
+ * @param urlFailureCacheConfiguration
+ */
+ public void setUrlFailureCacheConfiguration( CacheConfiguration urlFailureCacheConfiguration )
+ {
+ this.urlFailureCacheConfiguration = urlFailureCacheConfiguration;
+ } //-- void setUrlFailureCacheConfiguration( CacheConfiguration )
+
+
+ /**
+ * Returns the list of checksum types to generate
+ * @return
+ */
+ public List<String> getChecksumTypes()
+ {
+ if ( this.checksumTypes == null )
+ {
+ this.checksumTypes = new java.util.ArrayList<String>();
+ }
+
+ return this.checksumTypes;
+ }
+
+ /**
+ * Adds a checksum type
+ * @param type
+ */
+ public void addChecksumType(String type) {
+
+ if (!getChecksumTypes().contains(type)) {
+ getChecksumTypes().add(type);
+ }
+ }
+
+ /**
+ * Removes a checksum type
+ * @param type
+ */
+ public void removeChecksumType(String type) {
+ getChecksumTypes().remove(type);
+ }
+
+ /**
+ * Set all checksum types
+ * @param checksumTypes
+ */
+ public void setChecksumTypes(List<String> checksumTypes) {
+ if (checksumTypes!=null) {
+ getChecksumTypes().clear();
+ getChecksumTypes().addAll(checksumTypes);
+ }
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Cache configuration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class CacheConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * TimeToIdleSeconds.
+ */
+ private int timeToIdleSeconds = -1;
+
+ /**
+ * TimeToLiveSeconds.
+ */
+ private int timeToLiveSeconds = -1;
+
+ /**
+ * max elements in memory.
+ */
+ private int maxElementsInMemory = -1;
+
+ /**
+ * max elements on disk.
+ */
+ private int maxElementsOnDisk = -1;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get max elements in memory.
+ *
+ * @return int
+ */
+ public int getMaxElementsInMemory()
+ {
+ return this.maxElementsInMemory;
+ } //-- int getMaxElementsInMemory()
+
+ /**
+ * Get max elements on disk.
+ *
+ * @return int
+ */
+ public int getMaxElementsOnDisk()
+ {
+ return this.maxElementsOnDisk;
+ } //-- int getMaxElementsOnDisk()
+
+ /**
+ * Get timeToIdleSeconds.
+ *
+ * @return int
+ */
+ public int getTimeToIdleSeconds()
+ {
+ return this.timeToIdleSeconds;
+ } //-- int getTimeToIdleSeconds()
+
+ /**
+ * Get timeToLiveSeconds.
+ *
+ * @return int
+ */
+ public int getTimeToLiveSeconds()
+ {
+ return this.timeToLiveSeconds;
+ } //-- int getTimeToLiveSeconds()
+
+ /**
+ * Set max elements in memory.
+ *
+ * @param maxElementsInMemory
+ */
+ public void setMaxElementsInMemory( int maxElementsInMemory )
+ {
+ this.maxElementsInMemory = maxElementsInMemory;
+ } //-- void setMaxElementsInMemory( int )
+
+ /**
+ * Set max elements on disk.
+ *
+ * @param maxElementsOnDisk
+ */
+ public void setMaxElementsOnDisk( int maxElementsOnDisk )
+ {
+ this.maxElementsOnDisk = maxElementsOnDisk;
+ } //-- void setMaxElementsOnDisk( int )
+
+ /**
+ * Set timeToIdleSeconds.
+ *
+ * @param timeToIdleSeconds
+ */
+ public void setTimeToIdleSeconds( int timeToIdleSeconds )
+ {
+ this.timeToIdleSeconds = timeToIdleSeconds;
+ } //-- void setTimeToIdleSeconds( int )
+
+ /**
+ * Set timeToLiveSeconds.
+ *
+ * @param timeToLiveSeconds
+ */
+ public void setTimeToLiveSeconds( int timeToLiveSeconds )
+ {
+ this.timeToLiveSeconds = timeToLiveSeconds;
+ } //-- void setTimeToLiveSeconds( int )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ * Class Configuration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class Configuration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * This is the version of the configuration format.
+ */
+ private String version = "3.0.0";
+
+ /**
+ * The type of the metadata storage. Allowed values: jcr, file,
+ * cassandra.
+ */
+ private String metadataStore = "jcr";
+
+ /**
+ * Field repositoryGroups.
+ */
+ private java.util.List<RepositoryGroupConfiguration> repositoryGroups;
+
+ /**
+ * Field managedRepositories.
+ */
+ private java.util.List<ManagedRepositoryConfiguration> managedRepositories;
+
+ /**
+ * Field remoteRepositories.
+ */
+ private java.util.List<RemoteRepositoryConfiguration> remoteRepositories;
+
+ /**
+ * Field proxyConnectors.
+ */
+ private java.util.List<ProxyConnectorConfiguration> proxyConnectors;
+
+ /**
+ * Field networkProxies.
+ */
+ private java.util.List<NetworkProxyConfiguration> networkProxies;
+
+ /**
+ * Field legacyArtifactPaths.
+ */
+ private java.util.List<LegacyArtifactPath> legacyArtifactPaths;
+
+ /**
+ *
+ * The repository scanning configuration.
+ *
+ */
+ private RepositoryScanningConfiguration repositoryScanning;
+
+ /**
+ *
+ * The webapp configuration.
+ *
+ */
+ private WebappConfiguration webapp;
+
+ /**
+ *
+ * The organisation info.
+ *
+ */
+ private OrganisationInformation organisationInfo;
+
+ /**
+ *
+ * The NetworkConfiguration .
+ *
+ */
+ private NetworkConfiguration networkConfiguration;
+
+ /**
+ * The RedbackRuntimeConfiguration.
+ */
+ private RedbackRuntimeConfiguration redbackRuntimeConfiguration;
+
+ /**
+ * The ArchivaRuntimeConfiguration.
+ */
+ private ArchivaRuntimeConfiguration archivaRuntimeConfiguration;
+
+ /**
+ * Field proxyConnectorRuleConfigurations.
+ */
+ private java.util.List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations;
+
+ /**
+ * Archiva default settings.
+ */
+ private ArchivaDefaultConfiguration archivaDefaultConfiguration;
+
+ /**
+ * Field modelEncoding.
+ */
+ private String modelEncoding = "UTF-8";
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addLegacyArtifactPath.
+ *
+ * @param legacyArtifactPath
+ */
+ public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
+ {
+ getLegacyArtifactPaths().add( legacyArtifactPath );
+ } //-- void addLegacyArtifactPath( LegacyArtifactPath )
+
+ /**
+ * Method addManagedRepository.
+ *
+ * @param managedRepositoryConfiguration
+ */
+ public void addManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration )
+ {
+ getManagedRepositories().add( managedRepositoryConfiguration );
+ } //-- void addManagedRepository( ManagedRepositoryConfiguration )
+
+ /**
+ * Method addNetworkProxy.
+ *
+ * @param networkProxyConfiguration
+ */
+ public void addNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
+ {
+ getNetworkProxies().add( networkProxyConfiguration );
+ } //-- void addNetworkProxy( NetworkProxyConfiguration )
+
+ /**
+ * Method addProxyConnector.
+ *
+ * @param proxyConnectorConfiguration
+ */
+ public void addProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
+ {
+ getProxyConnectors().add( proxyConnectorConfiguration );
+ } //-- void addProxyConnector( ProxyConnectorConfiguration )
+
+ /**
+ * Method addProxyConnectorRuleConfiguration.
+ *
+ * @param proxyConnectorRuleConfiguration
+ */
+ public void addProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration )
+ {
+ getProxyConnectorRuleConfigurations().add( proxyConnectorRuleConfiguration );
+ } //-- void addProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration )
+
+ /**
+ * Method addRemoteRepository.
+ *
+ * @param remoteRepositoryConfiguration
+ */
+ public void addRemoteRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration )
+ {
+ getRemoteRepositories().add( remoteRepositoryConfiguration );
+ } //-- void addRemoteRepository( RemoteRepositoryConfiguration )
+
+ /**
+ * Method addRepositoryGroup.
+ *
+ * @param repositoryGroupConfiguration
+ */
+ public void addRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration )
+ {
+ getRepositoryGroups().add( repositoryGroupConfiguration );
+ } //-- void addRepositoryGroup( RepositoryGroupConfiguration )
+
+ /**
+ * Get archiva default settings.
+ *
+ * @return ArchivaDefaultConfiguration
+ */
+ public ArchivaDefaultConfiguration getArchivaDefaultConfiguration()
+ {
+ return this.archivaDefaultConfiguration;
+ } //-- ArchivaDefaultConfiguration getArchivaDefaultConfiguration()
+
+ /**
+ * Get the ArchivaRuntimeConfiguration.
+ *
+ * @return ArchivaRuntimeConfiguration
+ */
+ public ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
+ {
+ return this.archivaRuntimeConfiguration;
+ } //-- ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
+
+ /**
+ * Method getLegacyArtifactPaths.
+ *
+ * @return List
+ */
+ public java.util.List<LegacyArtifactPath> getLegacyArtifactPaths()
+ {
+ if ( this.legacyArtifactPaths == null )
+ {
+ this.legacyArtifactPaths = new java.util.ArrayList<LegacyArtifactPath>();
+ }
+
+ return this.legacyArtifactPaths;
+ } //-- java.util.List<LegacyArtifactPath> getLegacyArtifactPaths()
+
+ /**
+ * Method getManagedRepositories.
+ *
+ * @return List
+ */
+ public java.util.List<ManagedRepositoryConfiguration> getManagedRepositories()
+ {
+ if ( this.managedRepositories == null )
+ {
+ this.managedRepositories = new java.util.ArrayList<ManagedRepositoryConfiguration>();
+ }
+
+ return this.managedRepositories;
+ } //-- java.util.List<ManagedRepositoryConfiguration> getManagedRepositories()
+
+ /**
+ * Get the type of the metadata storage. Allowed values: jcr,
+ * file, cassandra.
+ *
+ * @return String
+ */
+ public String getMetadataStore()
+ {
+ return this.metadataStore;
+ } //-- String getMetadataStore()
+
+ /**
+ * Get the modelEncoding field.
+ *
+ * @return String
+ */
+ public String getModelEncoding()
+ {
+ return this.modelEncoding;
+ } //-- String getModelEncoding()
+
+ /**
+ * Get the NetworkConfiguration .
+ *
+ * @return NetworkConfiguration
+ */
+ public NetworkConfiguration getNetworkConfiguration()
+ {
+ return this.networkConfiguration;
+ } //-- NetworkConfiguration getNetworkConfiguration()
+
+ /**
+ * Method getNetworkProxies.
+ *
+ * @return List
+ */
+ public java.util.List<NetworkProxyConfiguration> getNetworkProxies()
+ {
+ if ( this.networkProxies == null )
+ {
+ this.networkProxies = new java.util.ArrayList<NetworkProxyConfiguration>();
+ }
+
+ return this.networkProxies;
+ } //-- java.util.List<NetworkProxyConfiguration> getNetworkProxies()
+
+ /**
+ * Get the organisation info.
+ *
+ * @return OrganisationInformation
+ */
+ public OrganisationInformation getOrganisationInfo()
+ {
+ return this.organisationInfo;
+ } //-- OrganisationInformation getOrganisationInfo()
+
+ /**
+ * Method getProxyConnectorRuleConfigurations.
+ *
+ * @return List
+ */
+ public java.util.List<ProxyConnectorRuleConfiguration> getProxyConnectorRuleConfigurations()
+ {
+ if ( this.proxyConnectorRuleConfigurations == null )
+ {
+ this.proxyConnectorRuleConfigurations = new java.util.ArrayList<ProxyConnectorRuleConfiguration>();
+ }
+
+ return this.proxyConnectorRuleConfigurations;
+ } //-- java.util.List<ProxyConnectorRuleConfiguration> getProxyConnectorRuleConfigurations()
+
+ /**
+ * Method getProxyConnectors.
+ *
+ * @return List
+ */
+ public java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
+ {
+ if ( this.proxyConnectors == null )
+ {
+ this.proxyConnectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
+ }
+
+ return this.proxyConnectors;
+ } //-- java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
+
+ /**
+ * Get the RedbackRuntimeConfiguration.
+ *
+ * @return RedbackRuntimeConfiguration
+ */
+ public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
+ {
+ return this.redbackRuntimeConfiguration;
+ } //-- RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
+
+ /**
+ * Method getRemoteRepositories.
+ *
+ * @return List
+ */
+ public java.util.List<RemoteRepositoryConfiguration> getRemoteRepositories()
+ {
+ if ( this.remoteRepositories == null )
+ {
+ this.remoteRepositories = new java.util.ArrayList<RemoteRepositoryConfiguration>();
+ }
+
+ return this.remoteRepositories;
+ } //-- java.util.List<RemoteRepositoryConfiguration> getRemoteRepositories()
+
+ /**
+ * Method getRepositoryGroups.
+ *
+ * @return List
+ */
+ public java.util.List<RepositoryGroupConfiguration> getRepositoryGroups()
+ {
+ if ( this.repositoryGroups == null )
+ {
+ this.repositoryGroups = new java.util.ArrayList<RepositoryGroupConfiguration>();
+ }
+
+ return this.repositoryGroups;
+ } //-- java.util.List<RepositoryGroupConfiguration> getRepositoryGroups()
+
+ /**
+ * Get the repository scanning configuration.
+ *
+ * @return RepositoryScanningConfiguration
+ */
+ public RepositoryScanningConfiguration getRepositoryScanning()
+ {
+ return this.repositoryScanning;
+ } //-- RepositoryScanningConfiguration getRepositoryScanning()
+
+ /**
+ * Get this is the version of the configuration format.
+ *
+ * @return String
+ */
+ public String getVersion()
+ {
+ return this.version;
+ } //-- String getVersion()
+
+ /**
+ * Get the webapp configuration.
+ *
+ * @return WebappConfiguration
+ */
+ public WebappConfiguration getWebapp()
+ {
+ return this.webapp;
+ } //-- WebappConfiguration getWebapp()
+
+ /**
+ * Method removeLegacyArtifactPath.
+ *
+ * @param legacyArtifactPath
+ */
+ public void removeLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
+ {
+ getLegacyArtifactPaths().remove( legacyArtifactPath );
+ } //-- void removeLegacyArtifactPath( LegacyArtifactPath )
+
+ /**
+ * Method removeManagedRepository.
+ *
+ * @param managedRepositoryConfiguration
+ */
+ public void removeManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration )
+ {
+ getManagedRepositories().remove( managedRepositoryConfiguration );
+ } //-- void removeManagedRepository( ManagedRepositoryConfiguration )
+
+ /**
+ * Method removeNetworkProxy.
+ *
+ * @param networkProxyConfiguration
+ */
+ public void removeNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
+ {
+ getNetworkProxies().remove( networkProxyConfiguration );
+ } //-- void removeNetworkProxy( NetworkProxyConfiguration )
+
+ /**
+ * Method removeProxyConnector.
+ *
+ * @param proxyConnectorConfiguration
+ */
+ public void removeProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
+ {
+ getProxyConnectors().remove( proxyConnectorConfiguration );
+ } //-- void removeProxyConnector( ProxyConnectorConfiguration )
+
+ /**
+ * Method removeProxyConnectorRuleConfiguration.
+ *
+ * @param proxyConnectorRuleConfiguration
+ */
+ public void removeProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration )
+ {
+ getProxyConnectorRuleConfigurations().remove( proxyConnectorRuleConfiguration );
+ } //-- void removeProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration )
+
+ /**
+ * Method removeRemoteRepository.
+ *
+ * @param remoteRepositoryConfiguration
+ */
+ public void removeRemoteRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration )
+ {
+ getRemoteRepositories().remove( remoteRepositoryConfiguration );
+ } //-- void removeRemoteRepository( RemoteRepositoryConfiguration )
+
+ /**
+ * Method removeRepositoryGroup.
+ *
+ * @param repositoryGroupConfiguration
+ */
+ public void removeRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration )
+ {
+ getRepositoryGroups().remove( repositoryGroupConfiguration );
+ } //-- void removeRepositoryGroup( RepositoryGroupConfiguration )
+
+ /**
+ * Set archiva default settings.
+ *
+ * @param archivaDefaultConfiguration
+ */
+ public void setArchivaDefaultConfiguration( ArchivaDefaultConfiguration archivaDefaultConfiguration )
+ {
+ this.archivaDefaultConfiguration = archivaDefaultConfiguration;
+ } //-- void setArchivaDefaultConfiguration( ArchivaDefaultConfiguration )
+
+ /**
+ * Set the ArchivaRuntimeConfiguration.
+ *
+ * @param archivaRuntimeConfiguration
+ */
+ public void setArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
+ {
+ this.archivaRuntimeConfiguration = archivaRuntimeConfiguration;
+ } //-- void setArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration )
+
+ /**
+ * Set the list of custom legacy path to artifact.
+ *
+ * @param legacyArtifactPaths
+ */
+ public void setLegacyArtifactPaths( java.util.List<LegacyArtifactPath> legacyArtifactPaths )
+ {
+ this.legacyArtifactPaths = legacyArtifactPaths;
+ } //-- void setLegacyArtifactPaths( java.util.List )
+
+ /**
+ * Set the list of repositories that this archiva instance
+ * uses.
+ *
+ * @param managedRepositories
+ */
+ public void setManagedRepositories( java.util.List<ManagedRepositoryConfiguration> managedRepositories )
+ {
+ this.managedRepositories = managedRepositories;
+ } //-- void setManagedRepositories( java.util.List )
+
+ /**
+ * Set the type of the metadata storage. Allowed values: jcr,
+ * file, cassandra.
+ *
+ * @param metadataStore
+ */
+ public void setMetadataStore( String metadataStore )
+ {
+ this.metadataStore = metadataStore;
+ } //-- void setMetadataStore( String )
+
+ /**
+ * Set the modelEncoding field.
+ *
+ * @param modelEncoding
+ */
+ public void setModelEncoding( String modelEncoding )
+ {
+ this.modelEncoding = modelEncoding;
+ } //-- void setModelEncoding( String )
+
+ /**
+ * Set the NetworkConfiguration .
+ *
+ * @param networkConfiguration
+ */
+ public void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
+ {
+ this.networkConfiguration = networkConfiguration;
+ } //-- void setNetworkConfiguration( NetworkConfiguration )
+
+ /**
+ * Set the list of network proxies to use for outgoing
+ * requests.
+ *
+ * @param networkProxies
+ */
+ public void setNetworkProxies( java.util.List<NetworkProxyConfiguration> networkProxies )
+ {
+ this.networkProxies = networkProxies;
+ } //-- void setNetworkProxies( java.util.List )
+
+ /**
+ * Set the organisation info.
+ *
+ * @param organisationInfo
+ */
+ public void setOrganisationInfo( OrganisationInformation organisationInfo )
+ {
+ this.organisationInfo = organisationInfo;
+ } //-- void setOrganisationInfo( OrganisationInformation )
+
+ /**
+ * Set the list of ProxyConnectorRuleConfigurations.
+ *
+ * @param proxyConnectorRuleConfigurations
+ */
+ public void setProxyConnectorRuleConfigurations( java.util.List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations )
+ {
+ this.proxyConnectorRuleConfigurations = proxyConnectorRuleConfigurations;
+ } //-- void setProxyConnectorRuleConfigurations( java.util.List )
+
+ /**
+ * Set the list of proxy connectors for this archiva instance.
+ *
+ * @param proxyConnectors
+ */
+ public void setProxyConnectors( java.util.List<ProxyConnectorConfiguration> proxyConnectors )
+ {
+ this.proxyConnectors = proxyConnectors;
+ } //-- void setProxyConnectors( java.util.List )
+
+ /**
+ * Set the RedbackRuntimeConfiguration.
+ *
+ * @param redbackRuntimeConfiguration
+ */
+ public void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
+ {
+ this.redbackRuntimeConfiguration = redbackRuntimeConfiguration;
+ } //-- void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration )
+
+ /**
+ * Set the list of repositories that this archiva can retrieve
+ * from or publish to.
+ *
+ * @param remoteRepositories
+ */
+ public void setRemoteRepositories( java.util.List<RemoteRepositoryConfiguration> remoteRepositories )
+ {
+ this.remoteRepositories = remoteRepositories;
+ } //-- void setRemoteRepositories( java.util.List )
+
+ /**
+ * Set the list of repository groups.
+ *
+ * @param repositoryGroups
+ */
+ public void setRepositoryGroups( java.util.List<RepositoryGroupConfiguration> repositoryGroups )
+ {
+ this.repositoryGroups = repositoryGroups;
+ } //-- void setRepositoryGroups( java.util.List )
+
+ /**
+ * Set the repository scanning configuration.
+ *
+ * @param repositoryScanning
+ */
+ public void setRepositoryScanning( RepositoryScanningConfiguration repositoryScanning )
+ {
+ this.repositoryScanning = repositoryScanning;
+ } //-- void setRepositoryScanning( RepositoryScanningConfiguration )
+
+ /**
+ * Set this is the version of the configuration format.
+ *
+ * @param version
+ */
+ public void setVersion( String version )
+ {
+ this.version = version;
+ } //-- void setVersion( String )
+
+ /**
+ * Set the webapp configuration.
+ *
+ * @param webapp
+ */
+ public void setWebapp( WebappConfiguration webapp )
+ {
+ this.webapp = webapp;
+ } //-- void setWebapp( WebappConfiguration )
+
+
+ private java.util.Map<String, java.util.List<String>> repositoryToGroupMap;
+
+ public java.util.Map<String, java.util.List<String>> getRepositoryToGroupMap()
+ {
+ if ( repositoryGroups != null )
+ {
+ java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+
+ for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
+ {
+ for ( String repositoryId : (java.util.List<String>) group.getRepositories() )
+ {
+ java.util.List<String> groups = map.get( repositoryId );
+ if ( groups == null )
+ {
+ groups = new java.util.ArrayList<String>();
+ map.put( repositoryId, groups );
+ }
+ groups.add( group.getId() );
+ }
+ }
+
+ repositoryToGroupMap = map;
+ }
+ return repositoryToGroupMap;
+ }
+
+ public java.util.Map<String, RepositoryGroupConfiguration> getRepositoryGroupsAsMap()
+ {
+ java.util.Map<String, RepositoryGroupConfiguration> map = new java.util.HashMap<String, RepositoryGroupConfiguration>();
+ if ( repositoryGroups != null )
+ {
+ for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
+ {
+ map.put( group.getId(), group );
+ }
+ }
+ return map;
+ }
+
+ public RepositoryGroupConfiguration findRepositoryGroupById( String id )
+ {
+ if ( repositoryGroups != null && id!=null)
+ {
+ return ( (java.util.List<RepositoryGroupConfiguration>) repositoryGroups ).stream( ).filter( g -> g != null && id.equals( g.getId( ) ) ).findFirst( ).orElse( null );
+ }
+ return null;
+ }
+
+ private java.util.Map<String, java.util.List<String>> groupToRepositoryMap;
+
+ public java.util.Map<String, java.util.List<String>> getGroupToRepositoryMap()
+ {
+ if ( repositoryGroups != null && managedRepositories != null )
+ {
+ java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+
+ for ( ManagedRepositoryConfiguration repo : (java.util.List<ManagedRepositoryConfiguration>) managedRepositories )
+ {
+ for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
+ {
+ if ( !group.getRepositories().contains( repo.getId() ) )
+ {
+ String groupId = group.getId();
+ java.util.List<String> repos = map.get( groupId );
+ if ( repos == null )
+ {
+ repos = new java.util.ArrayList<String>();
+ map.put( groupId, repos );
+ }
+ repos.add( repo.getId() );
+ }
+ }
+ }
+ groupToRepositoryMap = map;
+ }
+ return groupToRepositoryMap;
+ }
+
+
+ public java.util.Map<String, NetworkProxyConfiguration> getNetworkProxiesAsMap()
+ {
+ java.util.Map<String, NetworkProxyConfiguration> map = new java.util.HashMap<String, NetworkProxyConfiguration>();
+ if ( networkProxies != null )
+ {
+ for ( java.util.Iterator<NetworkProxyConfiguration> i = networkProxies.iterator(); i.hasNext(); )
+ {
+ NetworkProxyConfiguration proxy = i.next();
+ map.put( proxy.getId(), proxy );
+ }
+ }
+ return map;
+ }
+
+ public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap()
+ {
+ java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
+ new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>();
+
+ if( proxyConnectors != null )
+ {
+ java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator();
+ while ( it.hasNext() )
+ {
+ ProxyConnectorConfiguration proxyConfig = it.next();
+ String key = proxyConfig.getSourceRepoId();
+
+ java.util.List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key );
+ if ( connectors == null )
+ {
+ connectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
+ proxyConnectorMap.put( key, connectors );
+ }
+
+ connectors.add( proxyConfig );
+ java.util.Collections.sort( connectors,
+ org.apache.archiva.configuration.model.functors.ProxyConnectorConfigurationOrderComparator.getInstance() );
+ }
+ }
+
+ return proxyConnectorMap;
+ }
+
+ public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap()
+ {
+ java.util.Map<String, RemoteRepositoryConfiguration> map = new java.util.HashMap<String, RemoteRepositoryConfiguration>();
+ if ( remoteRepositories != null )
+ {
+ for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); )
+ {
+ RemoteRepositoryConfiguration repo = i.next();
+ map.put( repo.getId(), repo );
+ }
+ }
+ return map;
+ }
+
+ public RemoteRepositoryConfiguration findRemoteRepositoryById( String id )
+ {
+ if ( remoteRepositories != null )
+ {
+ for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); )
+ {
+ RemoteRepositoryConfiguration repo = i.next();
+ if ( repo.getId().equals( id ) )
+ {
+ return repo;
+ }
+ }
+ }
+ return null;
+ }
+
+ public java.util.Map<String, ManagedRepositoryConfiguration> getManagedRepositoriesAsMap()
+ {
+ java.util.Map<String, ManagedRepositoryConfiguration> map = new java.util.HashMap<String, ManagedRepositoryConfiguration>();
+ if ( managedRepositories != null )
+ {
+ for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); )
+ {
+ ManagedRepositoryConfiguration repo = i.next();
+ map.put( repo.getId(), repo );
+ }
+ }
+ return map;
+ }
+
+ public ManagedRepositoryConfiguration findManagedRepositoryById( String id )
+ {
+ if ( managedRepositories != null )
+ {
+ for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); )
+ {
+ ManagedRepositoryConfiguration repo = i.next();
+ if ( repo.getId().equals( id ) )
+ {
+ return repo;
+ }
+ }
+ }
+ return null;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public interface ConfigurationModel
+{
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Utility methods for testing the configuration property name.
+ *
+ *
+ */
+public class ConfigurationNames
+{
+ public static boolean isNetworkProxy( String propertyName )
+ {
+ return startsWith( "networkProxies.", propertyName );
+ }
+
+ public static boolean isRepositoryScanning( String propertyName )
+ {
+ return startsWith( "repositoryScanning.", propertyName );
+ }
+
+ public static boolean isManagedRepositories( String propertyName )
+ {
+ return startsWith( "managedRepositories.", propertyName );
+ }
+
+ public static boolean isRemoteRepositories( String propertyName )
+ {
+ return startsWith( "remoteRepositories.", propertyName );
+ }
+
+ public static boolean isProxyConnector( String propertyName )
+ {
+ return startsWith( "proxyConnectors.", propertyName );
+ }
+
+ private static boolean startsWith( String prefix, String name )
+ {
+ if ( name == null )
+ {
+ return false;
+ }
+
+ if ( name.length() <= 0 )
+ {
+ return false;
+ }
+
+ return name.startsWith( prefix );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * File Locking configuration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class FileLockConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * skipping the locking mechanism.
+ */
+ private boolean skipLocking = true;
+
+ /**
+ * maximum time to wait to get the file lock (0 infinite).
+ */
+ private int lockingTimeout = 0;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get maximum time to wait to get the file lock (0 infinite).
+ *
+ * @return int
+ */
+ public int getLockingTimeout()
+ {
+ return this.lockingTimeout;
+ } //-- int getLockingTimeout()
+
+ /**
+ * Get skipping the locking mechanism.
+ *
+ * @return boolean
+ */
+ public boolean isSkipLocking()
+ {
+ return this.skipLocking;
+ } //-- boolean isSkipLocking()
+
+ /**
+ * Set maximum time to wait to get the file lock (0 infinite).
+ *
+ * @param lockingTimeout
+ */
+ public void setLockingTimeout( int lockingTimeout )
+ {
+ this.lockingTimeout = lockingTimeout;
+ } //-- void setLockingTimeout( int )
+
+ /**
+ * Set skipping the locking mechanism.
+ *
+ * @param skipLocking
+ */
+ public void setSkipLocking( boolean skipLocking )
+ {
+ this.skipLocking = skipLocking;
+ } //-- void setSkipLocking( boolean )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The FileType object.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class FileType
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field id.
+ */
+ private String id;
+
+ /**
+ * Field patterns.
+ */
+ private java.util.List<String> patterns;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addPattern.
+ *
+ * @param string
+ */
+ public void addPattern( String string )
+ {
+ getPatterns().add( string );
+ } //-- void addPattern( String )
+
+ /**
+ * Get the id field.
+ *
+ * @return String
+ */
+ public String getId()
+ {
+ return this.id;
+ } //-- String getId()
+
+ /**
+ * Method getPatterns.
+ *
+ * @return List
+ */
+ public java.util.List<String> getPatterns()
+ {
+ if ( this.patterns == null )
+ {
+ this.patterns = new java.util.ArrayList<String>();
+ }
+
+ return this.patterns;
+ } //-- java.util.List<String> getPatterns()
+
+ /**
+ * Method removePattern.
+ *
+ * @param string
+ */
+ public void removePattern( String string )
+ {
+ getPatterns().remove( string );
+ } //-- void removePattern( String )
+
+ /**
+ * Set the id field.
+ *
+ * @param id
+ */
+ public void setId( String id )
+ {
+ this.id = id;
+ } //-- void setId( String )
+
+ /**
+ * Set the patterns field.
+ *
+ * @param patterns
+ */
+ public void setPatterns( java.util.List<String> patterns )
+ {
+ this.patterns = patterns;
+ } //-- void setPatterns( java.util.List )
+
+
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() )
+ {
+ return false;
+ }
+
+ FileType fileType = (FileType) o;
+
+ if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return id != null ? 37 + id.hashCode() : 0;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * The LDAP configuration.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class LdapConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * The LDAP host.
+ */
+ private String hostName;
+
+ /**
+ * The LDAP port.
+ */
+ private int port = 0;
+
+ /**
+ * ssl LDAP connection.
+ */
+ private boolean ssl = false;
+
+ /**
+ * The LDAP base dn.
+ */
+ private String baseDn;
+
+ /**
+ * The LDAP base dn for groups (if empty baseDn is used).
+ */
+ private String baseGroupsDn;
+
+ /**
+ * contextFactory to use.
+ */
+ private String contextFactory;
+
+ /**
+ * The LDAP bind dn.
+ */
+ private String bindDn;
+
+ /**
+ * The LDAP password.
+ */
+ private String password;
+
+ /**
+ * The LDAP authenticationMethod.
+ */
+ private String authenticationMethod;
+
+ /**
+ * The LDAP authenticator enabled.
+ */
+ private boolean bindAuthenticatorEnabled = false;
+
+ /**
+ * LDAP writable.
+ */
+ private boolean writable = false;
+
+ /**
+ * Will use role name as LDAP group.
+ */
+ private boolean useRoleNameAsGroup = false;
+
+ /**
+ * Field extraProperties.
+ */
+ private java.util.Map extraProperties;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addExtraProperty.
+ *
+ * @param key
+ * @param value
+ */
+ public void addExtraProperty( Object key, String value )
+ {
+ getExtraProperties().put( key, value );
+ } //-- void addExtraProperty( Object, String )
+
+ /**
+ * Get the LDAP authenticationMethod.
+ *
+ * @return String
+ */
+ public String getAuthenticationMethod()
+ {
+ return this.authenticationMethod;
+ } //-- String getAuthenticationMethod()
+
+ /**
+ * Get the LDAP base dn.
+ *
+ * @return String
+ */
+ public String getBaseDn()
+ {
+ return this.baseDn;
+ } //-- String getBaseDn()
+
+ /**
+ * Get the LDAP base dn for groups (if empty baseDn is used).
+ *
+ * @return String
+ */
+ public String getBaseGroupsDn()
+ {
+ return this.baseGroupsDn;
+ } //-- String getBaseGroupsDn()
+
+ /**
+ * Get the LDAP bind dn.
+ *
+ * @return String
+ */
+ public String getBindDn()
+ {
+ return this.bindDn;
+ } //-- String getBindDn()
+
+ /**
+ * Get contextFactory to use.
+ *
+ * @return String
+ */
+ public String getContextFactory()
+ {
+ return this.contextFactory;
+ } //-- String getContextFactory()
+
+ /**
+ * Method getExtraProperties.
+ *
+ * @return Map
+ */
+ public java.util.Map getExtraProperties()
+ {
+ if ( this.extraProperties == null )
+ {
+ this.extraProperties = new java.util.HashMap();
+ }
+
+ return this.extraProperties;
+ } //-- java.util.Map getExtraProperties()
+
+ /**
+ * Get the LDAP host.
+ *
+ * @return String
+ */
+ public String getHostName()
+ {
+ return this.hostName;
+ } //-- String getHostName()
+
+ /**
+ * Get the LDAP password.
+ *
+ * @return String
+ */
+ public String getPassword()
+ {
+ return this.password;
+ } //-- String getPassword()
+
+ /**
+ * Get the LDAP port.
+ *
+ * @return int
+ */
+ public int getPort()
+ {
+ return this.port;
+ } //-- int getPort()
+
+ /**
+ * Get the LDAP authenticator enabled.
+ *
+ * @return boolean
+ */
+ public boolean isBindAuthenticatorEnabled()
+ {
+ return this.bindAuthenticatorEnabled;
+ } //-- boolean isBindAuthenticatorEnabled()
+
+ /**
+ * Get ssl LDAP connection.
+ *
+ * @return boolean
+ */
+ public boolean isSsl()
+ {
+ return this.ssl;
+ } //-- boolean isSsl()
+
+ /**
+ * Get will use role name as LDAP group.
+ *
+ * @return boolean
+ */
+ public boolean isUseRoleNameAsGroup()
+ {
+ return this.useRoleNameAsGroup;
+ } //-- boolean isUseRoleNameAsGroup()
+
+ /**
+ * Get lDAP writable.
+ *
+ * @return boolean
+ */
+ public boolean isWritable()
+ {
+ return this.writable;
+ } //-- boolean isWritable()
+
+ /**
+ * Set the LDAP authenticationMethod.
+ *
+ * @param authenticationMethod
+ */
+ public void setAuthenticationMethod( String authenticationMethod )
+ {
+ this.authenticationMethod = authenticationMethod;
+ } //-- void setAuthenticationMethod( String )
+
+ /**
+ * Set the LDAP base dn.
+ *
+ * @param baseDn
+ */
+ public void setBaseDn( String baseDn )
+ {
+ this.baseDn = baseDn;
+ } //-- void setBaseDn( String )
+
+ /**
+ * Set the LDAP base dn for groups (if empty baseDn is used).
+ *
+ * @param baseGroupsDn
+ */
+ public void setBaseGroupsDn( String baseGroupsDn )
+ {
+ this.baseGroupsDn = baseGroupsDn;
+ } //-- void setBaseGroupsDn( String )
+
+ /**
+ * Set the LDAP authenticator enabled.
+ *
+ * @param bindAuthenticatorEnabled
+ */
+ public void setBindAuthenticatorEnabled( boolean bindAuthenticatorEnabled )
+ {
+ this.bindAuthenticatorEnabled = bindAuthenticatorEnabled;
+ } //-- void setBindAuthenticatorEnabled( boolean )
+
+ /**
+ * Set the LDAP bind dn.
+ *
+ * @param bindDn
+ */
+ public void setBindDn( String bindDn )
+ {
+ this.bindDn = bindDn;
+ } //-- void setBindDn( String )
+
+ /**
+ * Set contextFactory to use.
+ *
+ * @param contextFactory
+ */
+ public void setContextFactory( String contextFactory )
+ {
+ this.contextFactory = contextFactory;
+ } //-- void setContextFactory( String )
+
+ /**
+ * Set additional properties to use for ldap connection.
+ *
+ * @param extraProperties
+ */
+ public void setExtraProperties( java.util.Map extraProperties )
+ {
+ this.extraProperties = extraProperties;
+ } //-- void setExtraProperties( java.util.Map )
+
+ /**
+ * Set the LDAP host.
+ *
+ * @param hostName
+ */
+ public void setHostName( String hostName )
+ {
+ this.hostName = hostName;
+ } //-- void setHostName( String )
+
+ /**
+ * Set the LDAP password.
+ *
+ * @param password
+ */
+ public void setPassword( String password )
+ {
+ this.password = password;
+ } //-- void setPassword( String )
+
+ /**
+ * Set the LDAP port.
+ *
+ * @param port
+ */
+ public void setPort( int port )
+ {
+ this.port = port;
+ } //-- void setPort( int )
+
+ /**
+ * Set ssl LDAP connection.
+ *
+ * @param ssl
+ */
+ public void setSsl( boolean ssl )
+ {
+ this.ssl = ssl;
+ } //-- void setSsl( boolean )
+
+ /**
+ * Set will use role name as LDAP group.
+ *
+ * @param useRoleNameAsGroup
+ */
+ public void setUseRoleNameAsGroup( boolean useRoleNameAsGroup )
+ {
+ this.useRoleNameAsGroup = useRoleNameAsGroup;
+ } //-- void setUseRoleNameAsGroup( boolean )
+
+ /**
+ * Set lDAP writable.
+ *
+ * @param writable
+ */
+ public void setWritable( boolean writable )
+ {
+ this.writable = writable;
+ } //-- void setWritable( boolean )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * configuration of a LDAP group to Archiva roles.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class LdapGroupMapping
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * LDAP Group.
+ */
+ private String group;
+
+ /**
+ * Field roleNames.
+ */
+ private java.util.List<String> roleNames;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addRoleName.
+ *
+ * @param string
+ */
+ public void addRoleName( String string )
+ {
+ getRoleNames().add( string );
+ } //-- void addRoleName( String )
+
+ /**
+ * Get lDAP Group.
+ *
+ * @return String
+ */
+ public String getGroup()
+ {
+ return this.group;
+ } //-- String getGroup()
+
+ /**
+ * Method getRoleNames.
+ *
+ * @return List
+ */
+ public java.util.List<String> getRoleNames()
+ {
+ if ( this.roleNames == null )
+ {
+ this.roleNames = new java.util.ArrayList<String>();
+ }
+
+ return this.roleNames;
+ } //-- java.util.List<String> getRoleNames()
+
+ /**
+ * Method removeRoleName.
+ *
+ * @param string
+ */
+ public void removeRoleName( String string )
+ {
+ getRoleNames().remove( string );
+ } //-- void removeRoleName( String )
+
+ /**
+ * Set lDAP Group.
+ *
+ * @param group
+ */
+ public void setGroup( String group )
+ {
+ this.group = group;
+ } //-- void setGroup( String )
+
+ /**
+ * Set archiva roles.
+ *
+ * @param roleNames
+ */
+ public void setRoleNames( java.util.List<String> roleNames )
+ {
+ this.roleNames = roleNames;
+ } //-- void setRoleNames( java.util.List )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class LegacyArtifactPath.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class LegacyArtifactPath
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The legacy path.
+ *
+ */
+ private String path;
+
+ /**
+ *
+ * The artifact reference, as " [groupId] :
+ * [artifactId] : [version] : [classifier] : [type] ".
+ *
+ */
+ private String artifact;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the artifact reference, as " [groupId] : [artifactId] :
+ * [version] : [classifier] : [type] ".
+ *
+ * @return String
+ */
+ public String getArtifact()
+ {
+ return this.artifact;
+ } //-- String getArtifact()
+
+ /**
+ * Get the legacy path.
+ *
+ * @return String
+ */
+ public String getPath()
+ {
+ return this.path;
+ } //-- String getPath()
+
+ /**
+ * Set the artifact reference, as " [groupId] : [artifactId] :
+ * [version] : [classifier] : [type] ".
+ *
+ * @param artifact
+ */
+ public void setArtifact( String artifact )
+ {
+ this.artifact = artifact;
+ } //-- void setArtifact( String )
+
+ /**
+ * Set the legacy path.
+ *
+ * @param path
+ */
+ public void setPath( String path )
+ {
+ this.path = path;
+ } //-- void setPath( String )
+
+
+ public boolean match( String path )
+ {
+ return path.equals( this.path );
+ }
+
+ public String getGroupId()
+ {
+ return artifact.split( ":" )[0];
+ }
+
+ public String getArtifactId()
+ {
+ return artifact.split( ":" )[1];
+ }
+
+ public String getVersion()
+ {
+ return artifact.split( ":" )[2];
+ }
+
+ public String getClassifier()
+ {
+ String classifier = artifact.split( ":" )[3];
+ return classifier.length() > 0 ? classifier : null;
+ }
+
+ public String getType()
+ {
+ return artifact.split( ":" )[4];
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() )
+ {
+ return false;
+ }
+
+ LegacyArtifactPath that = (LegacyArtifactPath) o;
+
+ if ( path != null ? !path.equals( that.path ) : that.path != null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return path != null ? 37 + path.hashCode() : 0;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class ManagedRepositoryConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class ManagedRepositoryConfiguration
+ extends AbstractRepositoryConfiguration
+ implements java.io.Serializable, ConfigurationModel
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The file system location for this repository.
+ *
+ */
+ private String location;
+
+ /**
+ * True if this repository contains release versioned artifacts.
+ */
+ private boolean releases = true;
+
+ /**
+ * True if re-deployment of artifacts already in the repository
+ * will be blocked.
+ */
+ private boolean blockRedeployments = false;
+
+ /**
+ * True if this repository contains snapshot versioned artifacts
+ */
+ private boolean snapshots = false;
+
+ /**
+ * True if this repository should be scanned and processed.
+ */
+ private boolean scanned = true;
+
+ /**
+ *
+ * When to run the refresh task.
+ * Default is every hour
+ * .
+ */
+ private String refreshCronExpression = "0 0 * * * ?";
+
+ /**
+ *
+ * The total count of the artifact to be retained
+ * for each snapshot.
+ *
+ */
+ private int retentionCount = 2;
+
+ /**
+ *
+ * The number of days after which snapshots will be
+ * removed.
+ *
+ */
+ private int retentionPeriod = 100;
+
+ /**
+ *
+ * True if the released snapshots are to be removed
+ * from the repo during repository purge.
+ *
+ */
+ private boolean deleteReleasedSnapshots = false;
+
+ /**
+ *
+ * True to not generate packed index (note you
+ * won't be able to export your index.
+ *
+ */
+ private boolean skipPackedIndexCreation = false;
+
+ /**
+ *
+ * Need a staging repository
+ * .
+ */
+ private boolean stageRepoNeeded = false;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the file system location for this repository.
+ *
+ * @return String
+ */
+ public String getLocation()
+ {
+ return this.location;
+ } //-- String getLocation()
+
+ /**
+ * Get when to run the refresh task.
+ * Default is every hour.
+ *
+ * @return String
+ */
+ public String getRefreshCronExpression()
+ {
+ return this.refreshCronExpression;
+ } //-- String getRefreshCronExpression()
+
+ /**
+ * Get the total count of the artifact to be retained for each
+ * snapshot.
+ *
+ * @return int
+ */
+ public int getRetentionCount()
+ {
+ return this.retentionCount;
+ } //-- int getRetentionCount()
+
+ /**
+ * Get the number of days after which snapshots will be
+ * removed.
+ *
+ * @return int
+ */
+ public int getRetentionPeriod()
+ {
+ return this.retentionPeriod;
+ } //-- int getRetentionPeriod()
+
+ /**
+ * Get true if re-deployment of artifacts already in the
+ * repository will be blocked.
+ *
+ * @return boolean
+ */
+ public boolean isBlockRedeployments()
+ {
+ return this.blockRedeployments;
+ } //-- boolean isBlockRedeployments()
+
+ /**
+ * Get true if the released snapshots are to be removed from
+ * the repo during repository purge.
+ *
+ * @return boolean
+ */
+ public boolean isDeleteReleasedSnapshots()
+ {
+ return this.deleteReleasedSnapshots;
+ } //-- boolean isDeleteReleasedSnapshots()
+
+ /**
+ * Get true if this repository contains release versioned
+ * artifacts.
+ *
+ * @return boolean
+ */
+ public boolean isReleases()
+ {
+ return this.releases;
+ } //-- boolean isReleases()
+
+ /**
+ * Get true if this repository should be scanned and processed.
+ *
+ * @return boolean
+ */
+ public boolean isScanned()
+ {
+ return this.scanned;
+ } //-- boolean isScanned()
+
+ /**
+ * Get true to not generate packed index (note you won't be
+ * able to export your index.
+ *
+ * @return boolean
+ */
+ public boolean isSkipPackedIndexCreation()
+ {
+ return this.skipPackedIndexCreation;
+ } //-- boolean isSkipPackedIndexCreation()
+
+ /**
+ * Get true if this repository contains snapshot versioned
+ * artifacts.
+ *
+ * @return boolean
+ */
+ public boolean isSnapshots()
+ {
+ return this.snapshots;
+ } //-- boolean isSnapshots()
+
+ /**
+ * Get need a staging repository.
+ *
+ * @return boolean
+ */
+ public boolean isStageRepoNeeded()
+ {
+ return this.stageRepoNeeded;
+ } //-- boolean isStageRepoNeeded()
+
+ /**
+ * Set true if re-deployment of artifacts already in the
+ * repository will be blocked.
+ *
+ * @param blockRedeployments
+ */
+ public void setBlockRedeployments( boolean blockRedeployments )
+ {
+ this.blockRedeployments = blockRedeployments;
+ } //-- void setBlockRedeployments( boolean )
+
+ /**
+ * Set true if the released snapshots are to be removed from
+ * the repo during repository purge.
+ *
+ * @param deleteReleasedSnapshots
+ */
+ public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
+ {
+ this.deleteReleasedSnapshots = deleteReleasedSnapshots;
+ } //-- void setDeleteReleasedSnapshots( boolean )
+
+ /**
+ * Set the file system location for this repository.
+ *
+ * @param location
+ */
+ public void setLocation( String location )
+ {
+ this.location = location;
+ } //-- void setLocation( String )
+
+ /**
+ * Set when to run the refresh task.
+ * Default is every hour.
+ *
+ * @param refreshCronExpression
+ */
+ public void setRefreshCronExpression( String refreshCronExpression )
+ {
+ this.refreshCronExpression = refreshCronExpression;
+ } //-- void setRefreshCronExpression( String )
+
+ /**
+ * Set true if this repository contains release versioned
+ * artifacts.
+ *
+ * @param releases
+ */
+ public void setReleases( boolean releases )
+ {
+ this.releases = releases;
+ } //-- void setReleases( boolean )
+
+ /**
+ * Set the total count of the artifact to be retained for each
+ * snapshot.
+ *
+ * @param retentionCount
+ */
+ public void setRetentionCount( int retentionCount )
+ {
+ this.retentionCount = retentionCount;
+ } //-- void setRetentionCount( int )
+
+ /**
+ * Set the number of days after which snapshots will be
+ * removed.
+ *
+ * @param retentionPeriod
+ */
+ public void setRetentionPeriod( int retentionPeriod )
+ {
+ this.retentionPeriod = retentionPeriod;
+ } //-- void setRetentionPeriod( int )
+
+ /**
+ * Set true if this repository should be scanned and processed.
+ *
+ * @param scanned
+ */
+ public void setScanned( boolean scanned )
+ {
+ this.scanned = scanned;
+ } //-- void setScanned( boolean )
+
+ /**
+ * Set true to not generate packed index (note you won't be
+ * able to export your index.
+ *
+ * @param skipPackedIndexCreation
+ */
+ public void setSkipPackedIndexCreation( boolean skipPackedIndexCreation )
+ {
+ this.skipPackedIndexCreation = skipPackedIndexCreation;
+ } //-- void setSkipPackedIndexCreation( boolean )
+
+ /**
+ * Set true if this repository contains snapshot versioned
+ * artifacts.
+ *
+ * @param snapshots
+ */
+ public void setSnapshots( boolean snapshots )
+ {
+ this.snapshots = snapshots;
+ } //-- void setSnapshots( boolean )
+
+ /**
+ * Set need a staging repository.
+ *
+ * @param stageRepoNeeded
+ */
+ public void setStageRepoNeeded( boolean stageRepoNeeded )
+ {
+ this.stageRepoNeeded = stageRepoNeeded;
+ } //-- void setStageRepoNeeded( boolean )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * The network configuration for external http request to
+ * repositories.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class NetworkConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * maximum total external http connections.
+ */
+ private int maxTotal = 30;
+
+ /**
+ * maximum total external http connections per host.
+ */
+ private int maxTotalPerHost = 30;
+
+ /**
+ * use or not http connection pooling default true.
+ */
+ private boolean usePooling = true;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get maximum total external http connections.
+ *
+ * @return int
+ */
+ public int getMaxTotal()
+ {
+ return this.maxTotal;
+ } //-- int getMaxTotal()
+
+ /**
+ * Get maximum total external http connections per host.
+ *
+ * @return int
+ */
+ public int getMaxTotalPerHost()
+ {
+ return this.maxTotalPerHost;
+ } //-- int getMaxTotalPerHost()
+
+ /**
+ * Get use or not http connection pooling default true.
+ *
+ * @return boolean
+ */
+ public boolean isUsePooling()
+ {
+ return this.usePooling;
+ } //-- boolean isUsePooling()
+
+ /**
+ * Set maximum total external http connections.
+ *
+ * @param maxTotal
+ */
+ public void setMaxTotal( int maxTotal )
+ {
+ this.maxTotal = maxTotal;
+ } //-- void setMaxTotal( int )
+
+ /**
+ * Set maximum total external http connections per host.
+ *
+ * @param maxTotalPerHost
+ */
+ public void setMaxTotalPerHost( int maxTotalPerHost )
+ {
+ this.maxTotalPerHost = maxTotalPerHost;
+ } //-- void setMaxTotalPerHost( int )
+
+ /**
+ * Set use or not http connection pooling default true.
+ *
+ * @param usePooling
+ */
+ public void setUsePooling( boolean usePooling )
+ {
+ this.usePooling = usePooling;
+ } //-- void setUsePooling( boolean )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class NetworkProxyConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class NetworkProxyConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The ID for this proxy.
+ *
+ */
+ private String id;
+
+ /**
+ *
+ * The network protocol to use with this proxy:
+ * "http", "socks-4"
+ * .
+ */
+ private String protocol = "http";
+
+ /**
+ *
+ * The proxy host.
+ *
+ */
+ private String host;
+
+ /**
+ *
+ * The proxy port.
+ *
+ */
+ private int port = 8080;
+
+ /**
+ *
+ * The proxy user.
+ *
+ */
+ private String username;
+
+ /**
+ *
+ * The proxy password.
+ *
+ */
+ private String password;
+
+ /**
+ *
+ * Use ntlm authentification.
+ *
+ */
+ private boolean useNtlm = false;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the proxy host.
+ *
+ * @return String
+ */
+ public String getHost()
+ {
+ return this.host;
+ } //-- String getHost()
+
+ /**
+ * Get the ID for this proxy.
+ *
+ * @return String
+ */
+ public String getId()
+ {
+ return this.id;
+ } //-- String getId()
+
+ /**
+ * Get the proxy password.
+ *
+ * @return String
+ */
+ public String getPassword()
+ {
+ return this.password;
+ } //-- String getPassword()
+
+ /**
+ * Get the proxy port.
+ *
+ * @return int
+ */
+ public int getPort()
+ {
+ return this.port;
+ } //-- int getPort()
+
+ /**
+ * Get the network protocol to use with this proxy: "http",
+ * "socks-4".
+ *
+ * @return String
+ */
+ public String getProtocol()
+ {
+ return this.protocol;
+ } //-- String getProtocol()
+
+ /**
+ * Get the proxy user.
+ *
+ * @return String
+ */
+ public String getUsername()
+ {
+ return this.username;
+ } //-- String getUsername()
+
+ /**
+ * Get use ntlm authentification.
+ *
+ * @return boolean
+ */
+ public boolean isUseNtlm()
+ {
+ return this.useNtlm;
+ } //-- boolean isUseNtlm()
+
+ /**
+ * Set the proxy host.
+ *
+ * @param host
+ */
+ public void setHost( String host )
+ {
+ this.host = host;
+ } //-- void setHost( String )
+
+ /**
+ * Set the ID for this proxy.
+ *
+ * @param id
+ */
+ public void setId( String id )
+ {
+ this.id = id;
+ } //-- void setId( String )
+
+ /**
+ * Set the proxy password.
+ *
+ * @param password
+ */
+ public void setPassword( String password )
+ {
+ this.password = password;
+ } //-- void setPassword( String )
+
+ /**
+ * Set the proxy port.
+ *
+ * @param port
+ */
+ public void setPort( int port )
+ {
+ this.port = port;
+ } //-- void setPort( int )
+
+ /**
+ * Set the network protocol to use with this proxy: "http",
+ * "socks-4".
+ *
+ * @param protocol
+ */
+ public void setProtocol( String protocol )
+ {
+ this.protocol = protocol;
+ } //-- void setProtocol( String )
+
+ /**
+ * Set use ntlm authentification.
+ *
+ * @param useNtlm
+ */
+ public void setUseNtlm( boolean useNtlm )
+ {
+ this.useNtlm = useNtlm;
+ } //-- void setUseNtlm( boolean )
+
+ /**
+ * Set the proxy user.
+ *
+ * @param username
+ */
+ public void setUsername( String username )
+ {
+ this.username = username;
+ } //-- void setUsername( String )
+
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = 37 * result + ( id != null ? id.hashCode() : 0 );
+ return result;
+ }
+
+ public boolean equals( Object other )
+ {
+ if ( this == other )
+ {
+ return true;
+ }
+
+ if ( !( other instanceof NetworkProxyConfiguration ) )
+ {
+ return false;
+ }
+
+ NetworkProxyConfiguration that = (NetworkProxyConfiguration) other;
+ boolean result = true;
+ result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
+ return result;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * The organisation information settings.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class OrganisationInformation
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * name of the organisation.
+ */
+ private String name;
+
+ /**
+ * name of the organisation.
+ */
+ private String url;
+
+ /**
+ * name of the organisation.
+ */
+ private String logoLocation;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get name of the organisation.
+ *
+ * @return String
+ */
+ public String getLogoLocation()
+ {
+ return this.logoLocation;
+ } //-- String getLogoLocation()
+
+ /**
+ * Get name of the organisation.
+ *
+ * @return String
+ */
+ public String getName()
+ {
+ return this.name;
+ } //-- String getName()
+
+ /**
+ * Get name of the organisation.
+ *
+ * @return String
+ */
+ public String getUrl()
+ {
+ return this.url;
+ } //-- String getUrl()
+
+ /**
+ * Set name of the organisation.
+ *
+ * @param logoLocation
+ */
+ public void setLogoLocation( String logoLocation )
+ {
+ this.logoLocation = logoLocation;
+ } //-- void setLogoLocation( String )
+
+ /**
+ * Set name of the organisation.
+ *
+ * @param name
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ } //-- void setName( String )
+
+ /**
+ * Set name of the organisation.
+ *
+ * @param url
+ */
+ public void setUrl( String url )
+ {
+ this.url = url;
+ } //-- void setUrl( String )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class ProxyConnectorConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class ProxyConnectorConfiguration
+ extends AbstractRepositoryConnectorConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The order of the proxy connectors. (0 means no
+ * order specified)
+ * .
+ */
+ private int order = 0;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the order of the proxy connectors. (0 means no order
+ * specified).
+ *
+ * @return int
+ */
+ public int getOrder()
+ {
+ return this.order;
+ } //-- int getOrder()
+
+ /**
+ * Set the order of the proxy connectors. (0 means no order
+ * specified).
+ *
+ * @param order
+ */
+ public void setOrder( int order )
+ {
+ this.order = order;
+ } //-- void setOrder( int )
+
+
+ /**
+ * The order id for UNORDERED
+ */
+ public static final int UNORDERED = 0;
+
+ /**
+ * The policy key {@link #getPolicies()} for error handling.
+ * See {@link org.apache.archiva.policies.DownloadErrorPolicy}
+ * for details on potential values to this policy key.
+ */
+ public static final String POLICY_PROPAGATE_ERRORS = "propagate-errors";
+
+ /**
+ * The policy key {@link #getPolicies()} for error handling when an artifact is present.
+ * See {@link org.apache.archiva.policies.DownloadErrorPolicy}
+ * for details on potential values to this policy key.
+ */
+ public static final String POLICY_PROPAGATE_ERRORS_ON_UPDATE = "propagate-errors-on-update";
+
+ /**
+ * The policy key {@link #getPolicies()} for snapshot handling.
+ * See {@link org.apache.archiva.policies.SnapshotsPolicy}
+ * for details on potential values to this policy key.
+ */
+ public static final String POLICY_SNAPSHOTS = "snapshots";
+
+ /**
+ * The policy key {@link #getPolicies()} for releases handling.
+ * See {@link org.apache.archiva.policies.ReleasesPolicy}
+ * for details on potential values to this policy key.
+ */
+ public static final String POLICY_RELEASES = "releases";
+
+ /**
+ * The policy key {@link #getPolicies()} for checksum handling.
+ * See {@link org.apache.archiva.policies.ChecksumPolicy}
+ * for details on potential values to this policy key.
+ */
+ public static final String POLICY_CHECKSUM = "checksum";
+
+ /**
+ * The policy key {@link #getPolicies()} for cache-failures handling.
+ * See {@link org.apache.archiva.policies.CachedFailuresPolicy}
+ * for details on potential values to this policy key.
+ */
+ public static final String POLICY_CACHE_FAILURES = "cache-failures";
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class ProxyConnectorRuleConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class ProxyConnectorRuleConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The type if this rule: whiteList, blackList
+ * etc..
+ *
+ */
+ private String ruleType;
+
+ /**
+ *
+ * The pattern for this rule: whiteList, blackList
+ * etc..
+ *
+ */
+ private String pattern;
+
+ /**
+ * Field proxyConnectors.
+ */
+ private java.util.List<ProxyConnectorConfiguration> proxyConnectors;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addProxyConnector.
+ *
+ * @param proxyConnectorConfiguration
+ */
+ public void addProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
+ {
+ getProxyConnectors().add( proxyConnectorConfiguration );
+ } //-- void addProxyConnector( ProxyConnectorConfiguration )
+
+ /**
+ * Get the pattern for this rule: whiteList, blackList etc..
+ *
+ * @return String
+ */
+ public String getPattern()
+ {
+ return this.pattern;
+ } //-- String getPattern()
+
+ /**
+ * Method getProxyConnectors.
+ *
+ * @return List
+ */
+ public java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
+ {
+ if ( this.proxyConnectors == null )
+ {
+ this.proxyConnectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
+ }
+
+ return this.proxyConnectors;
+ } //-- java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
+
+ /**
+ * Get the type if this rule: whiteList, blackList etc..
+ *
+ * @return String
+ */
+ public String getRuleType()
+ {
+ return this.ruleType;
+ } //-- String getRuleType()
+
+ /**
+ * Method removeProxyConnector.
+ *
+ * @param proxyConnectorConfiguration
+ */
+ public void removeProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
+ {
+ getProxyConnectors().remove( proxyConnectorConfiguration );
+ } //-- void removeProxyConnector( ProxyConnectorConfiguration )
+
+ /**
+ * Set the pattern for this rule: whiteList, blackList etc..
+ *
+ * @param pattern
+ */
+ public void setPattern( String pattern )
+ {
+ this.pattern = pattern;
+ } //-- void setPattern( String )
+
+ /**
+ * Set associated proxyConnectors configuration.
+ *
+ * @param proxyConnectors
+ */
+ public void setProxyConnectors( java.util.List<ProxyConnectorConfiguration> proxyConnectors )
+ {
+ this.proxyConnectors = proxyConnectors;
+ } //-- void setProxyConnectors( java.util.List )
+
+ /**
+ * Set the type if this rule: whiteList, blackList etc..
+ *
+ * @param ruleType
+ */
+ public void setRuleType( String ruleType )
+ {
+ this.ruleType = ruleType;
+ } //-- void setRuleType( String )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * The redback runtime configuration.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class RedbackRuntimeConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * flag to know if redback configuration has been
+ * checked/migrated.
+ */
+ private boolean migratedFromRedbackConfiguration = false;
+
+ /**
+ * Field userManagerImpls.
+ */
+ private java.util.List<String> userManagerImpls;
+
+ /**
+ * Field rbacManagerImpls.
+ */
+ private java.util.List<String> rbacManagerImpls;
+
+ /**
+ * the ldap configuration.
+ */
+ private LdapConfiguration ldapConfiguration;
+
+ /**
+ * Field ldapGroupMappings.
+ */
+ private java.util.List<LdapGroupMapping> ldapGroupMappings;
+
+ /**
+ * Field configurationProperties.
+ */
+ private java.util.Map configurationProperties;
+
+ /**
+ * flag to know if redback will use a cache to prevent
+ * searching users already found.
+ */
+ private boolean useUsersCache = true;
+
+ /**
+ * the users cache configuration.
+ */
+ private CacheConfiguration usersCacheConfiguration;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addConfigurationProperty.
+ *
+ * @param key
+ * @param value
+ */
+ public void addConfigurationProperty( Object key, String value )
+ {
+ getConfigurationProperties().put( key, value );
+ } //-- void addConfigurationProperty( Object, String )
+
+ /**
+ * Method addLdapGroupMapping.
+ *
+ * @param ldapGroupMapping
+ */
+ public void addLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
+ {
+ getLdapGroupMappings().add( ldapGroupMapping );
+ } //-- void addLdapGroupMapping( LdapGroupMapping )
+
+ /**
+ * Method addRbacManagerImpl.
+ *
+ * @param string
+ */
+ public void addRbacManagerImpl( String string )
+ {
+ getRbacManagerImpls().add( string );
+ } //-- void addRbacManagerImpl( String )
+
+ /**
+ * Method addUserManagerImpl.
+ *
+ * @param string
+ */
+ public void addUserManagerImpl( String string )
+ {
+ getUserManagerImpls().add( string );
+ } //-- void addUserManagerImpl( String )
+
+ /**
+ * Method getConfigurationProperties.
+ *
+ * @return Map
+ */
+ public java.util.Map getConfigurationProperties()
+ {
+ if ( this.configurationProperties == null )
+ {
+ this.configurationProperties = new java.util.HashMap();
+ }
+
+ return this.configurationProperties;
+ } //-- java.util.Map getConfigurationProperties()
+
+ /**
+ * Get the ldap configuration.
+ *
+ * @return LdapConfiguration
+ */
+ public LdapConfiguration getLdapConfiguration()
+ {
+ return this.ldapConfiguration;
+ } //-- LdapConfiguration getLdapConfiguration()
+
+ /**
+ * Method getLdapGroupMappings.
+ *
+ * @return List
+ */
+ public java.util.List<LdapGroupMapping> getLdapGroupMappings()
+ {
+ if ( this.ldapGroupMappings == null )
+ {
+ this.ldapGroupMappings = new java.util.ArrayList<LdapGroupMapping>();
+ }
+
+ return this.ldapGroupMappings;
+ } //-- java.util.List<LdapGroupMapping> getLdapGroupMappings()
+
+ /**
+ * Method getRbacManagerImpls.
+ *
+ * @return List
+ */
+ public java.util.List<String> getRbacManagerImpls()
+ {
+ if ( this.rbacManagerImpls == null )
+ {
+ this.rbacManagerImpls = new java.util.ArrayList<String>();
+ }
+
+ return this.rbacManagerImpls;
+ } //-- java.util.List<String> getRbacManagerImpls()
+
+ /**
+ * Method getUserManagerImpls.
+ *
+ * @return List
+ */
+ public java.util.List<String> getUserManagerImpls()
+ {
+ if ( this.userManagerImpls == null )
+ {
+ this.userManagerImpls = new java.util.ArrayList<String>();
+ }
+
+ return this.userManagerImpls;
+ } //-- java.util.List<String> getUserManagerImpls()
+
+ /**
+ * Get the users cache configuration.
+ *
+ * @return CacheConfiguration
+ */
+ public CacheConfiguration getUsersCacheConfiguration()
+ {
+ return this.usersCacheConfiguration;
+ } //-- CacheConfiguration getUsersCacheConfiguration()
+
+ /**
+ * Get flag to know if redback configuration has been
+ * checked/migrated.
+ *
+ * @return boolean
+ */
+ public boolean isMigratedFromRedbackConfiguration()
+ {
+ return this.migratedFromRedbackConfiguration;
+ } //-- boolean isMigratedFromRedbackConfiguration()
+
+ /**
+ * Get flag to know if redback will use a cache to prevent
+ * searching users already found.
+ *
+ * @return boolean
+ */
+ public boolean isUseUsersCache()
+ {
+ return this.useUsersCache;
+ } //-- boolean isUseUsersCache()
+
+ /**
+ * Method removeLdapGroupMapping.
+ *
+ * @param ldapGroupMapping
+ */
+ public void removeLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
+ {
+ getLdapGroupMappings().remove( ldapGroupMapping );
+ } //-- void removeLdapGroupMapping( LdapGroupMapping )
+
+ /**
+ * Method removeRbacManagerImpl.
+ *
+ * @param string
+ */
+ public void removeRbacManagerImpl( String string )
+ {
+ getRbacManagerImpls().remove( string );
+ } //-- void removeRbacManagerImpl( String )
+
+ /**
+ * Method removeUserManagerImpl.
+ *
+ * @param string
+ */
+ public void removeUserManagerImpl( String string )
+ {
+ getUserManagerImpls().remove( string );
+ } //-- void removeUserManagerImpl( String )
+
+ /**
+ * Set extra properties for redback configuration.
+ * String/String.
+ *
+ * @param configurationProperties
+ */
+ public void setConfigurationProperties( java.util.Map configurationProperties )
+ {
+ this.configurationProperties = configurationProperties;
+ } //-- void setConfigurationProperties( java.util.Map )
+
+ /**
+ * Set the ldap configuration.
+ *
+ * @param ldapConfiguration
+ */
+ public void setLdapConfiguration( LdapConfiguration ldapConfiguration )
+ {
+ this.ldapConfiguration = ldapConfiguration;
+ } //-- void setLdapConfiguration( LdapConfiguration )
+
+ /**
+ * Set ldapGroupMappings.
+ *
+ * @param ldapGroupMappings
+ */
+ public void setLdapGroupMappings( java.util.List<LdapGroupMapping> ldapGroupMappings )
+ {
+ this.ldapGroupMappings = ldapGroupMappings;
+ } //-- void setLdapGroupMappings( java.util.List )
+
+ /**
+ * Set flag to know if redback configuration has been
+ * checked/migrated.
+ *
+ * @param migratedFromRedbackConfiguration
+ */
+ public void setMigratedFromRedbackConfiguration( boolean migratedFromRedbackConfiguration )
+ {
+ this.migratedFromRedbackConfiguration = migratedFromRedbackConfiguration;
+ } //-- void setMigratedFromRedbackConfiguration( boolean )
+
+ /**
+ * Set the RBAC Manager impls to use.
+ *
+ * @param rbacManagerImpls
+ */
+ public void setRbacManagerImpls( java.util.List<String> rbacManagerImpls )
+ {
+ this.rbacManagerImpls = rbacManagerImpls;
+ } //-- void setRbacManagerImpls( java.util.List )
+
+ /**
+ * Set flag to know if redback will use a cache to prevent
+ * searching users already found.
+ *
+ * @param useUsersCache
+ */
+ public void setUseUsersCache( boolean useUsersCache )
+ {
+ this.useUsersCache = useUsersCache;
+ } //-- void setUseUsersCache( boolean )
+
+ /**
+ * Set the user manager impls to use.
+ *
+ * @param userManagerImpls
+ */
+ public void setUserManagerImpls( java.util.List<String> userManagerImpls )
+ {
+ this.userManagerImpls = userManagerImpls;
+ } //-- void setUserManagerImpls( java.util.List )
+
+ /**
+ * Set the users cache configuration.
+ *
+ * @param usersCacheConfiguration
+ */
+ public void setUsersCacheConfiguration( CacheConfiguration usersCacheConfiguration )
+ {
+ this.usersCacheConfiguration = usersCacheConfiguration;
+ } //-- void setUsersCacheConfiguration( CacheConfiguration )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class RemoteRepositoryConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class RemoteRepositoryConfiguration
+ extends AbstractRepositoryConfiguration
+ implements java.io.Serializable, ConfigurationModel
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The URL for this repository.
+ *
+ */
+ private String url;
+
+ /**
+ *
+ * The Username for this repository.
+ *
+ */
+ private String username;
+
+ /**
+ *
+ * The Password for this repository.
+ *
+ */
+ private String password;
+
+ /**
+ *
+ * Timeout in seconds for connections to this
+ * repository
+ * .
+ */
+ private int timeout = 60;
+
+ /**
+ *
+ * When to run the refresh task.
+ * Default is every sunday at 8H00.
+ *
+ */
+ private String refreshCronExpression = "0 0 08 ? * SUN";
+
+ /**
+ *
+ * Activate download of remote index if
+ * remoteIndexUrl is set too.
+ *
+ */
+ private boolean downloadRemoteIndex = false;
+
+ /**
+ *
+ * Remote Index Url : if not starting with http
+ * will be relative to the remote repository url.
+ *
+ */
+ private String remoteIndexUrl;
+
+ /**
+ *
+ * Id of the networkProxy to use when downloading
+ * remote index.
+ *
+ */
+ private String remoteDownloadNetworkProxyId;
+
+ /**
+ *
+ * Timeout in seconds for download remote index.
+ * Default is more long than artifact download.
+ *
+ */
+ private int remoteDownloadTimeout = 300;
+
+ /**
+ *
+ * Schedule download of remote index when archiva
+ * start
+ * .
+ */
+ private boolean downloadRemoteIndexOnStartup = false;
+
+ /**
+ * Field extraParameters.
+ */
+ private java.util.Map extraParameters;
+
+ /**
+ * Field extraHeaders.
+ */
+ private java.util.Map extraHeaders;
+
+ /**
+ * The path to check the repository availability (relative to
+ * the repository URL). Some repositories do not allow
+ * browsing, so a certain artifact must be checked.
+ */
+ private String checkPath;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addExtraHeader.
+ *
+ * @param key
+ * @param value
+ */
+ public void addExtraHeader( Object key, String value )
+ {
+ getExtraHeaders().put( key, value );
+ } //-- void addExtraHeader( Object, String )
+
+ /**
+ * Method addExtraParameter.
+ *
+ * @param key
+ * @param value
+ */
+ public void addExtraParameter( Object key, String value )
+ {
+ getExtraParameters().put( key, value );
+ } //-- void addExtraParameter( Object, String )
+
+ /**
+ * Get the path to check the repository availability (relative
+ * to the repository URL). Some repositories do not allow
+ * browsing, so a certain artifact must be checked.
+ *
+ * @return String
+ */
+ public String getCheckPath()
+ {
+ return this.checkPath;
+ } //-- String getCheckPath()
+
+ /**
+ * Method getExtraHeaders.
+ *
+ * @return Map
+ */
+ public java.util.Map getExtraHeaders()
+ {
+ if ( this.extraHeaders == null )
+ {
+ this.extraHeaders = new java.util.HashMap();
+ }
+
+ return this.extraHeaders;
+ } //-- java.util.Map getExtraHeaders()
+
+ /**
+ * Method getExtraParameters.
+ *
+ * @return Map
+ */
+ public java.util.Map getExtraParameters()
+ {
+ if ( this.extraParameters == null )
+ {
+ this.extraParameters = new java.util.HashMap();
+ }
+
+ return this.extraParameters;
+ } //-- java.util.Map getExtraParameters()
+
+ /**
+ * Get the Password for this repository.
+ *
+ * @return String
+ */
+ public String getPassword()
+ {
+ return this.password;
+ } //-- String getPassword()
+
+ /**
+ * Get when to run the refresh task.
+ * Default is every sunday at 8H00.
+ *
+ * @return String
+ */
+ public String getRefreshCronExpression()
+ {
+ return this.refreshCronExpression;
+ } //-- String getRefreshCronExpression()
+
+ /**
+ * Get id of the networkProxy to use when downloading remote
+ * index.
+ *
+ * @return String
+ */
+ public String getRemoteDownloadNetworkProxyId()
+ {
+ return this.remoteDownloadNetworkProxyId;
+ } //-- String getRemoteDownloadNetworkProxyId()
+
+ /**
+ * Get timeout in seconds for download remote index. Default is
+ * more long than artifact download.
+ *
+ * @return int
+ */
+ public int getRemoteDownloadTimeout()
+ {
+ return this.remoteDownloadTimeout;
+ } //-- int getRemoteDownloadTimeout()
+
+ /**
+ * Get remote Index Url : if not starting with http will be
+ * relative to the remote repository url.
+ *
+ * @return String
+ */
+ public String getRemoteIndexUrl()
+ {
+ return this.remoteIndexUrl;
+ } //-- String getRemoteIndexUrl()
+
+ /**
+ * Get timeout in seconds for connections to this repository.
+ *
+ * @return int
+ */
+ public int getTimeout()
+ {
+ return this.timeout;
+ } //-- int getTimeout()
+
+ /**
+ * Get the URL for this repository.
+ *
+ * @return String
+ */
+ public String getUrl()
+ {
+ return this.url;
+ } //-- String getUrl()
+
+ /**
+ * Get the Username for this repository.
+ *
+ * @return String
+ */
+ public String getUsername()
+ {
+ return this.username;
+ } //-- String getUsername()
+
+ /**
+ * Get activate download of remote index if remoteIndexUrl is
+ * set too.
+ *
+ * @return boolean
+ */
+ public boolean isDownloadRemoteIndex()
+ {
+ return this.downloadRemoteIndex;
+ } //-- boolean isDownloadRemoteIndex()
+
+ /**
+ * Get schedule download of remote index when archiva start.
+ *
+ * @return boolean
+ */
+ public boolean isDownloadRemoteIndexOnStartup()
+ {
+ return this.downloadRemoteIndexOnStartup;
+ } //-- boolean isDownloadRemoteIndexOnStartup()
+
+ /**
+ * Set the path to check the repository availability (relative
+ * to the repository URL). Some repositories do not allow
+ * browsing, so a certain artifact must be checked.
+ *
+ * @param checkPath
+ */
+ public void setCheckPath( String checkPath )
+ {
+ this.checkPath = checkPath;
+ } //-- void setCheckPath( String )
+
+ /**
+ * Set activate download of remote index if remoteIndexUrl is
+ * set too.
+ *
+ * @param downloadRemoteIndex
+ */
+ public void setDownloadRemoteIndex( boolean downloadRemoteIndex )
+ {
+ this.downloadRemoteIndex = downloadRemoteIndex;
+ } //-- void setDownloadRemoteIndex( boolean )
+
+ /**
+ * Set schedule download of remote index when archiva start.
+ *
+ * @param downloadRemoteIndexOnStartup
+ */
+ public void setDownloadRemoteIndexOnStartup( boolean downloadRemoteIndexOnStartup )
+ {
+ this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup;
+ } //-- void setDownloadRemoteIndexOnStartup( boolean )
+
+ /**
+ * Set additional http headers to add to url when requesting
+ * remote repositories.
+ *
+ * @param extraHeaders
+ */
+ public void setExtraHeaders( java.util.Map extraHeaders )
+ {
+ this.extraHeaders = extraHeaders;
+ } //-- void setExtraHeaders( java.util.Map )
+
+ /**
+ * Set additionnal request parameters to add to url when
+ * requesting remote repositories.
+ *
+ * @param extraParameters
+ */
+ public void setExtraParameters( java.util.Map extraParameters )
+ {
+ this.extraParameters = extraParameters;
+ } //-- void setExtraParameters( java.util.Map )
+
+ /**
+ * Set the Password for this repository.
+ *
+ * @param password
+ */
+ public void setPassword( String password )
+ {
+ this.password = password;
+ } //-- void setPassword( String )
+
+ /**
+ * Set when to run the refresh task.
+ * Default is every sunday at 8H00.
+ *
+ * @param refreshCronExpression
+ */
+ public void setRefreshCronExpression( String refreshCronExpression )
+ {
+ this.refreshCronExpression = refreshCronExpression;
+ } //-- void setRefreshCronExpression( String )
+
+ /**
+ * Set id of the networkProxy to use when downloading remote
+ * index.
+ *
+ * @param remoteDownloadNetworkProxyId
+ */
+ public void setRemoteDownloadNetworkProxyId( String remoteDownloadNetworkProxyId )
+ {
+ this.remoteDownloadNetworkProxyId = remoteDownloadNetworkProxyId;
+ } //-- void setRemoteDownloadNetworkProxyId( String )
+
+ /**
+ * Set timeout in seconds for download remote index. Default is
+ * more long than artifact download.
+ *
+ * @param remoteDownloadTimeout
+ */
+ public void setRemoteDownloadTimeout( int remoteDownloadTimeout )
+ {
+ this.remoteDownloadTimeout = remoteDownloadTimeout;
+ } //-- void setRemoteDownloadTimeout( int )
+
+ /**
+ * Set remote Index Url : if not starting with http will be
+ * relative to the remote repository url.
+ *
+ * @param remoteIndexUrl
+ */
+ public void setRemoteIndexUrl( String remoteIndexUrl )
+ {
+ this.remoteIndexUrl = remoteIndexUrl;
+ } //-- void setRemoteIndexUrl( String )
+
+ /**
+ * Set timeout in seconds for connections to this repository.
+ *
+ * @param timeout
+ */
+ public void setTimeout( int timeout )
+ {
+ this.timeout = timeout;
+ } //-- void setTimeout( int )
+
+ /**
+ * Set the URL for this repository.
+ *
+ * @param url
+ */
+ public void setUrl( String url )
+ {
+ this.url = url;
+ } //-- void setUrl( String )
+
+ /**
+ * Set the Username for this repository.
+ *
+ * @param username
+ */
+ public void setUsername( String username )
+ {
+ this.username = username;
+ } //-- void setUsername( String )
+
+
+ public String toString()
+ {
+ return "RemoteRepositoryConfiguration id:'" + getId() + "',name:'" + getName() +"'";
+ }
+
+
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class RepositoryCheckPath.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class RepositoryCheckPath
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ *
+ * The URL for which this path should be used
+ * .
+ */
+ private String url;
+
+ /**
+ *
+ * The path to use for checking the repository
+ * connection.
+ *
+ */
+ private String path;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the path to use for checking the repository connection.
+ *
+ * @return String
+ */
+ public String getPath()
+ {
+ return this.path;
+ } //-- String getPath()
+
+ /**
+ * Get the URL for which this path should be used.
+ *
+ * @return String
+ */
+ public String getUrl()
+ {
+ return this.url;
+ } //-- String getUrl()
+
+ /**
+ * Set the path to use for checking the repository connection.
+ *
+ * @param path
+ */
+ public void setPath( String path )
+ {
+ this.path = path;
+ } //-- void setPath( String )
+
+ /**
+ * Set the URL for which this path should be used.
+ *
+ * @param url
+ */
+ public void setUrl( String url )
+ {
+ this.url = url;
+ } //-- void setUrl( String )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Class RepositoryGroupConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class RepositoryGroupConfiguration extends AbstractRepositoryConfiguration
+ implements Serializable, ConfigurationModel
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * The id of the repository group.
+ */
+ private String id;
+
+ /**
+ * The name of the repository group
+ */
+ private String name;
+
+ /**
+ *
+ * The repository type. Currently only MAVEN type
+ * is known.
+ *
+ */
+ private String type = "MAVEN";
+
+
+ /**
+ * The path of the merged index.
+ */
+ private String mergedIndexPath = ".indexer";
+
+ /**
+ * The time to live of the merged index of the repository group.
+ */
+ private int mergedIndexTtl = 30;
+
+ /**
+ *
+ * When to run the index merging for this group.
+ *
+ */
+ private String cronExpression = "";
+
+ /**
+ * Field repositories.
+ */
+ private List<String> repositories;
+
+ /**
+ * The path for local data
+ */
+ private String location;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+
+ /**
+ * Return the local path for group data. If the merged index property is set to a non absolute path,
+ * it is relative to this location.
+ *
+ * @return the path for group data storage
+ */
+ public String getLocation( )
+ {
+ return location;
+ }
+
+ /**
+ * Set the local path for group data
+ * @param location
+ */
+ public void setLocation( String location )
+ {
+ this.location = location;
+ }
+
+ /**
+ * Method addRepository.
+ *
+ * @param string
+ */
+ public void addRepository( String string )
+ {
+ getRepositories().add( string );
+ } //-- void addRepository( String )
+
+ /**
+ * Get when to run the index merging for this group.
+ * No default value.
+ *
+ * @return String
+ */
+ public String getCronExpression()
+ {
+ return this.cronExpression;
+ } //-- String getCronExpression()
+
+ /**
+ * Get the id of the repository group.
+ *
+ * @return String
+ */
+ public String getId()
+ {
+ return this.id;
+ } //-- String getId()
+
+ /**
+ * Get the path of the merged index.
+ *
+ * @return String
+ */
+ public String getMergedIndexPath()
+ {
+ return this.mergedIndexPath;
+ } //-- String getMergedIndexPath()
+
+ /**
+ * Get the time to live of the merged index of the repository
+ * group.
+ *
+ * @return int
+ */
+ public int getMergedIndexTtl()
+ {
+ return this.mergedIndexTtl;
+ } //-- int getMergedIndexTtl()
+
+ /**
+ * Method getRepositories.
+ *
+ * @return List
+ */
+ public List<String> getRepositories()
+ {
+ if ( this.repositories == null )
+ {
+ this.repositories = new ArrayList<String>();
+ }
+
+ return this.repositories;
+ } //-- java.util.List<String> getRepositories()
+
+ /**
+ * Method removeRepository.
+ *
+ * @param string
+ */
+ public void removeRepository( String string )
+ {
+ getRepositories().remove( string );
+ } //-- void removeRepository( String )
+
+ /**
+ * Set when to run the index merging for this group.
+ * No default value.
+ *
+ * @param cronExpression
+ */
+ public void setCronExpression( String cronExpression )
+ {
+ this.cronExpression = cronExpression;
+ } //-- void setCronExpression( String )
+
+ /**
+ * Set the id of the repository group.
+ *
+ * @param id
+ */
+ public void setId( String id )
+ {
+ this.id = id;
+ } //-- void setId( String )
+
+ /**
+ * Set the path of the merged index.
+ *
+ * @param mergedIndexPath
+ */
+ public void setMergedIndexPath( String mergedIndexPath )
+ {
+ this.mergedIndexPath = mergedIndexPath;
+ } //-- void setMergedIndexPath( String )
+
+ /**
+ * Set the time to live of the merged index of the repository
+ * group.
+ *
+ * @param mergedIndexTtl
+ */
+ public void setMergedIndexTtl( int mergedIndexTtl )
+ {
+ this.mergedIndexTtl = mergedIndexTtl;
+ } //-- void setMergedIndexTtl( int )
+
+ /**
+ * Set the list of repository ids under the group.
+ *
+ * @param repositories
+ */
+ public void setRepositories( List<String> repositories )
+ {
+ this.repositories = repositories;
+ } //-- void setRepositories( java.util.List )
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class RepositoryScanningConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class RepositoryScanningConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field fileTypes.
+ */
+ private java.util.List<FileType> fileTypes;
+
+ /**
+ * Field knownContentConsumers.
+ */
+ private java.util.List<String> knownContentConsumers;
+
+ /**
+ * Field invalidContentConsumers.
+ */
+ private java.util.List<String> invalidContentConsumers;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method addFileType.
+ *
+ * @param fileType
+ */
+ public void addFileType( FileType fileType )
+ {
+ getFileTypes().add( fileType );
+ } //-- void addFileType( FileType )
+
+ /**
+ * Method addInvalidContentConsumer.
+ *
+ * @param string
+ */
+ public void addInvalidContentConsumer( String string )
+ {
+ getInvalidContentConsumers().add( string );
+ } //-- void addInvalidContentConsumer( String )
+
+ /**
+ * Method addKnownContentConsumer.
+ *
+ * @param string
+ */
+ public void addKnownContentConsumer( String string )
+ {
+ getKnownContentConsumers().add( string );
+ } //-- void addKnownContentConsumer( String )
+
+ /**
+ * Method getFileTypes.
+ *
+ * @return List
+ */
+ public java.util.List<FileType> getFileTypes()
+ {
+ if ( this.fileTypes == null )
+ {
+ this.fileTypes = new java.util.ArrayList<FileType>();
+ }
+
+ return this.fileTypes;
+ } //-- java.util.List<FileType> getFileTypes()
+
+ /**
+ * Method getInvalidContentConsumers.
+ *
+ * @return List
+ */
+ public java.util.List<String> getInvalidContentConsumers()
+ {
+ if ( this.invalidContentConsumers == null )
+ {
+ this.invalidContentConsumers = new java.util.ArrayList<String>();
+ }
+
+ return this.invalidContentConsumers;
+ } //-- java.util.List<String> getInvalidContentConsumers()
+
+ /**
+ * Method getKnownContentConsumers.
+ *
+ * @return List
+ */
+ public java.util.List<String> getKnownContentConsumers()
+ {
+ if ( this.knownContentConsumers == null )
+ {
+ this.knownContentConsumers = new java.util.ArrayList<String>();
+ }
+
+ return this.knownContentConsumers;
+ } //-- java.util.List<String> getKnownContentConsumers()
+
+ /**
+ * Method removeFileType.
+ *
+ * @param fileType
+ */
+ public void removeFileType( FileType fileType )
+ {
+ getFileTypes().remove( fileType );
+ } //-- void removeFileType( FileType )
+
+ /**
+ * Method removeInvalidContentConsumer.
+ *
+ * @param string
+ */
+ public void removeInvalidContentConsumer( String string )
+ {
+ getInvalidContentConsumers().remove( string );
+ } //-- void removeInvalidContentConsumer( String )
+
+ /**
+ * Method removeKnownContentConsumer.
+ *
+ * @param string
+ */
+ public void removeKnownContentConsumer( String string )
+ {
+ getKnownContentConsumers().remove( string );
+ } //-- void removeKnownContentConsumer( String )
+
+ /**
+ * Set the FileTypes for the repository scanning configuration.
+ *
+ * @param fileTypes
+ */
+ public void setFileTypes( java.util.List<FileType> fileTypes )
+ {
+ this.fileTypes = fileTypes;
+ } //-- void setFileTypes( java.util.List )
+
+ /**
+ * Set the list of active consumer IDs for invalid content.
+ *
+ * @param invalidContentConsumers
+ */
+ public void setInvalidContentConsumers( java.util.List<String> invalidContentConsumers )
+ {
+ this.invalidContentConsumers = invalidContentConsumers;
+ } //-- void setInvalidContentConsumers( java.util.List )
+
+ /**
+ * Set the list of active consumers IDs for known content.
+ *
+ * @param knownContentConsumers
+ */
+ public void setKnownContentConsumers( java.util.List<String> knownContentConsumers )
+ {
+ this.knownContentConsumers = knownContentConsumers;
+ } //-- void setKnownContentConsumers( java.util.List )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Class SyncConnectorConfiguration.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class SyncConnectorConfiguration
+ extends AbstractRepositoryConnectorConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * When to run the sync mechanism. Default is every hour on the
+ * hour.
+ */
+ private String cronExpression = "0 0 * * * ?";
+
+ /**
+ * The type of synchronization to use.
+ */
+ private String method = "rsync";
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get when to run the sync mechanism. Default is every hour on
+ * the hour.
+ *
+ * @return String
+ */
+ public String getCronExpression()
+ {
+ return this.cronExpression;
+ } //-- String getCronExpression()
+
+ /**
+ * Get the type of synchronization to use.
+ *
+ * @return String
+ */
+ public String getMethod()
+ {
+ return this.method;
+ } //-- String getMethod()
+
+ /**
+ * Set when to run the sync mechanism. Default is every hour on
+ * the hour.
+ *
+ * @param cronExpression
+ */
+ public void setCronExpression( String cronExpression )
+ {
+ this.cronExpression = cronExpression;
+ } //-- void setCronExpression( String )
+
+ /**
+ * Set the type of synchronization to use.
+ *
+ * @param method
+ */
+ public void setMethod( String method )
+ {
+ this.method = method;
+ } //-- void setMethod( String )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * The user interface configuration settings.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class UserInterfaceOptions
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * true if find artifacts should be enabled.
+ */
+ private boolean showFindArtifacts = true;
+
+ /**
+ * true if applet behavior for find artifacts should be enabled.
+ */
+ private boolean appletFindEnabled = true;
+
+ /**
+ * Field disableEasterEggs.
+ */
+ private boolean disableEasterEggs = false;
+
+ /**
+ * Field applicationUrl.
+ */
+ private String applicationUrl;
+
+ /**
+ * Field disableRegistration.
+ */
+ private boolean disableRegistration = false;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get the applicationUrl field.
+ *
+ * @return String
+ */
+ public String getApplicationUrl()
+ {
+ return this.applicationUrl;
+ } //-- String getApplicationUrl()
+
+ /**
+ * Get true if applet behavior for find artifacts should be
+ * enabled.
+ *
+ * @return boolean
+ */
+ public boolean isAppletFindEnabled()
+ {
+ return this.appletFindEnabled;
+ } //-- boolean isAppletFindEnabled()
+
+ /**
+ * Get the disableEasterEggs field.
+ *
+ * @return boolean
+ */
+ public boolean isDisableEasterEggs()
+ {
+ return this.disableEasterEggs;
+ } //-- boolean isDisableEasterEggs()
+
+ /**
+ * Get the disableRegistration field.
+ *
+ * @return boolean
+ */
+ public boolean isDisableRegistration()
+ {
+ return this.disableRegistration;
+ } //-- boolean isDisableRegistration()
+
+ /**
+ * Get true if find artifacts should be enabled.
+ *
+ * @return boolean
+ */
+ public boolean isShowFindArtifacts()
+ {
+ return this.showFindArtifacts;
+ } //-- boolean isShowFindArtifacts()
+
+ /**
+ * Set true if applet behavior for find artifacts should be
+ * enabled.
+ *
+ * @param appletFindEnabled
+ */
+ public void setAppletFindEnabled( boolean appletFindEnabled )
+ {
+ this.appletFindEnabled = appletFindEnabled;
+ } //-- void setAppletFindEnabled( boolean )
+
+ /**
+ * Set the applicationUrl field.
+ *
+ * @param applicationUrl
+ */
+ public void setApplicationUrl( String applicationUrl )
+ {
+ this.applicationUrl = applicationUrl;
+ } //-- void setApplicationUrl( String )
+
+ /**
+ * Set the disableEasterEggs field.
+ *
+ * @param disableEasterEggs
+ */
+ public void setDisableEasterEggs( boolean disableEasterEggs )
+ {
+ this.disableEasterEggs = disableEasterEggs;
+ } //-- void setDisableEasterEggs( boolean )
+
+ /**
+ * Set the disableRegistration field.
+ *
+ * @param disableRegistration
+ */
+ public void setDisableRegistration( boolean disableRegistration )
+ {
+ this.disableRegistration = disableRegistration;
+ } //-- void setDisableRegistration( boolean )
+
+ /**
+ * Set true if find artifacts should be enabled.
+ *
+ * @param showFindArtifacts
+ */
+ public void setShowFindArtifacts( boolean showFindArtifacts )
+ {
+ this.showFindArtifacts = showFindArtifacts;
+ } //-- void setShowFindArtifacts( boolean )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
+ * The webapp configuration settings.
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings( "all" )
+public class WebappConfiguration
+ implements java.io.Serializable
+{
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * options for altering the ui presentation.
+ */
+ private UserInterfaceOptions ui;
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Get options for altering the ui presentation.
+ *
+ * @return UserInterfaceOptions
+ */
+ public UserInterfaceOptions getUi()
+ {
+ return this.ui;
+ } //-- UserInterfaceOptions getUi()
+
+ /**
+ * Set options for altering the ui presentation.
+ *
+ * @param ui
+ */
+ public void setUi( UserInterfaceOptions ui )
+ {
+ this.ui = ui;
+ } //-- void setUi( UserInterfaceOptions )
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * FiletypeSelectionPredicate
+ *
+ *
+ */
+public class FiletypeSelectionPredicate
+ implements Predicate
+{
+ private String filetypeId;
+
+ public FiletypeSelectionPredicate( String id )
+ {
+ this.filetypeId = id;
+ }
+
+ @Override
+ public boolean evaluate( Object object )
+ {
+ boolean satisfies = false;
+
+ if ( object instanceof FileType )
+ {
+ FileType filetype = (FileType) object;
+ return ( StringUtils.equals( filetypeId, filetype.getId() ) );
+ }
+
+ return satisfies;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.commons.collections4.Closure;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * FiletypeToMapClosure
+ *
+ *
+ */
+public class FiletypeToMapClosure
+ implements Closure
+{
+ private Map<String, FileType> map = new HashMap<>();
+
+ @Override
+ public void execute( Object input )
+ {
+ if ( input instanceof FileType )
+ {
+ FileType filetype = (FileType) input;
+ map.put( filetype.getId(), filetype );
+ }
+ }
+
+ public Map<String, FileType> getMap()
+ {
+ return map;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+
+import java.util.Comparator;
+
+/**
+ * NetworkProxyComparator
+ *
+ *
+ */
+public class NetworkProxyComparator
+ implements Comparator<NetworkProxyConfiguration>
+{
+ @Override
+ public int compare( NetworkProxyConfiguration o1, NetworkProxyConfiguration o2 )
+ {
+ if ( o1 == null && o2 == null )
+ {
+ return 0;
+ }
+
+ if ( o1 == null && o2 != null )
+ {
+ return 1;
+ }
+
+ if ( o1 != null && o2 == null )
+ {
+ return -1;
+ }
+
+ String id1 = o1.getId();
+ String id2 = o2.getId();
+ return id1.compareToIgnoreCase( id2 );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * NetworkProxySelectionPredicate
+ *
+ *
+ */
+public class NetworkProxySelectionPredicate
+ implements Predicate
+{
+ private String proxyId;
+
+ public NetworkProxySelectionPredicate( String id )
+ {
+ this.proxyId = id;
+ }
+
+ @Override
+ public boolean evaluate( Object object )
+ {
+ boolean satisfies = false;
+
+ if ( object instanceof NetworkProxyConfiguration )
+ {
+ NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object;
+ return ( StringUtils.equals( proxyId, proxy.getId() ) );
+ }
+
+ return satisfies;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+
+import java.util.Comparator;
+
+/**
+ *
+ * Was marked as deprecated before, but is still used.
+ *
+ */
+public class ProxyConnectorConfigurationOrderComparator
+ implements Comparator<ProxyConnectorConfiguration>
+{
+ private static ProxyConnectorConfigurationOrderComparator INSTANCE =
+ new ProxyConnectorConfigurationOrderComparator();
+
+ @Override
+ public int compare( ProxyConnectorConfiguration o1, ProxyConnectorConfiguration o2 )
+ {
+ if ( o1 == null && o2 == null )
+ {
+ return 0;
+ }
+
+ // Ensure null goes to end of list.
+ if ( o1 == null && o2 != null )
+ {
+ return 1;
+ }
+
+ if ( o1 != null && o2 == null )
+ {
+ return -1;
+ }
+
+ // Ensure 0 (unordered) goes to end of list.
+ if ( o1.getOrder() == 0 && o2.getOrder() != 0 )
+ {
+ return 1;
+ }
+
+ if ( o1.getOrder() != 0 && o2.getOrder() == 0 )
+ {
+ return -1;
+ }
+
+ return o1.getOrder() - o2.getOrder();
+ }
+
+ public static ProxyConnectorConfigurationOrderComparator getInstance()
+ {
+ return INSTANCE;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * ProxyConnectorPredicate
+ *
+ *
+ */
+public class ProxyConnectorSelectionPredicate
+ implements Predicate<ProxyConnectorConfiguration>
+{
+ private String sourceId;
+
+ private String targetId;
+
+ public ProxyConnectorSelectionPredicate( String sourceId, String targetId )
+ {
+ this.sourceId = sourceId;
+ this.targetId = targetId;
+ }
+
+ @Override
+ public boolean evaluate( ProxyConnectorConfiguration object )
+ {
+ boolean satisfies = false;
+
+ if ( object != null )
+ {
+ ProxyConnectorConfiguration connector = object;
+ return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils.equals( targetId,
+ connector.getTargetRepoId() ) );
+ }
+
+ return satisfies;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.configuration.model.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+
+import java.util.Comparator;
+
+/**
+ * RepositoryConfigurationComparator
+ *
+ *
+ */
+public class RepositoryConfigurationComparator
+ implements Comparator<AbstractRepositoryConfiguration>
+{
+ @Override
+ public int compare( AbstractRepositoryConfiguration o1, AbstractRepositoryConfiguration o2 )
+ {
+ if ( o1 == null && o2 == null )
+ {
+ return 0;
+ }
+
+ if ( o1 == null )
+ {
+ return -1;
+ }
+
+ if ( o2 == null )
+ {
+ return 1;
+ }
+
+ return o1.getId().compareToIgnoreCase( o2.getId() );
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>archiva-configuration-provider</artifactId>
+ <name>Archiva Base :: Configuration :: Provider</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-model</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-policies</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components.registry</groupId>
+ <artifactId>archiva-components-spring-registry-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components.registry</groupId>
+ <artifactId>archiva-components-spring-registry-commons</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.components</groupId>
+ <artifactId>archiva-components-expression-evaluator</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-configuration2</artifactId>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
+
+
+ <!-- Test scope -->
+
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-test-utils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-jcl</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <basedir>${basedir}</basedir>
+ </systemPropertyVariables>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/main/resources/org/apache/archiva/configuration/default-archiva.xml</exclude>
+ <exclude>src/test/conf/maven-proxy-complete.conf</exclude>
+ <exclude>src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml</exclude>
+ <exclude>nbactions.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
\ No newline at end of file
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.components.registry.Registry;
+import org.apache.archiva.components.registry.RegistryException;
+import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.archiva.configuration.model.Configuration;
+
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Configuration holder for the model read from the registry.
+ */
+public interface ArchivaConfiguration
+{
+
+
+ String USER_CONFIG_PROPERTY = "archiva.user.configFileName";
+ String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE";
+
+ /**
+ * Get the configuration.
+ *
+ * @return the configuration
+ */
+ Configuration getConfiguration();
+
+ /**
+ * Save any updated configuration.
+ *
+ * @param configuration the configuration to save
+ * @throws org.apache.archiva.components.registry.RegistryException
+ * if there is a problem saving the registry data
+ * @throws IndeterminateConfigurationException
+ * if the configuration cannot be saved because it was read from two sources
+ */
+ void save( Configuration configuration )
+ throws RegistryException, IndeterminateConfigurationException;
+
+ /**
+ * Save any updated configuration. This method allows to add a tag to the thrown event.
+ * This allows to verify the origin if the caller is the same as the listener.
+ *
+ * @param configuration the configuration to save
+ * @param eventTag the tag to add to the thrown event
+ * @throws org.apache.archiva.components.registry.RegistryException
+ * if there is a problem saving the registry data
+ * @throws IndeterminateConfigurationException
+ * if the configuration cannot be saved because it was read from two sources
+ */
+ void save( Configuration configuration, String eventTag )
+ throws RegistryException, IndeterminateConfigurationException;
+
+ /**
+ * Determines if the configuration in use was as a result of a defaulted configuration.
+ *
+ * @return true if the configuration was created from the default-archiva.xml as opposed
+ * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
+ * ${appserver.base}/conf/archiva.xml
+ */
+ boolean isDefaulted();
+
+ /**
+ * Add a configuration listener to notify of changes to the configuration.
+ *
+ * @param listener the listener
+ */
+ void addListener( ConfigurationListener listener );
+
+ /**
+ * Remove a configuration listener to stop notifications of changes to the configuration.
+ *
+ * @param listener the listener
+ */
+ void removeListener( ConfigurationListener listener );
+
+ /**
+ * Add a registry listener to notify of events in spring-registry.
+ *
+ * @param listener the listener
+ * TODO: Remove in future.
+ */
+ void addChangeListener( RegistryListener listener );
+
+ void removeChangeListener( RegistryListener listener );
+
+ /**
+ * reload configuration from file included registry
+ *
+ * @since 1.4-M1
+ */
+ void reload();
+
+ public Locale getDefaultLocale();
+
+ public List<Locale.LanguageRange> getLanguagePriorities();
+
+ public Path getAppServerBaseDir();
+
+ /**
+ * Returns the base directory for repositories that have a relative location path set.
+ * @return
+ */
+ public Path getRepositoryBaseDir();
+
+ /**
+ * Returns the base directory for remote repositories
+ * @return
+ */
+ public Path getRemoteRepositoryBaseDir();
+
+ /**
+ * Returns the base directory for repository group files.
+ * @return
+ */
+ public Path getRepositoryGroupBaseDir();
+
+ /**
+ * Returns the data directory where repositories and metadata reside
+ * @return
+ */
+ public Path getDataDirectory();
+
+ /**
+ * Return the used configuration registry
+ * @return
+ */
+ Registry getRegistry( );
+}
+
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * ConfigurationEvent
+ *
+ *
+ */
+public class ConfigurationEvent
+{
+ public static final int SAVED = 1;
+
+ public static final int CHANGED = 2;
+
+ private int type;
+
+ private String tag;
+
+ public ConfigurationEvent( int type )
+ {
+ this.type = type;
+ tag = "";
+ }
+
+ public ConfigurationEvent(int type, String tag) {
+ this.type = type;
+ this.tag = tag;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+
+ public String getTag( )
+ {
+ return tag;
+ }
+
+ public void setTag( String tag )
+ {
+ this.tag = tag;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o ) return true;
+ if ( o == null || getClass( ) != o.getClass( ) ) return false;
+
+ ConfigurationEvent that = (ConfigurationEvent) o;
+
+ if ( type != that.type ) return false;
+ return tag.equals( that.tag );
+ }
+
+ @Override
+ public int hashCode( )
+ {
+ int result = type;
+ result = 31 * result + tag.hashCode( );
+ return result;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * ConfigurationListener
+ *
+ *
+ */
+public interface ConfigurationListener
+{
+ /**
+ * Generic event point to notify components that something has happend in the configuration.
+ */
+ void configurationEvent( ConfigurationEvent event );
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Unrecoverable exception in the configuration mechanism that is the result of a programming error.
+ */
+public class ConfigurationRuntimeException
+ extends RuntimeException
+{
+ public ConfigurationRuntimeException( String msg, Throwable cause )
+ {
+ super( msg, cause );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.components.evaluator.DefaultExpressionEvaluator;
+import org.apache.archiva.components.evaluator.EvaluatorException;
+import org.apache.archiva.components.evaluator.ExpressionEvaluator;
+import org.apache.archiva.components.evaluator.sources.SystemPropertyExpressionSource;
+import org.apache.archiva.components.registry.Registry;
+import org.apache.archiva.components.registry.RegistryException;
+import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryCheckPath;
+import org.apache.archiva.configuration.model.functors.ProxyConnectorConfigurationOrderComparator;
+import org.apache.archiva.configuration.provider.io.registry.ConfigurationRegistryReader;
+import org.apache.archiva.configuration.provider.io.registry.ConfigurationRegistryWriter;
+import org.apache.archiva.policies.AbstractUpdatePolicy;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.ListUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * <p>
+ * Implementation of configuration holder that retrieves it from the registry.
+ * </p>
+ * <p>
+ * The registry layers and merges the 2 configuration files: user, and application server.
+ * </p>
+ * <p>
+ * Instead of relying on the model defaults, if the registry is empty a default configuration file is loaded and
+ * applied from a resource. The defaults are not loaded into the registry as the lists (eg repositories) could no longer
+ * be removed if that was the case.
+ * </p>
+ * <p>
+ * When saving the configuration, it is saved to the location it was read from. If it was read from the defaults, it
+ * will be saved to the user location.
+ * However, if the configuration contains information from both sources, an exception is raised as this is currently
+ * unsupported. The reason for this is that it is not possible to identify where to re-save elements, and can result
+ * in list configurations (eg repositories) becoming inconsistent.
+ * </p>
+ * <p>
+ * If the configuration is outdated, it will be upgraded when it is loaded. This is done by checking the version flag
+ * before reading it from the registry.
+ * <p>
+ * FIXME: The synchronization must be improved, the current impl may lead to inconsistent data or multiple getConfiguration() calls (martin_s@apache.org)
+ * </p>
+ */
+@Service("archivaConfiguration#default")
+public class DefaultArchivaConfiguration
+ implements ArchivaConfiguration, RegistryListener {
+ private final Logger log = LoggerFactory.getLogger(DefaultArchivaConfiguration.class);
+
+ private static String FILE_ENCODING = "UTF-8";
+
+ /**
+ * Plexus registry to read the configuration from.
+ */
+ @Inject
+ @Named(value = "commons-configuration")
+ private Registry registry;
+
+ /**
+ * The configuration that has been converted.
+ */
+ private Configuration configuration;
+
+ /**
+ * see #initialize
+ * default-value="${user.home}/.m2/archiva.xml"
+ */
+ private String userConfigFilename = "${user.home}/.m2/archiva.xml";
+
+ /**
+ * see #initialize
+ * default-value="${appserver.base}/conf/archiva.xml"
+ */
+ private String altConfigFilename = "${appserver.base}/conf/archiva.xml";
+
+ /**
+ * Configuration Listeners we've registered.
+ */
+ private Set<ConfigurationListener> listeners = new HashSet<>();
+
+ /**
+ * Registry Listeners we've registered.
+ */
+ private Set<RegistryListener> registryListeners = new HashSet<>();
+
+ /**
+ * Boolean to help determine if the configuration exists as a result of pulling in
+ * the default-archiva.xml
+ */
+ private boolean isConfigurationDefaulted = false;
+
+ private static final String KEY = "org.apache.archiva";
+
+ // Section used for default only configuration
+ private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default";
+
+ private Locale defaultLocale = Locale.getDefault();
+
+ private List<Locale.LanguageRange> languagePriorities = new ArrayList<>();
+
+ private volatile Path dataDirectory;
+ private volatile Path repositoryBaseDirectory;
+ private volatile Path remoteRepositoryBaseDirectory;
+ private volatile Path repositoryGroupBaseDirectory;
+
+ @PostConstruct
+ private void init() {
+ languagePriorities = Locale.LanguageRange.parse("en,fr,de");
+ }
+
+
+ @Override
+ public Configuration getConfiguration() {
+ return loadConfiguration();
+ }
+
+ private synchronized Configuration loadConfiguration() {
+ if (configuration == null) {
+ configuration = load();
+ configuration = unescapeExpressions(configuration);
+ if (isConfigurationDefaulted) {
+ configuration = checkRepositoryLocations(configuration);
+ }
+ }
+
+ return configuration;
+ }
+
+ private boolean hasConfigVersionChanged(Configuration current, Registry defaultOnlyConfiguration) {
+ return current == null || current.getVersion() == null ||
+ !current.getVersion().trim().equals(defaultOnlyConfiguration.getString("version", "").trim());
+ }
+
+ @SuppressWarnings("unchecked")
+ private Configuration load() {
+ // TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties)
+ Registry subset = registry.getSubset(KEY);
+ if (subset.getString("version") == null) {
+ if (subset.getSubset("repositoryScanning").isEmpty()) {
+ // only for empty
+ subset = readDefaultConfiguration();
+ } else {
+ throw new RuntimeException("No version tag found in configuration. Archiva configuration version 1.x is not longer supported.");
+ }
+ }
+
+ Configuration config = new ConfigurationRegistryReader().read(subset);
+
+ // Resolving data and repositories directories
+ // If the config entries are absolute, the path is used as it is
+ // if the config entries are empty, they are resolved:
+ // dataDirectory = ${appserver.base}/data
+ // repositoryDirectory = ${dataDirectory}/repositories
+ // If the entries are relative they are resolved
+ // relative to the appserver.base, for dataDirectory
+ // relative to dataDirectory for repositoryBase
+ String dataDir = config.getArchivaRuntimeConfiguration().getDataDirectory();
+ if (StringUtils.isEmpty(dataDir)) {
+ dataDirectory = getAppServerBaseDir().resolve("data");
+ } else {
+ Path tmpDataDir = Paths.get(dataDir);
+ if (tmpDataDir.isAbsolute()) {
+ dataDirectory = tmpDataDir;
+ } else {
+ dataDirectory = getAppServerBaseDir().resolve(tmpDataDir);
+ }
+ }
+ config.getArchivaRuntimeConfiguration().setDataDirectory(dataDirectory.normalize().toString());
+ String repoBaseDir = config.getArchivaRuntimeConfiguration().getRepositoryBaseDirectory();
+ if (StringUtils.isEmpty(repoBaseDir)) {
+ repositoryBaseDirectory = dataDirectory.resolve("repositories");
+
+ } else {
+ Path tmpRepoBaseDir = Paths.get(repoBaseDir);
+ if (tmpRepoBaseDir.isAbsolute()) {
+ repositoryBaseDirectory = tmpRepoBaseDir;
+ } else {
+ dataDirectory.resolve(tmpRepoBaseDir);
+ }
+ }
+
+ String remoteRepoBaseDir = config.getArchivaRuntimeConfiguration().getRemoteRepositoryBaseDirectory();
+ if (StringUtils.isEmpty(remoteRepoBaseDir)) {
+ remoteRepositoryBaseDirectory = dataDirectory.resolve("remotes");
+ } else {
+ Path tmpRemoteRepoDir = Paths.get(remoteRepoBaseDir);
+ if (tmpRemoteRepoDir.isAbsolute()) {
+ remoteRepositoryBaseDirectory = tmpRemoteRepoDir;
+ } else {
+ dataDirectory.resolve(tmpRemoteRepoDir);
+ }
+ }
+
+ String repositoryGroupBaseDir = config.getArchivaRuntimeConfiguration().getRepositoryGroupBaseDirectory();
+ if (StringUtils.isEmpty(repositoryGroupBaseDir)) {
+ repositoryGroupBaseDirectory = dataDirectory.resolve("groups");
+ } else {
+ Path tmpGroupDir = Paths.get(repositoryGroupBaseDir);
+ if (tmpGroupDir.isAbsolute()) {
+ repositoryGroupBaseDirectory = tmpGroupDir;
+ } else {
+ dataDirectory.resolve(tmpGroupDir);
+ }
+ }
+
+
+ config.getRepositoryGroups();
+ config.getRepositoryGroupsAsMap();
+ if (!CollectionUtils.isEmpty(config.getRemoteRepositories())) {
+ List<RemoteRepositoryConfiguration> remoteRepos = config.getRemoteRepositories();
+ for (RemoteRepositoryConfiguration repo : remoteRepos) {
+ // [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
+ if (StringUtils.isBlank(repo.getUsername())) {
+ repo.setUsername(null);
+ }
+
+ if (StringUtils.isBlank(repo.getPassword())) {
+ repo.setPassword(null);
+ }
+ }
+ }
+
+ if (!config.getProxyConnectors().isEmpty()) {
+ // Fix Proxy Connector Settings.
+
+ // Create a copy of the list to read from (to prevent concurrent modification exceptions)
+ List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<>(config.getProxyConnectors());
+ // Remove the old connector list.
+ config.getProxyConnectors().clear();
+
+ for (ProxyConnectorConfiguration connector : proxyConnectorList) {
+ // Fix policies
+ boolean connectorValid = true;
+
+ Map<String, String> policies = new HashMap<>();
+ // Make copy of policies
+ policies.putAll(connector.getPolicies());
+ // Clear out policies
+ connector.getPolicies().clear();
+
+ // Work thru policies. cleaning them up.
+ for (Entry<String, String> entry : policies.entrySet()) {
+ String policyId = entry.getKey();
+ String setting = entry.getValue();
+
+ // Upgrade old policy settings.
+ if ("releases".equals(policyId) || "snapshots".equals(policyId)) {
+ if ("ignored".equals(setting)) {
+ setting = AbstractUpdatePolicy.ALWAYS.getId();
+ } else if ("disabled".equals(setting)) {
+ setting = AbstractUpdatePolicy.NEVER.getId();
+ }
+ } else if ("cache-failures".equals(policyId)) {
+ if ("ignored".equals(setting)) {
+ setting = CachedFailuresPolicy.NO.getId();
+ } else if ("cached".equals(setting)) {
+ setting = CachedFailuresPolicy.YES.getId();
+ }
+ } else if ("checksum".equals(policyId)) {
+ if ("ignored".equals(setting)) {
+ setting = ChecksumPolicy.IGNORE.getId();
+ }
+ }
+
+ // Validate existance of policy key.
+ connector.addPolicy(policyId, setting);
+ }
+
+ if (connectorValid) {
+ config.addProxyConnector(connector);
+ }
+ }
+
+ // Normalize the order fields in the proxy connectors.
+ Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
+ config.getProxyConnectorAsMap();
+
+ for (List<ProxyConnectorConfiguration> connectors : proxyConnectorMap.values()) {
+ // Sort connectors by order field.
+ Collections.sort(connectors, ProxyConnectorConfigurationOrderComparator.getInstance());
+
+ // Normalize the order field values.
+ int order = 1;
+ for (ProxyConnectorConfiguration connector : connectors) {
+ connector.setOrder(order++);
+ }
+ }
+ }
+
+ this.defaultLocale = Locale.forLanguageTag(config.getArchivaRuntimeConfiguration().getDefaultLanguage());
+ this.languagePriorities = Locale.LanguageRange.parse(config.getArchivaRuntimeConfiguration().getLanguageRange());
+ return config;
+ }
+
+ /*
+ * Updates the checkpath list for repositories.
+ *
+ * We are replacing existing ones and adding new ones. This allows to update the list with new releases.
+ *
+ * We are also updating existing remote repositories, if they exist already.
+ *
+ * This update method should only be called, if the config version changes to avoid overwriting
+ * user repository settings all the time.
+ */
+ private void updateCheckPathDefaults(Configuration config, Registry defaultConfiguration) {
+ List<RepositoryCheckPath> existingCheckPathList = config.getArchivaDefaultConfiguration().getDefaultCheckPaths();
+ HashMap<String, RepositoryCheckPath> existingCheckPaths = new HashMap<>();
+ HashMap<String, RepositoryCheckPath> newCheckPaths = new HashMap<>();
+ for (RepositoryCheckPath path : config.getArchivaDefaultConfiguration().getDefaultCheckPaths()) {
+ existingCheckPaths.put(path.getUrl(), path);
+ }
+ List defaultCheckPathsSubsets = defaultConfiguration.getSubsetList("archivaDefaultConfiguration.defaultCheckPaths.defaultCheckPath");
+ for (Iterator i = defaultCheckPathsSubsets.iterator(); i.hasNext(); ) {
+ RepositoryCheckPath v = readRepositoryCheckPath((Registry) i.next());
+ if (existingCheckPaths.containsKey(v.getUrl())) {
+ existingCheckPathList.remove(existingCheckPaths.get(v.getUrl()));
+ }
+ existingCheckPathList.add(v);
+ newCheckPaths.put(v.getUrl(), v);
+ }
+ // Remote repositories update
+ for (RemoteRepositoryConfiguration remoteRepositoryConfiguration : config.getRemoteRepositories()) {
+ String url = remoteRepositoryConfiguration.getUrl().toLowerCase();
+ if (newCheckPaths.containsKey(url)) {
+ String currentPath = remoteRepositoryConfiguration.getCheckPath();
+ String newPath = newCheckPaths.get(url).getPath();
+ log.info("Updating connection check path for repository {}, from '{}' to '{}'.", remoteRepositoryConfiguration.getId(),
+ currentPath, newPath);
+ remoteRepositoryConfiguration.setCheckPath(newPath);
+ }
+ }
+ }
+
+ private RepositoryCheckPath readRepositoryCheckPath(Registry registry) {
+ RepositoryCheckPath value = new RepositoryCheckPath();
+
+ String url = registry.getString("url", value.getUrl());
+
+ value.setUrl(url);
+ String path = registry.getString("path", value.getPath());
+ value.setPath(path);
+ return value;
+ }
+
+
+ private Registry readDefaultConfiguration() {
+ // if it contains some old configuration, remove it (Archiva 0.9)
+ registry.removeSubset(KEY);
+
+ try {
+ registry.addConfigurationFromResource("org/apache/archiva/configuration/default-archiva.xml", KEY);
+ this.isConfigurationDefaulted = true;
+ } catch (RegistryException e) {
+ throw new ConfigurationRuntimeException(
+ "Fatal error: Unable to find the built-in default configuration and load it into the registry", e);
+ }
+ return registry.getSubset(KEY);
+ }
+
+ /*
+ * Reads the default only configuration into a special prefix. This allows to check for changes
+ * of the default configuration.
+ */
+ private Registry readDefaultOnlyConfiguration() {
+ registry.removeSubset(KEY_DEFAULT_ONLY);
+ try {
+ registry.addConfigurationFromResource("org/apache/archiva/configuration/default-archiva.xml", KEY_DEFAULT_ONLY);
+ } catch (RegistryException e) {
+ throw new ConfigurationRuntimeException(
+ "Fatal error: Unable to find the built-in default configuration and load it into the registry", e);
+ }
+ return registry.getSubset(KEY_DEFAULT_ONLY);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public synchronized void save(Configuration configuration) throws IndeterminateConfigurationException, RegistryException
+ {
+ save( configuration, "" );
+ }
+
+ /**
+ * Saves the configuration and adds the given tag to the event.
+ * @param configuration the configuration to save
+ * @param eventTag the tag to add to the configuration saved event
+ * @throws IndeterminateConfigurationException if the
+ * @throws RegistryException
+ */
+ @Override
+ public synchronized void save(Configuration configuration, String eventTag)
+ throws IndeterminateConfigurationException, RegistryException {
+ Registry section = registry.getSection(KEY + ".user");
+ Registry baseSection = registry.getSection(KEY + ".base");
+ if (section == null) {
+ section = baseSection;
+ if (section == null) {
+ section = createDefaultConfigurationFile(eventTag);
+ }
+ } else if (baseSection != null) {
+ Collection<String> keys = baseSection.getKeys();
+ boolean foundList = false;
+ for (Iterator<String> i = keys.iterator(); i.hasNext() && !foundList; ) {
+ String key = i.next();
+
+ // a little aggressive with the repositoryScanning and databaseScanning - should be no need to split
+ // that configuration
+ if (key.startsWith("repositories") //
+ || key.startsWith("proxyConnectors") //
+ || key.startsWith("networkProxies") //
+ || key.startsWith("repositoryScanning") //
+ || key.startsWith("remoteRepositories") //
+ || key.startsWith("managedRepositories") //
+ || key.startsWith("repositoryGroups")) //
+ {
+ foundList = true;
+ }
+ }
+
+ if (foundList) {
+ this.configuration = null;
+
+ throw new IndeterminateConfigurationException(
+ "Configuration can not be saved when it is loaded from two sources");
+ }
+ }
+
+ // escape all cron expressions to handle ','
+ escapeCronExpressions(configuration);
+
+ // [MRM-661] Due to a bug in the modello registry writer, we need to take these out by hand. They'll be put back by the writer.
+ if (section != null) {
+ if (configuration.getManagedRepositories().isEmpty()) {
+ section.removeSubset("managedRepositories");
+ }
+ if (configuration.getRemoteRepositories().isEmpty()) {
+ section.removeSubset("remoteRepositories");
+
+ }
+ if (configuration.getProxyConnectors().isEmpty()) {
+ section.removeSubset("proxyConnectors");
+ }
+ if (configuration.getNetworkProxies().isEmpty()) {
+ section.removeSubset("networkProxies");
+ }
+ if (configuration.getLegacyArtifactPaths().isEmpty()) {
+ section.removeSubset("legacyArtifactPaths");
+ }
+ if (configuration.getRepositoryGroups().isEmpty()) {
+ section.removeSubset("repositoryGroups");
+ }
+ if (configuration.getRepositoryScanning() != null) {
+ if (configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty()) {
+ section.removeSubset("repositoryScanning.knownContentConsumers");
+ }
+ if (configuration.getRepositoryScanning().getInvalidContentConsumers().isEmpty()) {
+ section.removeSubset("repositoryScanning.invalidContentConsumers");
+ }
+ }
+ if (configuration.getArchivaRuntimeConfiguration() != null) {
+ section.removeSubset("archivaRuntimeConfiguration.defaultCheckPaths");
+ }
+
+ new ConfigurationRegistryWriter().write(configuration, section);
+ section.save();
+ }
+
+
+ this.configuration = unescapeExpressions(configuration);
+ isConfigurationDefaulted = false;
+
+ triggerEvent(ConfigurationEvent.SAVED, eventTag);
+ }
+
+ private void escapeCronExpressions(Configuration configuration) {
+ for ( ManagedRepositoryConfiguration c : configuration.getManagedRepositories()) {
+ c.setRefreshCronExpression(escapeCronExpression(c.getRefreshCronExpression()));
+ }
+ }
+
+ private Registry createDefaultConfigurationFile(String eventTag)
+ throws RegistryException {
+ // TODO: may not be needed under commons-configuration 1.4 - check
+
+ String contents = "<configuration />";
+
+ String fileLocation = userConfigFilename;
+
+ if (!writeFile("user configuration", userConfigFilename, contents)) {
+ fileLocation = altConfigFilename;
+ if (!writeFile("alternative configuration", altConfigFilename, contents, true)) {
+ throw new RegistryException(
+ "Unable to create configuration file in either user [" + userConfigFilename + "] or alternative ["
+ + altConfigFilename
+ + "] locations on disk, usually happens when not allowed to write to those locations.");
+ }
+ }
+
+ // olamy hackish I know :-)
+ contents = "<configuration><xml fileName=\"" + fileLocation
+ + "\" config-forceCreate=\"true\" config-name=\"org.apache.archiva.user\"/>" + "</configuration>";
+
+ ((CommonsConfigurationRegistry) registry).setInitialConfiguration(contents);
+
+ registry.initialize();
+
+ for (RegistryListener regListener : registryListeners) {
+ addRegistryChangeListener(regListener);
+ }
+
+ triggerEvent(ConfigurationEvent.SAVED, eventTag==null?"default-file":eventTag);
+
+ Registry section = registry.getSection(KEY + ".user");
+ if (section == null) {
+ return new CommonsConfigurationRegistry( );
+ } else {
+ return section;
+ }
+ }
+
+ private boolean writeFile(String filetype, String path, String contents) {
+ return writeFile( filetype, path, contents, false );
+ }
+
+ /**
+ * Attempts to write the contents to a file, if an IOException occurs, return false.
+ * <p/>
+ * The file will be created if the directory to the file exists, otherwise this will return false.
+ *
+ * @param filetype the filetype (freeform text) to use in logging messages when failure to write.
+ * @param path the path to write to.
+ * @param contents the contents to write.
+ * @return true if write successful.
+ */
+ private boolean writeFile(String filetype, String path, String contents, boolean createDirs) {
+ try {
+ Path file = Paths.get(path);
+ // Check parent directory (if it is declared)
+ final Path parent = file.getParent();
+ if (parent != null) {
+ // Check that directory exists
+ if (!Files.exists( parent ) && createDirs) {
+ Files.createDirectories( parent );
+ }
+ if (!Files.isDirectory(parent)) {
+ // Directory to file must exist for file to be created
+ return false;
+ }
+ }
+ FileUtils.writeStringToFile(file.toFile(), contents, FILE_ENCODING);
+ return true;
+ } catch (IOException e) {
+ log.error("Unable to create {} file: {}", filetype, e.getMessage(), e);
+ return false;
+ } catch (InvalidPathException ipe) {
+ log.error("Unable to read {} file: {}", path, ipe.getMessage(), ipe);
+ return false;
+ }
+ }
+
+ private void triggerEvent(int type, String eventTag) {
+ ConfigurationEvent evt = new ConfigurationEvent(type, eventTag);
+ for (ConfigurationListener listener : listeners) {
+ listener.configurationEvent(evt);
+ }
+ }
+
+ @Override
+ public void addListener(ConfigurationListener listener) {
+ if (listener == null) {
+ return;
+ }
+
+ listeners.add(listener);
+ }
+
+ @Override
+ public void removeListener(ConfigurationListener listener) {
+ if (listener == null) {
+ return;
+ }
+
+ listeners.remove(listener);
+ }
+
+
+ @Override
+ public void addChangeListener(RegistryListener listener) {
+ addRegistryChangeListener(listener);
+
+ // keep track for later
+ registryListeners.add(listener);
+ }
+
+ private void addRegistryChangeListener(RegistryListener listener) {
+ Registry section = registry.getSection(KEY + ".user");
+ if (section != null) {
+ section.addChangeListener(listener);
+ }
+ section = registry.getSection(KEY + ".base");
+ if (section != null) {
+ section.addChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeChangeListener(RegistryListener listener) {
+ boolean removed = registryListeners.remove(listener);
+ log.debug("RegistryListener: '{}' removed {}", listener, removed);
+
+ Registry section = registry.getSection(KEY + ".user");
+ if (section != null) {
+ section.removeChangeListener(listener);
+ }
+ section = registry.getSection(KEY + ".base");
+ if (section != null) {
+ section.removeChangeListener(listener);
+ }
+
+ }
+
+ @PostConstruct
+ public void initialize() {
+
+ // Resolve expressions in the userConfigFilename and altConfigFilename
+ try {
+ ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
+ expressionEvaluator.addExpressionSource(new SystemPropertyExpressionSource());
+ String userConfigFileNameSysProps = System.getProperty(USER_CONFIG_PROPERTY);
+ if (StringUtils.isNotBlank(userConfigFileNameSysProps)) {
+ userConfigFilename = userConfigFileNameSysProps;
+ } else {
+ String userConfigFileNameEnv = System.getenv(USER_CONFIG_ENVVAR);
+ if (StringUtils.isNotBlank(userConfigFileNameEnv)) {
+ userConfigFilename = userConfigFileNameEnv;
+ } else {
+ userConfigFilename = expressionEvaluator.expand(userConfigFilename);
+ }
+ }
+ altConfigFilename = expressionEvaluator.expand(altConfigFilename);
+ loadConfiguration();
+ handleUpgradeConfiguration();
+ } catch (IndeterminateConfigurationException | RegistryException e) {
+ throw new RuntimeException("failed during upgrade from previous version" + e.getMessage(), e);
+ } catch (EvaluatorException e) {
+ throw new RuntimeException(
+ "Unable to evaluate expressions found in " + "userConfigFilename or altConfigFilename.", e);
+ }
+ registry.addChangeListener(this);
+ }
+
+ /**
+ * Handle upgrade to newer version
+ */
+ private void handleUpgradeConfiguration()
+ throws RegistryException, IndeterminateConfigurationException {
+
+ List<String> dbConsumers = Arrays.asList("update-db-artifact", "update-db-repository-metadata");
+
+ // remove database consumers if here
+ List<String> intersec =
+ ListUtils.intersection(dbConsumers, configuration.getRepositoryScanning().getKnownContentConsumers());
+
+ if (!intersec.isEmpty()) {
+
+ List<String> knowContentConsumers =
+ new ArrayList<>(configuration.getRepositoryScanning().getKnownContentConsumers().size());
+ for (String knowContentConsumer : configuration.getRepositoryScanning().getKnownContentConsumers()) {
+ if (!dbConsumers.contains(knowContentConsumer)) {
+ knowContentConsumers.add(knowContentConsumer);
+ }
+ }
+
+ configuration.getRepositoryScanning().setKnownContentConsumers(knowContentConsumers);
+ }
+
+ // ensure create-archiva-metadata is here
+ if (!configuration.getRepositoryScanning().getKnownContentConsumers().contains("create-archiva-metadata")) {
+ List<String> knowContentConsumers =
+ new ArrayList<>(configuration.getRepositoryScanning().getKnownContentConsumers());
+ knowContentConsumers.add("create-archiva-metadata");
+ configuration.getRepositoryScanning().setKnownContentConsumers(knowContentConsumers);
+ }
+
+ // ensure duplicate-artifacts is here
+ if (!configuration.getRepositoryScanning().getKnownContentConsumers().contains("duplicate-artifacts")) {
+ List<String> knowContentConsumers =
+ new ArrayList<>(configuration.getRepositoryScanning().getKnownContentConsumers());
+ knowContentConsumers.add("duplicate-artifacts");
+ configuration.getRepositoryScanning().setKnownContentConsumers(knowContentConsumers);
+ }
+
+ Registry defaultOnlyConfiguration = readDefaultOnlyConfiguration();
+ // Currently we check only for configuration version change, not certain version numbers.
+ if (hasConfigVersionChanged(configuration, defaultOnlyConfiguration)) {
+ updateCheckPathDefaults(configuration, defaultOnlyConfiguration);
+ String newVersion = defaultOnlyConfiguration.getString("version");
+ if (newVersion == null) {
+ throw new IndeterminateConfigurationException("The default configuration has no version information!");
+ }
+ configuration.setVersion(newVersion);
+ try {
+ save(configuration);
+ } catch (IndeterminateConfigurationException e) {
+ log.error("Error occured during configuration update to new version: {}", e.getMessage());
+ } catch (RegistryException e) {
+ log.error("Error occured during configuration update to new version: {}", e.getMessage());
+ }
+ }
+ }
+
+ @Override
+ public void reload() {
+ this.configuration = null;
+ try {
+ this.registry.initialize();
+ } catch (RegistryException e) {
+ throw new ConfigurationRuntimeException(e.getMessage(), e);
+ }
+ this.initialize();
+ }
+
+ @Override
+ public Locale getDefaultLocale() {
+ return defaultLocale;
+ }
+
+ @Override
+ public List<Locale.LanguageRange> getLanguagePriorities() {
+ return languagePriorities;
+ }
+
+ @Override
+ public Path getAppServerBaseDir() {
+ String basePath = registry.getString("appserver.base");
+ if (!StringUtils.isEmpty(basePath)) {
+ return Paths.get(basePath);
+ } else {
+ return Paths.get("");
+ }
+ }
+
+ @Override
+ public Path getRepositoryBaseDir() {
+ if (repositoryBaseDirectory == null) {
+ getConfiguration();
+ }
+ return repositoryBaseDirectory;
+
+ }
+
+ @Override
+ public Path getRemoteRepositoryBaseDir() {
+ if (remoteRepositoryBaseDirectory == null) {
+ getConfiguration();
+ }
+ return remoteRepositoryBaseDirectory;
+ }
+
+ @Override
+ public Path getRepositoryGroupBaseDir() {
+ if (repositoryGroupBaseDirectory == null) {
+ getConfiguration();
+ }
+ return repositoryGroupBaseDirectory;
+ }
+
+ @Override
+ public Path getDataDirectory() {
+ if (dataDirectory == null) {
+ getConfiguration();
+ }
+ return dataDirectory;
+ }
+
+ @Override
+ public void beforeConfigurationChange(Registry registry, String propertyName, Object propertyValue) {
+ // nothing to do here
+ }
+
+ @Override
+ public synchronized void afterConfigurationChange(Registry registry, String propertyName, Object propertyValue) {
+ // configuration = null;
+ // this.dataDirectory = null;
+ // this.repositoryBaseDirectory = null;
+ }
+
+ private String removeExpressions(String directory) {
+ String value = StringUtils.replace(directory, "${appserver.base}",
+ registry.getString("appserver.base", "${appserver.base}"));
+ value = StringUtils.replace(value, "${appserver.home}",
+ registry.getString("appserver.home", "${appserver.home}"));
+ return value;
+ }
+
+ private String unescapeCronExpression(String cronExpression) {
+ return StringUtils.replace(cronExpression, "\\,", ",");
+ }
+
+ private String escapeCronExpression(String cronExpression) {
+ return StringUtils.replace(cronExpression, ",", "\\,");
+ }
+
+ private Configuration unescapeExpressions(Configuration config) {
+ // TODO: for commons-configuration 1.3 only
+ for (ManagedRepositoryConfiguration c : config.getManagedRepositories()) {
+ c.setLocation(removeExpressions(c.getLocation()));
+ c.setRefreshCronExpression(unescapeCronExpression(c.getRefreshCronExpression()));
+ }
+
+ return config;
+ }
+
+ private Configuration checkRepositoryLocations(Configuration config) {
+ // additional check for [MRM-789], ensure that the location of the default repositories
+ // are not installed in the server installation
+ for (ManagedRepositoryConfiguration repo : (List<ManagedRepositoryConfiguration>) config.getManagedRepositories()) {
+ String repoPath = repo.getLocation();
+ Path repoLocation = Paths.get(repoPath);
+
+ if (Files.exists(repoLocation) && Files.isDirectory(repoLocation) && !repoPath.endsWith(
+ "/repositories/" + repo.getId())) {
+ repo.setLocation(repoPath + "/data/repositories/" + repo.getId());
+ }
+ }
+
+ return config;
+ }
+
+ public String getUserConfigFilename() {
+ return userConfigFilename;
+ }
+
+ public String getAltConfigFilename() {
+ return altConfigFilename;
+ }
+
+ @Override
+ public boolean isDefaulted() {
+ return this.isConfigurationDefaulted;
+ }
+
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+
+ public void setUserConfigFilename(String userConfigFilename) {
+ this.userConfigFilename = userConfigFilename;
+ }
+
+ public void setAltConfigFilename(String altConfigFilename) {
+ this.altConfigFilename = altConfigFilename;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.FileTypeUtils;
+import org.apache.archiva.components.registry.Registry;
+import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.model.functors.FiletypeSelectionPredicate;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.IterableUtils;
+import org.apache.commons.collections4.Predicate;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.nio.file.FileSystems;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * FileTypes
+ */
+@Service("fileTypes")
+public class FileTypes
+ implements RegistryListener
+{
+ public static final String ARTIFACTS = "artifacts";
+
+ public static final String AUTO_REMOVE = "auto-remove";
+
+ public static final String INDEXABLE_CONTENT = "indexable-content";
+
+ public static final String IGNORED = "ignored";
+
+ @Inject
+ @Named(value = "archivaConfiguration#default")
+ private ArchivaConfiguration archivaConfiguration;
+
+
+ public FileTypes() {
+
+ }
+
+ /**
+ * Map of default values for the file types.
+ */
+ private Map<String, List<String>> defaultTypeMap = new HashMap<>();
+
+ private List<String> artifactPatterns;
+
+ /**
+ * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
+ * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
+ * artifacts and exclude later during scanning.
+ *
+ * @deprecated
+ */
+ public static final List<String> DEFAULT_EXCLUSIONS = FileTypeUtils.DEFAULT_EXCLUSIONS;
+
+ public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+ {
+ this.archivaConfiguration = archivaConfiguration;
+ }
+
+ /**
+ * Get the list of patterns for a specified filetype.
+ * You will always get a list. In this order.
+ * <ul>
+ * <li>The Configured List</li>
+ * <li>The Default List</li>
+ * <li>A single item list of <code>"**/*"</code></li>
+ * </ul>
+ *
+ * @param id the id to lookup.
+ * @return the list of patterns.
+ */
+ public List<String> getFileTypePatterns( String id )
+ {
+ Configuration config = archivaConfiguration.getConfiguration();
+ Predicate selectedFiletype = new FiletypeSelectionPredicate( id );
+ RepositoryScanningConfiguration repositoryScanningConfiguration = config.getRepositoryScanning();
+ if ( repositoryScanningConfiguration != null )
+ {
+ FileType filetype =
+ IterableUtils.find( config.getRepositoryScanning().getFileTypes(), selectedFiletype );
+
+ if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) )
+ {
+ return filetype.getPatterns();
+ }
+ }
+ List<String> defaultPatterns = defaultTypeMap.get( id );
+
+ if ( CollectionUtils.isEmpty( defaultPatterns ) )
+ {
+ return Collections.singletonList( "**/*" );
+ }
+
+ return defaultPatterns;
+ }
+
+ public synchronized boolean matchesArtifactPattern( String relativePath )
+ {
+ // Correct the slash pattern.
+ relativePath = relativePath.replace( '\\', '/' );
+
+ if ( artifactPatterns == null )
+ {
+ artifactPatterns = getFileTypePatterns( ARTIFACTS );
+ }
+
+ for ( String pattern : artifactPatterns )
+ {
+ if ( FileSystems.getDefault().getPathMatcher( "glob:" + pattern).matches( Paths.get( relativePath ) ) )
+ {
+ // Found match
+ return true;
+ }
+ }
+
+ // No match.
+ return false;
+ }
+
+ public boolean matchesDefaultExclusions( String relativePath )
+ {
+ // Correct the slash pattern.
+ relativePath = relativePath.replace( '\\', '/' );
+
+ for ( String pattern : DEFAULT_EXCLUSIONS )
+ {
+ if ( FileSystems.getDefault().getPathMatcher( "glob:" + pattern).matches( Paths.get( relativePath ) ) )
+ {
+ // Found match
+ return true;
+ }
+ }
+
+ // No match.
+ return false;
+ }
+
+ @PostConstruct
+ public void initialize()
+ {
+ initialiseTypeMap( this.archivaConfiguration.getConfiguration() );
+
+ this.archivaConfiguration.addChangeListener( this );
+ }
+
+ private void initialiseTypeMap( Configuration configuration )
+ {
+ defaultTypeMap.clear();
+
+ // Store the default file type declaration.
+ List<FileType> filetypes = configuration.getRepositoryScanning().getFileTypes();
+ for ( FileType filetype : filetypes )
+ {
+ List<String> patterns = defaultTypeMap.get( filetype.getId() );
+ if ( patterns == null )
+ {
+ patterns = new ArrayList<>( filetype.getPatterns().size() );
+ }
+ patterns.addAll( filetype.getPatterns() );
+
+ defaultTypeMap.put( filetype.getId(), patterns );
+ }
+ }
+
+ @Override
+ public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+ {
+ if ( propertyName.contains( "fileType" ) )
+ {
+ artifactPatterns = null;
+
+ initialiseTypeMap( archivaConfiguration.getConfiguration() );
+ }
+ }
+
+ @Override
+ public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+ {
+ /* nothing to do */
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Occurs when the configuration is stored in two locations and the save location can not be determined.
+ */
+public class IndeterminateConfigurationException
+ extends Exception
+{
+ public IndeterminateConfigurationException( String message )
+ {
+ super( message );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * An error in the configuration.
+ */
+public class InvalidConfigurationException
+ extends Exception
+{
+ private final String name;
+
+ public InvalidConfigurationException( String name, String message )
+ {
+ super( message );
+ this.name = name;
+ }
+
+ public InvalidConfigurationException( String name, String message, Throwable cause )
+ {
+ super( message, cause );
+
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+/**
+ */
+public class MavenProxyPropertyLoader
+{
+ private static final String REPO_LOCAL_STORE = "repo.local.store";
+
+ private static final String PROXY_LIST = "proxy.list";
+
+ private static final String REPO_LIST = "repo.list";
+
+ public void load( Properties props, Configuration configuration )
+ throws InvalidConfigurationException
+ {
+ // set up the managed repository
+ String localCachePath = getMandatoryProperty( props, REPO_LOCAL_STORE );
+
+ ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration();
+ config.setLocation( localCachePath );
+ config.setName( "Imported Maven-Proxy Cache" );
+ config.setId( "maven-proxy" );
+ config.setScanned( false );
+ config.setReleases( true );
+ config.setSnapshots( false );
+ configuration.addManagedRepository( config );
+
+ // Add the network proxies.
+ String propertyList = props.getProperty( PROXY_LIST );
+ if ( propertyList != null )
+ {
+ StringTokenizer tok = new StringTokenizer( propertyList, "," );
+ while ( tok.hasMoreTokens() )
+ {
+ String key = tok.nextToken();
+ if ( StringUtils.isNotEmpty( key ) )
+ {
+ NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
+ proxy.setHost( getMandatoryProperty( props, "proxy." + key + ".host" ) );
+ proxy.setPort( Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) ) );
+
+ // the username and password isn't required
+ proxy.setUsername( props.getProperty( "proxy." + key + ".username" ) );
+ proxy.setPassword( props.getProperty( "proxy." + key + ".password" ) );
+
+ configuration.addNetworkProxy( proxy );
+ }
+ }
+ }
+
+ // Add the remote repository list
+ String repoList = getMandatoryProperty( props, REPO_LIST );
+
+ StringTokenizer tok = new StringTokenizer( repoList, "," );
+ while ( tok.hasMoreTokens() )
+ {
+ String key = tok.nextToken();
+
+ Properties repoProps = getSubset( props, "repo." + key + "." );
+ String url = getMandatoryProperty( props, "repo." + key + ".url" );
+ String proxyKey = repoProps.getProperty( "proxy" );
+
+// int cachePeriod = Integer.parseInt( repoProps.getProperty( "cache.period", "60" ) );
+
+ RemoteRepositoryConfiguration repository = new RemoteRepositoryConfiguration();
+ repository.setId( key );
+ repository.setName( "Imported Maven-Proxy Remote Proxy" );
+ repository.setUrl( url );
+ repository.setLayout( "legacy" );
+
+ configuration.addRemoteRepository( repository );
+
+ ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration();
+ proxyConnector.setSourceRepoId( "maven-proxy" );
+ proxyConnector.setTargetRepoId( key );
+ proxyConnector.setProxyId( proxyKey );
+ // TODO: convert cachePeriod to closest "daily" or "hourly"
+ proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, SnapshotsPolicy.DAILY.getId() );
+ proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.ALWAYS.getId() );
+
+ configuration.addProxyConnector( proxyConnector );
+ }
+ }
+
+ @SuppressWarnings( "unchecked" )
+ private Properties getSubset( Properties props, String prefix )
+ {
+ Enumeration keys = props.keys();
+ Properties result = new Properties();
+ while ( keys.hasMoreElements() )
+ {
+ String key = (String) keys.nextElement();
+ String value = props.getProperty( key );
+ if ( key.startsWith( prefix ) )
+ {
+ String newKey = key.substring( prefix.length() );
+ result.setProperty( newKey, value );
+ }
+ }
+ return result;
+ }
+
+ public void load( InputStream is, Configuration configuration )
+ throws IOException, InvalidConfigurationException
+ {
+ Properties props = new Properties();
+ props.load( is );
+ load( props, configuration );
+ }
+
+ private String getMandatoryProperty( Properties props, String key )
+ throws InvalidConfigurationException
+ {
+ String value = props.getProperty( key );
+
+ if ( value == null )
+ {
+ throw new InvalidConfigurationException( key, "Missing required field: " + key );
+ }
+
+ return value;
+ }
+}
--- /dev/null
+
+package org.apache.archiva.configuration.provider.io.registry;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.components.registry.Registry;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.model.AbstractRepositoryConnectorConfiguration;
+import org.apache.archiva.configuration.model.ArchivaDefaultConfiguration;
+import org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration;
+import org.apache.archiva.configuration.model.CacheConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.FileLockConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.model.LdapConfiguration;
+import org.apache.archiva.configuration.model.LdapGroupMapping;
+import org.apache.archiva.configuration.model.LegacyArtifactPath;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.NetworkConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.OrganisationInformation;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration;
+import org.apache.archiva.configuration.model.RedbackRuntimeConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryCheckPath;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.model.SyncConnectorConfiguration;
+import org.apache.archiva.configuration.model.UserInterfaceOptions;
+import org.apache.archiva.configuration.model.WebappConfiguration;
+
+import java.util.Iterator;
+import java.util.List;
+
+// Util imports
+// Model class imports
+
+
+/**
+ * Generate Redback Registry input mechanism for model 'Configuration'.
+ */
+public class ConfigurationRegistryReader {
+ public Configuration read( Registry registry) {
+ return readConfiguration("", registry);
+ }
+
+ private Configuration readConfiguration(String prefix, Registry registry) {
+ Configuration value = new Configuration();
+
+ //String version = registry.getString( prefix + "version", value.getVersion() );
+
+ List<String> versionList = registry.getList(prefix + "version");
+ String version = value.getVersion();
+ if (versionList != null && !versionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = versionList.size(); i < size; i++) {
+ sb.append(versionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ version = sb.toString();
+ }
+
+ value.setVersion(version);
+ //String metadataStore = registry.getString( prefix + "metadataStore", value.getMetadataStore() );
+
+ List<String> metadataStoreList = registry.getList(prefix + "metadataStore");
+ String metadataStore = value.getMetadataStore();
+ if (metadataStoreList != null && !metadataStoreList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = metadataStoreList.size(); i < size; i++) {
+ sb.append(metadataStoreList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ metadataStore = sb.toString();
+ }
+
+ value.setMetadataStore(metadataStore);
+ java.util.List repositoryGroups = new java.util.ArrayList/*<RepositoryGroupConfiguration>*/();
+ List repositoryGroupsSubsets = registry.getSubsetList(prefix + "repositoryGroups.repositoryGroup");
+ for (Iterator i = repositoryGroupsSubsets.iterator(); i.hasNext(); ) {
+ RepositoryGroupConfiguration v = readRepositoryGroupConfiguration("", (Registry) i.next());
+ repositoryGroups.add(v);
+ }
+ value.setRepositoryGroups(repositoryGroups);
+ java.util.List managedRepositories = new java.util.ArrayList/*<ManagedRepositoryConfiguration>*/();
+ List managedRepositoriesSubsets = registry.getSubsetList(prefix + "managedRepositories.managedRepository");
+ for (Iterator i = managedRepositoriesSubsets.iterator(); i.hasNext(); ) {
+ ManagedRepositoryConfiguration v = readManagedRepositoryConfiguration("", (Registry) i.next());
+ managedRepositories.add(v);
+ }
+ value.setManagedRepositories(managedRepositories);
+ java.util.List remoteRepositories = new java.util.ArrayList/*<RemoteRepositoryConfiguration>*/();
+ List remoteRepositoriesSubsets = registry.getSubsetList(prefix + "remoteRepositories.remoteRepository");
+ for (Iterator i = remoteRepositoriesSubsets.iterator(); i.hasNext(); ) {
+ RemoteRepositoryConfiguration v = readRemoteRepositoryConfiguration("", (Registry) i.next());
+ remoteRepositories.add(v);
+ }
+ value.setRemoteRepositories(remoteRepositories);
+ java.util.List proxyConnectors = new java.util.ArrayList/*<ProxyConnectorConfiguration>*/();
+ List proxyConnectorsSubsets = registry.getSubsetList(prefix + "proxyConnectors.proxyConnector");
+ for (Iterator i = proxyConnectorsSubsets.iterator(); i.hasNext(); ) {
+ ProxyConnectorConfiguration v = readProxyConnectorConfiguration("", (Registry) i.next());
+ proxyConnectors.add(v);
+ }
+ value.setProxyConnectors(proxyConnectors);
+ java.util.List networkProxies = new java.util.ArrayList/*<NetworkProxyConfiguration>*/();
+ List networkProxiesSubsets = registry.getSubsetList(prefix + "networkProxies.networkProxy");
+ for (Iterator i = networkProxiesSubsets.iterator(); i.hasNext(); ) {
+ NetworkProxyConfiguration v = readNetworkProxyConfiguration("", (Registry) i.next());
+ networkProxies.add(v);
+ }
+ value.setNetworkProxies(networkProxies);
+ java.util.List legacyArtifactPaths = new java.util.ArrayList/*<LegacyArtifactPath>*/();
+ List legacyArtifactPathsSubsets = registry.getSubsetList(prefix + "legacyArtifactPaths.legacyArtifactPath");
+ for (Iterator i = legacyArtifactPathsSubsets.iterator(); i.hasNext(); ) {
+ LegacyArtifactPath v = readLegacyArtifactPath("", (Registry) i.next());
+ legacyArtifactPaths.add(v);
+ }
+ value.setLegacyArtifactPaths(legacyArtifactPaths);
+ RepositoryScanningConfiguration repositoryScanning = readRepositoryScanningConfiguration(prefix + "repositoryScanning.", registry);
+ value.setRepositoryScanning(repositoryScanning);
+ WebappConfiguration webapp = readWebappConfiguration(prefix + "webapp.", registry);
+ value.setWebapp(webapp);
+ OrganisationInformation organisationInfo = readOrganisationInformation(prefix + "organisationInfo.", registry);
+ value.setOrganisationInfo(organisationInfo);
+ NetworkConfiguration networkConfiguration = readNetworkConfiguration(prefix + "networkConfiguration.", registry);
+ value.setNetworkConfiguration(networkConfiguration);
+ RedbackRuntimeConfiguration redbackRuntimeConfiguration = readRedbackRuntimeConfiguration(prefix + "redbackRuntimeConfiguration.", registry);
+ value.setRedbackRuntimeConfiguration(redbackRuntimeConfiguration);
+ ArchivaRuntimeConfiguration archivaRuntimeConfiguration = readArchivaRuntimeConfiguration(prefix + "archivaRuntimeConfiguration.", registry);
+ value.setArchivaRuntimeConfiguration(archivaRuntimeConfiguration);
+ java.util.List proxyConnectorRuleConfigurations = new java.util.ArrayList/*<ProxyConnectorRuleConfiguration>*/();
+ List proxyConnectorRuleConfigurationsSubsets = registry.getSubsetList(prefix + "proxyConnectorRuleConfigurations.proxyConnectorRuleConfiguration");
+ for (Iterator i = proxyConnectorRuleConfigurationsSubsets.iterator(); i.hasNext(); ) {
+ ProxyConnectorRuleConfiguration v = readProxyConnectorRuleConfiguration("", (Registry) i.next());
+ proxyConnectorRuleConfigurations.add(v);
+ }
+ value.setProxyConnectorRuleConfigurations(proxyConnectorRuleConfigurations);
+ ArchivaDefaultConfiguration archivaDefaultConfiguration = readArchivaDefaultConfiguration(prefix + "archivaDefaultConfiguration.", registry);
+ value.setArchivaDefaultConfiguration(archivaDefaultConfiguration);
+
+ return value;
+ }
+
+ private AbstractRepositoryConfiguration readAbstractRepositoryConfiguration( String prefix, Registry registry) {
+ AbstractRepositoryConfiguration value = new AbstractRepositoryConfiguration();
+
+ //String id = registry.getString( prefix + "id", value.getId() );
+
+ List<String> idList = registry.getList(prefix + "id");
+ String id = value.getId();
+ if (idList != null && !idList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = idList.size(); i < size; i++) {
+ sb.append(idList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ id = sb.toString();
+ }
+
+ value.setId(id);
+ //String type = registry.getString( prefix + "type", value.getType() );
+
+ List<String> typeList = registry.getList(prefix + "type");
+ String type = value.getType();
+ if (typeList != null && !typeList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = typeList.size(); i < size; i++) {
+ sb.append(typeList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ type = sb.toString();
+ }
+
+ value.setType(type);
+ //String name = registry.getString( prefix + "name", value.getName() );
+
+ List<String> nameList = registry.getList(prefix + "name");
+ String name = value.getName();
+ if (nameList != null && !nameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = nameList.size(); i < size; i++) {
+ sb.append(nameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ name = sb.toString();
+ }
+
+ value.setName(name);
+ //String layout = registry.getString( prefix + "layout", value.getLayout() );
+
+ List<String> layoutList = registry.getList(prefix + "layout");
+ String layout = value.getLayout();
+ if (layoutList != null && !layoutList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = layoutList.size(); i < size; i++) {
+ sb.append(layoutList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ layout = sb.toString();
+ }
+
+ value.setLayout(layout);
+ //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
+
+ List<String> indexDirList = registry.getList(prefix + "indexDir");
+ String indexDir = value.getIndexDir();
+ if (indexDirList != null && !indexDirList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = indexDirList.size(); i < size; i++) {
+ sb.append(indexDirList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ indexDir = sb.toString();
+ }
+
+ value.setIndexDir(indexDir);
+ //String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
+
+ List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
+ String packedIndexDir = value.getPackedIndexDir();
+ if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
+ sb.append(packedIndexDirList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ packedIndexDir = sb.toString();
+ }
+
+ value.setPackedIndexDir(packedIndexDir);
+ //String description = registry.getString( prefix + "description", value.getDescription() );
+
+ List<String> descriptionList = registry.getList(prefix + "description");
+ String description = value.getDescription();
+ if (descriptionList != null && !descriptionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = descriptionList.size(); i < size; i++) {
+ sb.append(descriptionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ description = sb.toString();
+ }
+
+ value.setDescription(description);
+
+ return value;
+ }
+
+ private RemoteRepositoryConfiguration readRemoteRepositoryConfiguration(String prefix, Registry registry) {
+ RemoteRepositoryConfiguration value = new RemoteRepositoryConfiguration();
+
+ //String url = registry.getString( prefix + "url", value.getUrl() );
+
+ List<String> urlList = registry.getList(prefix + "url");
+ String url = value.getUrl();
+ if (urlList != null && !urlList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = urlList.size(); i < size; i++) {
+ sb.append(urlList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ url = sb.toString();
+ }
+
+ value.setUrl(url);
+ //String username = registry.getString( prefix + "username", value.getUsername() );
+
+ List<String> usernameList = registry.getList(prefix + "username");
+ String username = value.getUsername();
+ if (usernameList != null && !usernameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = usernameList.size(); i < size; i++) {
+ sb.append(usernameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ username = sb.toString();
+ }
+
+ value.setUsername(username);
+ //String password = registry.getString( prefix + "password", value.getPassword() );
+
+ List<String> passwordList = registry.getList(prefix + "password");
+ String password = value.getPassword();
+ if (passwordList != null && !passwordList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = passwordList.size(); i < size; i++) {
+ sb.append(passwordList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ password = sb.toString();
+ }
+
+ value.setPassword(password);
+ int timeout = registry.getInt(prefix + "timeout", value.getTimeout());
+ value.setTimeout(timeout);
+ //String refreshCronExpression = registry.getString( prefix + "refreshCronExpression", value.getRefreshCronExpression() );
+
+ List<String> refreshCronExpressionList = registry.getList(prefix + "refreshCronExpression");
+ String refreshCronExpression = value.getRefreshCronExpression();
+ if (refreshCronExpressionList != null && !refreshCronExpressionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = refreshCronExpressionList.size(); i < size; i++) {
+ sb.append(refreshCronExpressionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ refreshCronExpression = sb.toString();
+ }
+
+ value.setRefreshCronExpression(refreshCronExpression);
+ boolean downloadRemoteIndex = registry.getBoolean(prefix + "downloadRemoteIndex", value.isDownloadRemoteIndex());
+ value.setDownloadRemoteIndex(downloadRemoteIndex);
+ //String remoteIndexUrl = registry.getString( prefix + "remoteIndexUrl", value.getRemoteIndexUrl() );
+
+ List<String> remoteIndexUrlList = registry.getList(prefix + "remoteIndexUrl");
+ String remoteIndexUrl = value.getRemoteIndexUrl();
+ if (remoteIndexUrlList != null && !remoteIndexUrlList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = remoteIndexUrlList.size(); i < size; i++) {
+ sb.append(remoteIndexUrlList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ remoteIndexUrl = sb.toString();
+ }
+
+ value.setRemoteIndexUrl(remoteIndexUrl);
+ //String remoteDownloadNetworkProxyId = registry.getString( prefix + "remoteDownloadNetworkProxyId", value.getRemoteDownloadNetworkProxyId() );
+
+ List<String> remoteDownloadNetworkProxyIdList = registry.getList(prefix + "remoteDownloadNetworkProxyId");
+ String remoteDownloadNetworkProxyId = value.getRemoteDownloadNetworkProxyId();
+ if (remoteDownloadNetworkProxyIdList != null && !remoteDownloadNetworkProxyIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = remoteDownloadNetworkProxyIdList.size(); i < size; i++) {
+ sb.append(remoteDownloadNetworkProxyIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ remoteDownloadNetworkProxyId = sb.toString();
+ }
+
+ value.setRemoteDownloadNetworkProxyId(remoteDownloadNetworkProxyId);
+ int remoteDownloadTimeout = registry.getInt(prefix + "remoteDownloadTimeout", value.getRemoteDownloadTimeout());
+ value.setRemoteDownloadTimeout(remoteDownloadTimeout);
+ boolean downloadRemoteIndexOnStartup = registry.getBoolean(prefix + "downloadRemoteIndexOnStartup", value.isDownloadRemoteIndexOnStartup());
+ value.setDownloadRemoteIndexOnStartup(downloadRemoteIndexOnStartup);
+ java.util.Map extraParameters = registry.getProperties(prefix + "extraParameters");
+ value.setExtraParameters(extraParameters);
+ java.util.Map extraHeaders = registry.getProperties(prefix + "extraHeaders");
+ value.setExtraHeaders(extraHeaders);
+ //String checkPath = registry.getString( prefix + "checkPath", value.getCheckPath() );
+
+ List<String> checkPathList = registry.getList(prefix + "checkPath");
+ String checkPath = value.getCheckPath();
+ if (checkPathList != null && !checkPathList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = checkPathList.size(); i < size; i++) {
+ sb.append(checkPathList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ checkPath = sb.toString();
+ }
+
+ value.setCheckPath(checkPath);
+ //String id = registry.getString( prefix + "id", value.getId() );
+
+ List<String> idList = registry.getList(prefix + "id");
+ String id = value.getId();
+ if (idList != null && !idList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = idList.size(); i < size; i++) {
+ sb.append(idList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ id = sb.toString();
+ }
+
+ value.setId(id);
+ //String type = registry.getString( prefix + "type", value.getType() );
+
+ List<String> typeList = registry.getList(prefix + "type");
+ String type = value.getType();
+ if (typeList != null && !typeList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = typeList.size(); i < size; i++) {
+ sb.append(typeList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ type = sb.toString();
+ }
+
+ value.setType(type);
+ //String name = registry.getString( prefix + "name", value.getName() );
+
+ List<String> nameList = registry.getList(prefix + "name");
+ String name = value.getName();
+ if (nameList != null && !nameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = nameList.size(); i < size; i++) {
+ sb.append(nameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ name = sb.toString();
+ }
+
+ value.setName(name);
+ //String layout = registry.getString( prefix + "layout", value.getLayout() );
+
+ List<String> layoutList = registry.getList(prefix + "layout");
+ String layout = value.getLayout();
+ if (layoutList != null && !layoutList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = layoutList.size(); i < size; i++) {
+ sb.append(layoutList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ layout = sb.toString();
+ }
+
+ value.setLayout(layout);
+ //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
+
+ List<String> indexDirList = registry.getList(prefix + "indexDir");
+ String indexDir = value.getIndexDir();
+ if (indexDirList != null && !indexDirList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = indexDirList.size(); i < size; i++) {
+ sb.append(indexDirList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ indexDir = sb.toString();
+ }
+
+ value.setIndexDir(indexDir);
+ //String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
+
+ List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
+ String packedIndexDir = value.getPackedIndexDir();
+ if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
+ sb.append(packedIndexDirList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ packedIndexDir = sb.toString();
+ }
+
+ value.setPackedIndexDir(packedIndexDir);
+ //String description = registry.getString( prefix + "description", value.getDescription() );
+
+ List<String> descriptionList = registry.getList(prefix + "description");
+ String description = value.getDescription();
+ if (descriptionList != null && !descriptionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = descriptionList.size(); i < size; i++) {
+ sb.append(descriptionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ description = sb.toString();
+ }
+
+ value.setDescription(description);
+
+ return value;
+ }
+
+ private ManagedRepositoryConfiguration readManagedRepositoryConfiguration(String prefix, Registry registry) {
+ ManagedRepositoryConfiguration value = new ManagedRepositoryConfiguration();
+
+ //String location = registry.getString( prefix + "location", value.getLocation() );
+
+ List<String> locationList = registry.getList(prefix + "location");
+ String location = value.getLocation();
+ if (locationList != null && !locationList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = locationList.size(); i < size; i++) {
+ sb.append(locationList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ location = sb.toString();
+ }
+
+ value.setLocation(location);
+ boolean releases = registry.getBoolean(prefix + "releases", value.isReleases());
+ value.setReleases(releases);
+ boolean blockRedeployments = registry.getBoolean(prefix + "blockRedeployments", value.isBlockRedeployments());
+ value.setBlockRedeployments(blockRedeployments);
+ boolean snapshots = registry.getBoolean(prefix + "snapshots", value.isSnapshots());
+ value.setSnapshots(snapshots);
+ boolean scanned = registry.getBoolean(prefix + "scanned", value.isScanned());
+ value.setScanned(scanned);
+ //String refreshCronExpression = registry.getString( prefix + "refreshCronExpression", value.getRefreshCronExpression() );
+
+ List<String> refreshCronExpressionList = registry.getList(prefix + "refreshCronExpression");
+ String refreshCronExpression = value.getRefreshCronExpression();
+ if (refreshCronExpressionList != null && !refreshCronExpressionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = refreshCronExpressionList.size(); i < size; i++) {
+ sb.append(refreshCronExpressionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ refreshCronExpression = sb.toString();
+ }
+
+ value.setRefreshCronExpression(refreshCronExpression);
+ int retentionCount = registry.getInt(prefix + "retentionCount", value.getRetentionCount());
+ value.setRetentionCount(retentionCount);
+ int retentionPeriod = registry.getInt(prefix + "retentionPeriod", value.getRetentionPeriod());
+ value.setRetentionPeriod(retentionPeriod);
+ boolean deleteReleasedSnapshots = registry.getBoolean(prefix + "deleteReleasedSnapshots", value.isDeleteReleasedSnapshots());
+ value.setDeleteReleasedSnapshots(deleteReleasedSnapshots);
+ boolean skipPackedIndexCreation = registry.getBoolean(prefix + "skipPackedIndexCreation", value.isSkipPackedIndexCreation());
+ value.setSkipPackedIndexCreation(skipPackedIndexCreation);
+ boolean stageRepoNeeded = registry.getBoolean(prefix + "stageRepoNeeded", value.isStageRepoNeeded());
+ value.setStageRepoNeeded(stageRepoNeeded);
+ //String id = registry.getString( prefix + "id", value.getId() );
+
+ List<String> idList = registry.getList(prefix + "id");
+ String id = value.getId();
+ if (idList != null && !idList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = idList.size(); i < size; i++) {
+ sb.append(idList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ id = sb.toString();
+ }
+
+ value.setId(id);
+ //String type = registry.getString( prefix + "type", value.getType() );
+
+ List<String> typeList = registry.getList(prefix + "type");
+ String type = value.getType();
+ if (typeList != null && !typeList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = typeList.size(); i < size; i++) {
+ sb.append(typeList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ type = sb.toString();
+ }
+
+ value.setType(type);
+ //String name = registry.getString( prefix + "name", value.getName() );
+
+ List<String> nameList = registry.getList(prefix + "name");
+ String name = value.getName();
+ if (nameList != null && !nameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = nameList.size(); i < size; i++) {
+ sb.append(nameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ name = sb.toString();
+ }
+
+ value.setName(name);
+ //String layout = registry.getString( prefix + "layout", value.getLayout() );
+
+ List<String> layoutList = registry.getList(prefix + "layout");
+ String layout = value.getLayout();
+ if (layoutList != null && !layoutList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = layoutList.size(); i < size; i++) {
+ sb.append(layoutList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ layout = sb.toString();
+ }
+
+ value.setLayout(layout);
+ //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
+
+ List<String> indexDirList = registry.getList(prefix + "indexDir");
+ String indexDir = value.getIndexDir();
+ if (indexDirList != null && !indexDirList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = indexDirList.size(); i < size; i++) {
+ sb.append(indexDirList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ indexDir = sb.toString();
+ }
+
+ value.setIndexDir(indexDir);
+ //String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
+
+ List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
+ String packedIndexDir = value.getPackedIndexDir();
+ if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
+ sb.append(packedIndexDirList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ packedIndexDir = sb.toString();
+ }
+
+ value.setPackedIndexDir(packedIndexDir);
+ //String description = registry.getString( prefix + "description", value.getDescription() );
+
+ List<String> descriptionList = registry.getList(prefix + "description");
+ String description = value.getDescription();
+ if (descriptionList != null && !descriptionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = descriptionList.size(); i < size; i++) {
+ sb.append(descriptionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ description = sb.toString();
+ }
+
+ value.setDescription(description);
+
+ return value;
+ }
+
+ private LegacyArtifactPath readLegacyArtifactPath(String prefix, Registry registry) {
+ LegacyArtifactPath value = new LegacyArtifactPath();
+
+ //String path = registry.getString( prefix + "path", value.getPath() );
+
+ List<String> pathList = registry.getList(prefix + "path");
+ String path = value.getPath();
+ if (pathList != null && !pathList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = pathList.size(); i < size; i++) {
+ sb.append(pathList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ path = sb.toString();
+ }
+
+ value.setPath(path);
+ //String artifact = registry.getString( prefix + "artifact", value.getArtifact() );
+
+ List<String> artifactList = registry.getList(prefix + "artifact");
+ String artifact = value.getArtifact();
+ if (artifactList != null && !artifactList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = artifactList.size(); i < size; i++) {
+ sb.append(artifactList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ artifact = sb.toString();
+ }
+
+ value.setArtifact(artifact);
+
+ return value;
+ }
+
+ private RepositoryGroupConfiguration readRepositoryGroupConfiguration(String prefix, Registry registry) {
+ RepositoryGroupConfiguration value = new RepositoryGroupConfiguration();
+
+ //String id = registry.getString( prefix + "id", value.getId() );
+
+ List<String> idList = registry.getList(prefix + "id");
+ String id = value.getId();
+ if (idList != null && !idList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = idList.size(); i < size; i++) {
+ sb.append(idList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ id = sb.toString();
+ }
+
+ value.setId(id);
+
+ value.setName(registry.getString(prefix + "name"));
+ value.setType(registry.getString(prefix + "type"));
+
+ //String mergedIndexPath = registry.getString( prefix + "mergedIndexPath", value.getMergedIndexPath() );
+
+ List<String> mergedIndexPathList = registry.getList(prefix + "mergedIndexPath");
+ String mergedIndexPath = value.getMergedIndexPath();
+ if (mergedIndexPathList != null && !mergedIndexPathList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = mergedIndexPathList.size(); i < size; i++) {
+ sb.append(mergedIndexPathList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ mergedIndexPath = sb.toString();
+ }
+
+ value.setMergedIndexPath(mergedIndexPath);
+ int mergedIndexTtl = registry.getInt(prefix + "mergedIndexTtl", value.getMergedIndexTtl());
+ value.setMergedIndexTtl(mergedIndexTtl);
+ //String cronExpression = registry.getString( prefix + "cronExpression", value.getCronExpression() );
+
+ value.setLocation( registry.getString( prefix + "location" ) );
+
+ List<String> cronExpressionList = registry.getList(prefix + "cronExpression");
+ String cronExpression = value.getCronExpression();
+ if (cronExpressionList != null && !cronExpressionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = cronExpressionList.size(); i < size; i++) {
+ sb.append(cronExpressionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ cronExpression = sb.toString();
+ }
+
+ value.setCronExpression(cronExpression);
+ java.util.List repositories = new java.util.ArrayList/*<String>*/();
+ repositories.addAll(registry.getList(prefix + "repositories.repository"));
+ value.setRepositories(repositories);
+
+ return value;
+ }
+
+ private RepositoryCheckPath readRepositoryCheckPath( String prefix, Registry registry) {
+ RepositoryCheckPath value = new RepositoryCheckPath();
+
+ //String url = registry.getString( prefix + "url", value.getUrl() );
+
+ List<String> urlList = registry.getList(prefix + "url");
+ String url = value.getUrl();
+ if (urlList != null && !urlList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = urlList.size(); i < size; i++) {
+ sb.append(urlList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ url = sb.toString();
+ }
+
+ value.setUrl(url);
+ //String path = registry.getString( prefix + "path", value.getPath() );
+
+ List<String> pathList = registry.getList(prefix + "path");
+ String path = value.getPath();
+ if (pathList != null && !pathList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = pathList.size(); i < size; i++) {
+ sb.append(pathList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ path = sb.toString();
+ }
+
+ value.setPath(path);
+
+ return value;
+ }
+
+ private AbstractRepositoryConnectorConfiguration readAbstractRepositoryConnectorConfiguration( String prefix, Registry registry) {
+ AbstractRepositoryConnectorConfiguration value = new AbstractRepositoryConnectorConfiguration();
+
+ //String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
+
+ List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
+ String sourceRepoId = value.getSourceRepoId();
+ if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
+ sb.append(sourceRepoIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ sourceRepoId = sb.toString();
+ }
+
+ value.setSourceRepoId(sourceRepoId);
+ //String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
+
+ List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
+ String targetRepoId = value.getTargetRepoId();
+ if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
+ sb.append(targetRepoIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ targetRepoId = sb.toString();
+ }
+
+ value.setTargetRepoId(targetRepoId);
+ //String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
+
+ List<String> proxyIdList = registry.getList(prefix + "proxyId");
+ String proxyId = value.getProxyId();
+ if (proxyIdList != null && !proxyIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = proxyIdList.size(); i < size; i++) {
+ sb.append(proxyIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ proxyId = sb.toString();
+ }
+
+ value.setProxyId(proxyId);
+ java.util.List blackListPatterns = new java.util.ArrayList/*<String>*/();
+ blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
+ value.setBlackListPatterns(blackListPatterns);
+ java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/();
+ whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
+ value.setWhiteListPatterns(whiteListPatterns);
+ java.util.Map policies = registry.getProperties(prefix + "policies");
+ value.setPolicies(policies);
+ java.util.Map properties = registry.getProperties(prefix + "properties");
+ value.setProperties(properties);
+ boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
+ value.setDisabled(disabled);
+
+ return value;
+ }
+
+ private ProxyConnectorRuleConfiguration readProxyConnectorRuleConfiguration(String prefix, Registry registry) {
+ ProxyConnectorRuleConfiguration value = new ProxyConnectorRuleConfiguration();
+
+ //String ruleType = registry.getString( prefix + "ruleType", value.getRuleType() );
+
+ List<String> ruleTypeList = registry.getList(prefix + "ruleType");
+ String ruleType = value.getRuleType();
+ if (ruleTypeList != null && !ruleTypeList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = ruleTypeList.size(); i < size; i++) {
+ sb.append(ruleTypeList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ ruleType = sb.toString();
+ }
+
+ value.setRuleType(ruleType);
+ //String pattern = registry.getString( prefix + "pattern", value.getPattern() );
+
+ List<String> patternList = registry.getList(prefix + "pattern");
+ String pattern = value.getPattern();
+ if (patternList != null && !patternList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = patternList.size(); i < size; i++) {
+ sb.append(patternList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ pattern = sb.toString();
+ }
+
+ value.setPattern(pattern);
+ java.util.List proxyConnectors = new java.util.ArrayList/*<ProxyConnectorConfiguration>*/();
+ List proxyConnectorsSubsets = registry.getSubsetList(prefix + "proxyConnectors.proxyConnector");
+ for (Iterator i = proxyConnectorsSubsets.iterator(); i.hasNext(); ) {
+ ProxyConnectorConfiguration v = readProxyConnectorConfiguration("", (Registry) i.next());
+ proxyConnectors.add(v);
+ }
+ value.setProxyConnectors(proxyConnectors);
+
+ return value;
+ }
+
+ private ProxyConnectorConfiguration readProxyConnectorConfiguration(String prefix, Registry registry) {
+ ProxyConnectorConfiguration value = new ProxyConnectorConfiguration();
+
+ int order = registry.getInt(prefix + "order", value.getOrder());
+ value.setOrder(order);
+ //String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
+
+ List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
+ String sourceRepoId = value.getSourceRepoId();
+ if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
+ sb.append(sourceRepoIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ sourceRepoId = sb.toString();
+ }
+
+ value.setSourceRepoId(sourceRepoId);
+ //String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
+
+ List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
+ String targetRepoId = value.getTargetRepoId();
+ if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
+ sb.append(targetRepoIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ targetRepoId = sb.toString();
+ }
+
+ value.setTargetRepoId(targetRepoId);
+ //String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
+
+ List<String> proxyIdList = registry.getList(prefix + "proxyId");
+ String proxyId = value.getProxyId();
+ if (proxyIdList != null && !proxyIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = proxyIdList.size(); i < size; i++) {
+ sb.append(proxyIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ proxyId = sb.toString();
+ }
+
+ value.setProxyId(proxyId);
+ java.util.List blackListPatterns = new java.util.ArrayList/*<String>*/();
+ blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
+ value.setBlackListPatterns(blackListPatterns);
+ java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/();
+ whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
+ value.setWhiteListPatterns(whiteListPatterns);
+ java.util.Map policies = registry.getProperties(prefix + "policies");
+ value.setPolicies(policies);
+ java.util.Map properties = registry.getProperties(prefix + "properties");
+ value.setProperties(properties);
+ boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
+ value.setDisabled(disabled);
+
+ return value;
+ }
+
+ private SyncConnectorConfiguration readSyncConnectorConfiguration( String prefix, Registry registry) {
+ SyncConnectorConfiguration value = new SyncConnectorConfiguration();
+
+ //String cronExpression = registry.getString( prefix + "cronExpression", value.getCronExpression() );
+
+ List<String> cronExpressionList = registry.getList(prefix + "cronExpression");
+ String cronExpression = value.getCronExpression();
+ if (cronExpressionList != null && !cronExpressionList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = cronExpressionList.size(); i < size; i++) {
+ sb.append(cronExpressionList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ cronExpression = sb.toString();
+ }
+
+ value.setCronExpression(cronExpression);
+ //String method = registry.getString( prefix + "method", value.getMethod() );
+
+ List<String> methodList = registry.getList(prefix + "method");
+ String method = value.getMethod();
+ if (methodList != null && !methodList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = methodList.size(); i < size; i++) {
+ sb.append(methodList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ method = sb.toString();
+ }
+
+ value.setMethod(method);
+ //String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
+
+ List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
+ String sourceRepoId = value.getSourceRepoId();
+ if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
+ sb.append(sourceRepoIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ sourceRepoId = sb.toString();
+ }
+
+ value.setSourceRepoId(sourceRepoId);
+ //String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
+
+ List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
+ String targetRepoId = value.getTargetRepoId();
+ if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
+ sb.append(targetRepoIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ targetRepoId = sb.toString();
+ }
+
+ value.setTargetRepoId(targetRepoId);
+ //String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
+
+ List<String> proxyIdList = registry.getList(prefix + "proxyId");
+ String proxyId = value.getProxyId();
+ if (proxyIdList != null && !proxyIdList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = proxyIdList.size(); i < size; i++) {
+ sb.append(proxyIdList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ proxyId = sb.toString();
+ }
+
+ value.setProxyId(proxyId);
+ java.util.List blackListPatterns = new java.util.ArrayList/*<String>*/();
+ blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
+ value.setBlackListPatterns(blackListPatterns);
+ java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/();
+ whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
+ value.setWhiteListPatterns(whiteListPatterns);
+ java.util.Map policies = registry.getProperties(prefix + "policies");
+ value.setPolicies(policies);
+ java.util.Map properties = registry.getProperties(prefix + "properties");
+ value.setProperties(properties);
+ boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
+ value.setDisabled(disabled);
+
+ return value;
+ }
+
+ private NetworkProxyConfiguration readNetworkProxyConfiguration(String prefix, Registry registry) {
+ NetworkProxyConfiguration value = new NetworkProxyConfiguration();
+
+ //String id = registry.getString( prefix + "id", value.getId() );
+
+ List<String> idList = registry.getList(prefix + "id");
+ String id = value.getId();
+ if (idList != null && !idList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = idList.size(); i < size; i++) {
+ sb.append(idList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ id = sb.toString();
+ }
+
+ value.setId(id);
+ //String protocol = registry.getString( prefix + "protocol", value.getProtocol() );
+
+ List<String> protocolList = registry.getList(prefix + "protocol");
+ String protocol = value.getProtocol();
+ if (protocolList != null && !protocolList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = protocolList.size(); i < size; i++) {
+ sb.append(protocolList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ protocol = sb.toString();
+ }
+
+ value.setProtocol(protocol);
+ //String host = registry.getString( prefix + "host", value.getHost() );
+
+ List<String> hostList = registry.getList(prefix + "host");
+ String host = value.getHost();
+ if (hostList != null && !hostList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = hostList.size(); i < size; i++) {
+ sb.append(hostList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ host = sb.toString();
+ }
+
+ value.setHost(host);
+ int port = registry.getInt(prefix + "port", value.getPort());
+ value.setPort(port);
+ //String username = registry.getString( prefix + "username", value.getUsername() );
+
+ List<String> usernameList = registry.getList(prefix + "username");
+ String username = value.getUsername();
+ if (usernameList != null && !usernameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = usernameList.size(); i < size; i++) {
+ sb.append(usernameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ username = sb.toString();
+ }
+
+ value.setUsername(username);
+ //String password = registry.getString( prefix + "password", value.getPassword() );
+
+ List<String> passwordList = registry.getList(prefix + "password");
+ String password = value.getPassword();
+ if (passwordList != null && !passwordList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = passwordList.size(); i < size; i++) {
+ sb.append(passwordList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ password = sb.toString();
+ }
+
+ value.setPassword(password);
+ boolean useNtlm = registry.getBoolean(prefix + "useNtlm", value.isUseNtlm());
+ value.setUseNtlm(useNtlm);
+
+ return value;
+ }
+
+ private RepositoryScanningConfiguration readRepositoryScanningConfiguration(String prefix, Registry registry) {
+ RepositoryScanningConfiguration value = new RepositoryScanningConfiguration();
+
+ java.util.List fileTypes = new java.util.ArrayList/*<FileType>*/();
+ List fileTypesSubsets = registry.getSubsetList(prefix + "fileTypes.fileType");
+ for (Iterator i = fileTypesSubsets.iterator(); i.hasNext(); ) {
+ FileType v = readFileType("", (Registry) i.next());
+ fileTypes.add(v);
+ }
+ value.setFileTypes(fileTypes);
+ java.util.List knownContentConsumers = new java.util.ArrayList/*<String>*/();
+ knownContentConsumers.addAll(registry.getList(prefix + "knownContentConsumers.knownContentConsumer"));
+ value.setKnownContentConsumers(knownContentConsumers);
+ java.util.List invalidContentConsumers = new java.util.ArrayList/*<String>*/();
+ invalidContentConsumers.addAll(registry.getList(prefix + "invalidContentConsumers.invalidContentConsumer"));
+ value.setInvalidContentConsumers(invalidContentConsumers);
+
+ return value;
+ }
+
+ private FileType readFileType(String prefix, Registry registry) {
+ FileType value = new FileType();
+
+ //String id = registry.getString( prefix + "id", value.getId() );
+
+ List<String> idList = registry.getList(prefix + "id");
+ String id = value.getId();
+ if (idList != null && !idList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = idList.size(); i < size; i++) {
+ sb.append(idList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ id = sb.toString();
+ }
+
+ value.setId(id);
+ java.util.List patterns = new java.util.ArrayList/*<String>*/();
+ patterns.addAll(registry.getList(prefix + "patterns.pattern"));
+ value.setPatterns(patterns);
+
+ return value;
+ }
+
+ private OrganisationInformation readOrganisationInformation(String prefix, Registry registry) {
+ OrganisationInformation value = new OrganisationInformation();
+
+ //String name = registry.getString( prefix + "name", value.getName() );
+
+ List<String> nameList = registry.getList(prefix + "name");
+ String name = value.getName();
+ if (nameList != null && !nameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = nameList.size(); i < size; i++) {
+ sb.append(nameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ name = sb.toString();
+ }
+
+ value.setName(name);
+ //String url = registry.getString( prefix + "url", value.getUrl() );
+
+ List<String> urlList = registry.getList(prefix + "url");
+ String url = value.getUrl();
+ if (urlList != null && !urlList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = urlList.size(); i < size; i++) {
+ sb.append(urlList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ url = sb.toString();
+ }
+
+ value.setUrl(url);
+ //String logoLocation = registry.getString( prefix + "logoLocation", value.getLogoLocation() );
+
+ List<String> logoLocationList = registry.getList(prefix + "logoLocation");
+ String logoLocation = value.getLogoLocation();
+ if (logoLocationList != null && !logoLocationList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = logoLocationList.size(); i < size; i++) {
+ sb.append(logoLocationList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ logoLocation = sb.toString();
+ }
+
+ value.setLogoLocation(logoLocation);
+
+ return value;
+ }
+
+ private WebappConfiguration readWebappConfiguration(String prefix, Registry registry) {
+ WebappConfiguration value = new WebappConfiguration();
+
+ UserInterfaceOptions ui = readUserInterfaceOptions(prefix + "ui.", registry);
+ value.setUi(ui);
+
+ return value;
+ }
+
+ private UserInterfaceOptions readUserInterfaceOptions(String prefix, Registry registry) {
+ UserInterfaceOptions value = new UserInterfaceOptions();
+
+ boolean showFindArtifacts = registry.getBoolean(prefix + "showFindArtifacts", value.isShowFindArtifacts());
+ value.setShowFindArtifacts(showFindArtifacts);
+ boolean appletFindEnabled = registry.getBoolean(prefix + "appletFindEnabled", value.isAppletFindEnabled());
+ value.setAppletFindEnabled(appletFindEnabled);
+ boolean disableEasterEggs = registry.getBoolean(prefix + "disableEasterEggs", value.isDisableEasterEggs());
+ value.setDisableEasterEggs(disableEasterEggs);
+ //String applicationUrl = registry.getString( prefix + "applicationUrl", value.getApplicationUrl() );
+
+ List<String> applicationUrlList = registry.getList(prefix + "applicationUrl");
+ String applicationUrl = value.getApplicationUrl();
+ if (applicationUrlList != null && !applicationUrlList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = applicationUrlList.size(); i < size; i++) {
+ sb.append(applicationUrlList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ applicationUrl = sb.toString();
+ }
+
+ value.setApplicationUrl(applicationUrl);
+ boolean disableRegistration = registry.getBoolean(prefix + "disableRegistration", value.isDisableRegistration());
+ value.setDisableRegistration(disableRegistration);
+
+ return value;
+ }
+
+ private NetworkConfiguration readNetworkConfiguration(String prefix, Registry registry) {
+ NetworkConfiguration value = new NetworkConfiguration();
+
+ int maxTotal = registry.getInt(prefix + "maxTotal", value.getMaxTotal());
+ value.setMaxTotal(maxTotal);
+ int maxTotalPerHost = registry.getInt(prefix + "maxTotalPerHost", value.getMaxTotalPerHost());
+ value.setMaxTotalPerHost(maxTotalPerHost);
+ boolean usePooling = registry.getBoolean(prefix + "usePooling", value.isUsePooling());
+ value.setUsePooling(usePooling);
+
+ return value;
+ }
+
+ private ArchivaRuntimeConfiguration readArchivaRuntimeConfiguration(String prefix, Registry registry) {
+ ArchivaRuntimeConfiguration value = new ArchivaRuntimeConfiguration();
+
+ CacheConfiguration urlFailureCacheConfiguration = readCacheConfiguration(prefix + "urlFailureCacheConfiguration.", registry);
+ value.setUrlFailureCacheConfiguration(urlFailureCacheConfiguration);
+ FileLockConfiguration fileLockConfiguration = readFileLockConfiguration(prefix + "fileLockConfiguration.", registry);
+ value.setFileLockConfiguration(fileLockConfiguration);
+ //String dataDirectory = registry.getString( prefix + "dataDirectory", value.getDataDirectory() );
+
+ List<String> dataDirectoryList = registry.getList(prefix + "dataDirectory");
+ String dataDirectory = value.getDataDirectory();
+ if (dataDirectoryList != null && !dataDirectoryList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = dataDirectoryList.size(); i < size; i++) {
+ sb.append(dataDirectoryList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ dataDirectory = sb.toString();
+ }
+
+ value.setDataDirectory(dataDirectory);
+ //String repositoryBaseDirectory = registry.getString( prefix + "repositoryBaseDirectory", value.getRepositoryBaseDirectory() );
+
+ List<String> repositoryBaseDirectoryList = registry.getList(prefix + "repositoryBaseDirectory");
+ String repositoryBaseDirectory = value.getRepositoryBaseDirectory();
+ if (repositoryBaseDirectoryList != null && !repositoryBaseDirectoryList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = repositoryBaseDirectoryList.size(); i < size; i++) {
+ sb.append(repositoryBaseDirectoryList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ repositoryBaseDirectory = sb.toString();
+ }
+
+ value.setRepositoryBaseDirectory(repositoryBaseDirectory);
+ //String remoteRepositoryBaseDirectory = registry.getString( prefix + "remoteRepositoryBaseDirectory", value.getRemoteRepositoryBaseDirectory() );
+
+ List<String> remoteRepositoryBaseDirectoryList = registry.getList(prefix + "remoteRepositoryBaseDirectory");
+ String remoteRepositoryBaseDirectory = value.getRemoteRepositoryBaseDirectory();
+ if (remoteRepositoryBaseDirectoryList != null && !remoteRepositoryBaseDirectoryList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = remoteRepositoryBaseDirectoryList.size(); i < size; i++) {
+ sb.append(remoteRepositoryBaseDirectoryList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ remoteRepositoryBaseDirectory = sb.toString();
+ }
+
+ value.setRemoteRepositoryBaseDirectory(remoteRepositoryBaseDirectory);
+ //String defaultLanguage = registry.getString( prefix + "defaultLanguage", value.getDefaultLanguage() );
+
+
+ List<String> repositoryGroupBaseDirectoryList = registry.getList(prefix + "repositoryGroupBaseDirectory");
+ String repositoryGroupBaseDirectory = value.getRepositoryGroupBaseDirectory();
+ if (repositoryGroupBaseDirectoryList != null && !repositoryGroupBaseDirectoryList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = repositoryGroupBaseDirectoryList.size(); i < size; i++) {
+ sb.append(repositoryGroupBaseDirectoryList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ repositoryGroupBaseDirectory = sb.toString();
+ }
+
+ value.setRepositoryGroupBaseDirectory(repositoryGroupBaseDirectory);
+
+ List<String> defaultLanguageList = registry.getList(prefix + "defaultLanguage");
+ String defaultLanguage = value.getDefaultLanguage();
+ if (defaultLanguageList != null && !defaultLanguageList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = defaultLanguageList.size(); i < size; i++) {
+ sb.append(defaultLanguageList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ defaultLanguage = sb.toString();
+ }
+
+ value.setDefaultLanguage(defaultLanguage);
+ //String languageRange = registry.getString( prefix + "languageRange", value.getLanguageRange() );
+
+ List<String> languageRangeList = registry.getList(prefix + "languageRange");
+ String languageRange = value.getLanguageRange();
+ if (languageRangeList != null && !languageRangeList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = languageRangeList.size(); i < size; i++) {
+ sb.append(languageRangeList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ languageRange = sb.toString();
+ }
+
+ value.setLanguageRange(languageRange);
+
+ List<String> checksumTypeList = registry.getList(prefix + "checksumTypes.type");
+ value.setChecksumTypes(checksumTypeList);
+
+ return value;
+ }
+
+ private RedbackRuntimeConfiguration readRedbackRuntimeConfiguration(String prefix, Registry registry) {
+ RedbackRuntimeConfiguration value = new RedbackRuntimeConfiguration();
+
+ boolean migratedFromRedbackConfiguration = registry.getBoolean(prefix + "migratedFromRedbackConfiguration", value.isMigratedFromRedbackConfiguration());
+ value.setMigratedFromRedbackConfiguration(migratedFromRedbackConfiguration);
+ java.util.List userManagerImpls = new java.util.ArrayList/*<String>*/();
+ userManagerImpls.addAll(registry.getList(prefix + "userManagerImpls.userManagerImpl"));
+ value.setUserManagerImpls(userManagerImpls);
+ java.util.List rbacManagerImpls = new java.util.ArrayList/*<String>*/();
+ rbacManagerImpls.addAll(registry.getList(prefix + "rbacManagerImpls.rbacManagerImpl"));
+ value.setRbacManagerImpls(rbacManagerImpls);
+ LdapConfiguration ldapConfiguration = readLdapConfiguration(prefix + "ldapConfiguration.", registry);
+ value.setLdapConfiguration(ldapConfiguration);
+ java.util.List ldapGroupMappings = new java.util.ArrayList/*<LdapGroupMapping>*/();
+ List ldapGroupMappingsSubsets = registry.getSubsetList(prefix + "ldapGroupMappings.ldapGroupMapping");
+ for (Iterator i = ldapGroupMappingsSubsets.iterator(); i.hasNext(); ) {
+ LdapGroupMapping v = readLdapGroupMapping("", (Registry) i.next());
+ ldapGroupMappings.add(v);
+ }
+ value.setLdapGroupMappings(ldapGroupMappings);
+ java.util.Map configurationProperties = registry.getProperties(prefix + "configurationProperties");
+ value.setConfigurationProperties(configurationProperties);
+ boolean useUsersCache = registry.getBoolean(prefix + "useUsersCache", value.isUseUsersCache());
+ value.setUseUsersCache(useUsersCache);
+ CacheConfiguration usersCacheConfiguration = readCacheConfiguration(prefix + "usersCacheConfiguration.", registry);
+ value.setUsersCacheConfiguration(usersCacheConfiguration);
+
+ return value;
+ }
+
+ private ArchivaDefaultConfiguration readArchivaDefaultConfiguration(String prefix, Registry registry) {
+ ArchivaDefaultConfiguration value = new ArchivaDefaultConfiguration();
+
+ java.util.List defaultCheckPaths = new java.util.ArrayList/*<RepositoryCheckPath>*/();
+ List defaultCheckPathsSubsets = registry.getSubsetList(prefix + "defaultCheckPaths.defaultCheckPath");
+ for (Iterator i = defaultCheckPathsSubsets.iterator(); i.hasNext(); ) {
+ RepositoryCheckPath v = readRepositoryCheckPath("", (Registry) i.next());
+ defaultCheckPaths.add(v);
+ }
+ value.setDefaultCheckPaths(defaultCheckPaths);
+
+ return value;
+ }
+
+ private LdapConfiguration readLdapConfiguration(String prefix, Registry registry) {
+ LdapConfiguration value = new LdapConfiguration();
+
+ //String hostName = registry.getString( prefix + "hostName", value.getHostName() );
+
+ List<String> hostNameList = registry.getList(prefix + "hostName");
+ String hostName = value.getHostName();
+ if (hostNameList != null && !hostNameList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = hostNameList.size(); i < size; i++) {
+ sb.append(hostNameList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ hostName = sb.toString();
+ }
+
+ value.setHostName(hostName);
+ int port = registry.getInt(prefix + "port", value.getPort());
+ value.setPort(port);
+ boolean ssl = registry.getBoolean(prefix + "ssl", value.isSsl());
+ value.setSsl(ssl);
+ //String baseDn = registry.getString( prefix + "baseDn", value.getBaseDn() );
+
+ List<String> baseDnList = registry.getList(prefix + "baseDn");
+ String baseDn = value.getBaseDn();
+ if (baseDnList != null && !baseDnList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = baseDnList.size(); i < size; i++) {
+ sb.append(baseDnList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ baseDn = sb.toString();
+ }
+
+ value.setBaseDn(baseDn);
+ //String baseGroupsDn = registry.getString( prefix + "baseGroupsDn", value.getBaseGroupsDn() );
+
+ List<String> baseGroupsDnList = registry.getList(prefix + "baseGroupsDn");
+ String baseGroupsDn = value.getBaseGroupsDn();
+ if (baseGroupsDnList != null && !baseGroupsDnList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = baseGroupsDnList.size(); i < size; i++) {
+ sb.append(baseGroupsDnList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ baseGroupsDn = sb.toString();
+ }
+
+ value.setBaseGroupsDn(baseGroupsDn);
+ //String contextFactory = registry.getString( prefix + "contextFactory", value.getContextFactory() );
+
+ List<String> contextFactoryList = registry.getList(prefix + "contextFactory");
+ String contextFactory = value.getContextFactory();
+ if (contextFactoryList != null && !contextFactoryList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = contextFactoryList.size(); i < size; i++) {
+ sb.append(contextFactoryList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ contextFactory = sb.toString();
+ }
+
+ value.setContextFactory(contextFactory);
+ //String bindDn = registry.getString( prefix + "bindDn", value.getBindDn() );
+
+ List<String> bindDnList = registry.getList(prefix + "bindDn");
+ String bindDn = value.getBindDn();
+ if (bindDnList != null && !bindDnList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = bindDnList.size(); i < size; i++) {
+ sb.append(bindDnList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ bindDn = sb.toString();
+ }
+
+ value.setBindDn(bindDn);
+ //String password = registry.getString( prefix + "password", value.getPassword() );
+
+ List<String> passwordList = registry.getList(prefix + "password");
+ String password = value.getPassword();
+ if (passwordList != null && !passwordList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = passwordList.size(); i < size; i++) {
+ sb.append(passwordList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ password = sb.toString();
+ }
+
+ value.setPassword(password);
+ //String authenticationMethod = registry.getString( prefix + "authenticationMethod", value.getAuthenticationMethod() );
+
+ List<String> authenticationMethodList = registry.getList(prefix + "authenticationMethod");
+ String authenticationMethod = value.getAuthenticationMethod();
+ if (authenticationMethodList != null && !authenticationMethodList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = authenticationMethodList.size(); i < size; i++) {
+ sb.append(authenticationMethodList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ authenticationMethod = sb.toString();
+ }
+
+ value.setAuthenticationMethod(authenticationMethod);
+ boolean bindAuthenticatorEnabled = registry.getBoolean(prefix + "bindAuthenticatorEnabled", value.isBindAuthenticatorEnabled());
+ value.setBindAuthenticatorEnabled(bindAuthenticatorEnabled);
+ boolean writable = registry.getBoolean(prefix + "writable", value.isWritable());
+ value.setWritable(writable);
+ boolean useRoleNameAsGroup = registry.getBoolean(prefix + "useRoleNameAsGroup", value.isUseRoleNameAsGroup());
+ value.setUseRoleNameAsGroup(useRoleNameAsGroup);
+ java.util.Map extraProperties = registry.getProperties(prefix + "extraProperties");
+ value.setExtraProperties(extraProperties);
+
+ return value;
+ }
+
+ private FileLockConfiguration readFileLockConfiguration(String prefix, Registry registry) {
+ FileLockConfiguration value = new FileLockConfiguration();
+
+ boolean skipLocking = registry.getBoolean(prefix + "skipLocking", value.isSkipLocking());
+ value.setSkipLocking(skipLocking);
+ int lockingTimeout = registry.getInt(prefix + "lockingTimeout", value.getLockingTimeout());
+ value.setLockingTimeout(lockingTimeout);
+
+ return value;
+ }
+
+ private CacheConfiguration readCacheConfiguration(String prefix, Registry registry) {
+ CacheConfiguration value = new CacheConfiguration();
+
+ int timeToIdleSeconds = registry.getInt(prefix + "timeToIdleSeconds", value.getTimeToIdleSeconds());
+ value.setTimeToIdleSeconds(timeToIdleSeconds);
+ int timeToLiveSeconds = registry.getInt(prefix + "timeToLiveSeconds", value.getTimeToLiveSeconds());
+ value.setTimeToLiveSeconds(timeToLiveSeconds);
+ int maxElementsInMemory = registry.getInt(prefix + "maxElementsInMemory", value.getMaxElementsInMemory());
+ value.setMaxElementsInMemory(maxElementsInMemory);
+ int maxElementsOnDisk = registry.getInt(prefix + "maxElementsOnDisk", value.getMaxElementsOnDisk());
+ value.setMaxElementsOnDisk(maxElementsOnDisk);
+
+ return value;
+ }
+
+ private LdapGroupMapping readLdapGroupMapping(String prefix, Registry registry) {
+ LdapGroupMapping value = new LdapGroupMapping();
+
+ //String group = registry.getString( prefix + "group", value.getGroup() );
+
+ List<String> groupList = registry.getList(prefix + "group");
+ String group = value.getGroup();
+ if (groupList != null && !groupList.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, size = groupList.size(); i < size; i++) {
+ sb.append(groupList.get(i));
+ if (i < size - 1) {
+ sb.append(',');
+ }
+ }
+ group = sb.toString();
+ }
+
+ value.setGroup(group);
+ java.util.List roleNames = new java.util.ArrayList/*<String>*/();
+ roleNames.addAll(registry.getList(prefix + "roleNames.roleName"));
+ value.setRoleNames(roleNames);
+
+ return value;
+ }
+
+}
--- /dev/null
+
+package org.apache.archiva.configuration.provider.io.registry;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.components.registry.Registry;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.model.AbstractRepositoryConnectorConfiguration;
+import org.apache.archiva.configuration.model.ArchivaDefaultConfiguration;
+import org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration;
+import org.apache.archiva.configuration.model.CacheConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.FileLockConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.model.LdapConfiguration;
+import org.apache.archiva.configuration.model.LdapGroupMapping;
+import org.apache.archiva.configuration.model.LegacyArtifactPath;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.NetworkConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.OrganisationInformation;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration;
+import org.apache.archiva.configuration.model.RedbackRuntimeConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryCheckPath;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.model.SyncConnectorConfiguration;
+import org.apache.archiva.configuration.model.UserInterfaceOptions;
+import org.apache.archiva.configuration.model.WebappConfiguration;
+
+import java.util.Iterator;
+import java.util.List;
+
+// Util imports
+// Model class imports
+
+
+/**
+ * Generate Plexus Registry output mechanism for model 'Configuration'.
+ */
+public class ConfigurationRegistryWriter {
+ public void write( Configuration model, Registry registry) {
+ writeConfiguration("", model, registry);
+ }
+
+ private void writeList(Registry registry, List<String> subList, String subsetPath, String elementName) {
+ if (subList != null && subList.size() > 0
+ ) {
+ registry.removeSubset(subsetPath);
+
+ int count = 0;
+ for (Iterator<String> iter = subList.iterator(); iter.hasNext(); count++) {
+ String name = subsetPath + "." + elementName + "(" + count + ")";
+ String value = iter.next();
+ registry.setString(name, value);
+ }
+ }
+ }
+
+ private void writeConfiguration(String prefix, Configuration value, Registry registry) {
+ if (value != null) {
+ if (value.getVersion() != null
+ ) {
+ String version = "version";
+ registry.setString(prefix + version, value.getVersion());
+ }
+ if (value.getMetadataStore() != null && !value.getMetadataStore().equals("jcr")
+ ) {
+ String metadataStore = "metadataStore";
+ registry.setString(prefix + metadataStore, value.getMetadataStore());
+ }
+ if (value.getRepositoryGroups() != null && value.getRepositoryGroups().size() > 0
+ ) {
+ registry.removeSubset(prefix + "repositoryGroups");
+
+ int count = 0;
+ for (Iterator iter = value.getRepositoryGroups().iterator(); iter.hasNext(); count++) {
+ String name = "repositoryGroups.repositoryGroup(" + count + ")";
+ RepositoryGroupConfiguration o = (RepositoryGroupConfiguration) iter.next();
+ writeRepositoryGroupConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getManagedRepositories() != null && value.getManagedRepositories().size() > 0
+ ) {
+ registry.removeSubset(prefix + "managedRepositories");
+
+ int count = 0;
+ for (Iterator iter = value.getManagedRepositories().iterator(); iter.hasNext(); count++) {
+ String name = "managedRepositories.managedRepository(" + count + ")";
+ ManagedRepositoryConfiguration o = (ManagedRepositoryConfiguration) iter.next();
+ writeManagedRepositoryConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getRemoteRepositories() != null && value.getRemoteRepositories().size() > 0
+ ) {
+ registry.removeSubset(prefix + "remoteRepositories");
+
+ int count = 0;
+ for (Iterator iter = value.getRemoteRepositories().iterator(); iter.hasNext(); count++) {
+ String name = "remoteRepositories.remoteRepository(" + count + ")";
+ RemoteRepositoryConfiguration o = (RemoteRepositoryConfiguration) iter.next();
+ writeRemoteRepositoryConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
+ ) {
+ registry.removeSubset(prefix + "proxyConnectors");
+
+ int count = 0;
+ for (Iterator iter = value.getProxyConnectors().iterator(); iter.hasNext(); count++) {
+ String name = "proxyConnectors.proxyConnector(" + count + ")";
+ ProxyConnectorConfiguration o = (ProxyConnectorConfiguration) iter.next();
+ writeProxyConnectorConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getNetworkProxies() != null && value.getNetworkProxies().size() > 0
+ ) {
+ registry.removeSubset(prefix + "networkProxies");
+
+ int count = 0;
+ for (Iterator iter = value.getNetworkProxies().iterator(); iter.hasNext(); count++) {
+ String name = "networkProxies.networkProxy(" + count + ")";
+ NetworkProxyConfiguration o = (NetworkProxyConfiguration) iter.next();
+ writeNetworkProxyConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getLegacyArtifactPaths() != null && value.getLegacyArtifactPaths().size() > 0
+ ) {
+ registry.removeSubset(prefix + "legacyArtifactPaths");
+
+ int count = 0;
+ for (Iterator iter = value.getLegacyArtifactPaths().iterator(); iter.hasNext(); count++) {
+ String name = "legacyArtifactPaths.legacyArtifactPath(" + count + ")";
+ LegacyArtifactPath o = (LegacyArtifactPath) iter.next();
+ writeLegacyArtifactPath(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getRepositoryScanning() != null
+ ) {
+ writeRepositoryScanningConfiguration(prefix + "repositoryScanning.", value.getRepositoryScanning(), registry);
+ }
+ if (value.getWebapp() != null
+ ) {
+ writeWebappConfiguration(prefix + "webapp.", value.getWebapp(), registry);
+ }
+ if (value.getOrganisationInfo() != null
+ ) {
+ writeOrganisationInformation(prefix + "organisationInfo.", value.getOrganisationInfo(), registry);
+ }
+ if (value.getNetworkConfiguration() != null
+ ) {
+ writeNetworkConfiguration(prefix + "networkConfiguration.", value.getNetworkConfiguration(), registry);
+ }
+ if (value.getRedbackRuntimeConfiguration() != null
+ ) {
+ writeRedbackRuntimeConfiguration(prefix + "redbackRuntimeConfiguration.", value.getRedbackRuntimeConfiguration(), registry);
+ }
+ if (value.getArchivaRuntimeConfiguration() != null
+ ) {
+ writeArchivaRuntimeConfiguration(prefix + "archivaRuntimeConfiguration.", value.getArchivaRuntimeConfiguration(), registry);
+ }
+ if (value.getProxyConnectorRuleConfigurations() != null && value.getProxyConnectorRuleConfigurations().size() > 0
+ ) {
+ registry.removeSubset(prefix + "proxyConnectorRuleConfigurations");
+
+ int count = 0;
+ for (Iterator iter = value.getProxyConnectorRuleConfigurations().iterator(); iter.hasNext(); count++) {
+ String name = "proxyConnectorRuleConfigurations.proxyConnectorRuleConfiguration(" + count + ")";
+ ProxyConnectorRuleConfiguration o = (ProxyConnectorRuleConfiguration) iter.next();
+ writeProxyConnectorRuleConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getArchivaDefaultConfiguration() != null
+ ) {
+ writeArchivaDefaultConfiguration(prefix + "archivaDefaultConfiguration.", value.getArchivaDefaultConfiguration(), registry);
+ }
+ }
+ }
+
+ private void writeAbstractRepositoryConfiguration( String prefix, AbstractRepositoryConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getId() != null
+ ) {
+ String id = "id";
+ registry.setString(prefix + id, value.getId());
+ }
+ if (value.getType() != null && !value.getType().equals("MAVEN")
+ ) {
+ String type = "type";
+ registry.setString(prefix + type, value.getType());
+ }
+ if (value.getName() != null
+ ) {
+ String name = "name";
+ registry.setString(prefix + name, value.getName());
+ }
+ if (value.getLayout() != null && !value.getLayout().equals("default")
+ ) {
+ String layout = "layout";
+ registry.setString(prefix + layout, value.getLayout());
+ }
+ if (value.getIndexDir() != null && !value.getIndexDir().equals("")
+ ) {
+ String indexDir = "indexDir";
+ registry.setString(prefix + indexDir, value.getIndexDir());
+ }
+ if (value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals("")
+ ) {
+ String packedIndexDir = "packedIndexDir";
+ registry.setString(prefix + packedIndexDir, value.getPackedIndexDir());
+ }
+ if (value.getDescription() != null && !value.getDescription().equals("")
+ ) {
+ String description = "description";
+ registry.setString(prefix + description, value.getDescription());
+ }
+ }
+ }
+
+ private void writeRemoteRepositoryConfiguration(String prefix, RemoteRepositoryConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getUrl() != null
+ ) {
+ String url = "url";
+ registry.setString(prefix + url, value.getUrl());
+ }
+ if (value.getUsername() != null
+ ) {
+ String username = "username";
+ registry.setString(prefix + username, value.getUsername());
+ }
+ if (value.getPassword() != null
+ ) {
+ String password = "password";
+ registry.setString(prefix + password, value.getPassword());
+ }
+ if (value.getTimeout() != 60
+ ) {
+ String timeout = "timeout";
+ registry.setInt(prefix + timeout, value.getTimeout());
+ }
+ if (value.getRefreshCronExpression() != null && !value.getRefreshCronExpression().equals("0 0 08 ? * SUN")
+ ) {
+ String refreshCronExpression = "refreshCronExpression";
+ registry.setString(prefix + refreshCronExpression, value.getRefreshCronExpression());
+ }
+ String downloadRemoteIndex = "downloadRemoteIndex";
+ registry.setBoolean(prefix + downloadRemoteIndex, value.isDownloadRemoteIndex());
+ if (value.getRemoteIndexUrl() != null
+ ) {
+ String remoteIndexUrl = "remoteIndexUrl";
+ registry.setString(prefix + remoteIndexUrl, value.getRemoteIndexUrl());
+ }
+ if (value.getRemoteDownloadNetworkProxyId() != null
+ ) {
+ String remoteDownloadNetworkProxyId = "remoteDownloadNetworkProxyId";
+ registry.setString(prefix + remoteDownloadNetworkProxyId, value.getRemoteDownloadNetworkProxyId());
+ }
+ if (value.getRemoteDownloadTimeout() != 300
+ ) {
+ String remoteDownloadTimeout = "remoteDownloadTimeout";
+ registry.setInt(prefix + remoteDownloadTimeout, value.getRemoteDownloadTimeout());
+ }
+ String downloadRemoteIndexOnStartup = "downloadRemoteIndexOnStartup";
+ registry.setBoolean(prefix + downloadRemoteIndexOnStartup, value.isDownloadRemoteIndexOnStartup());
+ if (value.getExtraParameters() != null && value.getExtraParameters().size() > 0
+ ) {
+ registry.removeSubset(prefix + "extraParameters");
+
+ for (Iterator iter = value.getExtraParameters().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getExtraParameters().get(key);
+
+ registry.setString(prefix + "extraParameters." + key, v);
+ }
+ }
+ if (value.getExtraHeaders() != null && value.getExtraHeaders().size() > 0
+ ) {
+ registry.removeSubset(prefix + "extraHeaders");
+
+ for (Iterator iter = value.getExtraHeaders().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getExtraHeaders().get(key);
+
+ registry.setString(prefix + "extraHeaders." + key, v);
+ }
+ }
+ if (value.getCheckPath() != null
+ ) {
+ String checkPath = "checkPath";
+ registry.setString(prefix + checkPath, value.getCheckPath());
+ }
+ if (value.getId() != null
+ ) {
+ String id = "id";
+ registry.setString(prefix + id, value.getId());
+ }
+ if (value.getType() != null && !value.getType().equals("MAVEN")
+ ) {
+ String type = "type";
+ registry.setString(prefix + type, value.getType());
+ }
+ if (value.getName() != null
+ ) {
+ String name = "name";
+ registry.setString(prefix + name, value.getName());
+ }
+ if (value.getLayout() != null && !value.getLayout().equals("default")
+ ) {
+ String layout = "layout";
+ registry.setString(prefix + layout, value.getLayout());
+ }
+ if (value.getIndexDir() != null && !value.getIndexDir().equals("")
+ ) {
+ String indexDir = "indexDir";
+ registry.setString(prefix + indexDir, value.getIndexDir());
+ }
+ if (value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals("")
+ ) {
+ String packedIndexDir = "packedIndexDir";
+ registry.setString(prefix + packedIndexDir, value.getPackedIndexDir());
+ }
+ if (value.getDescription() != null && !value.getDescription().equals("")
+ ) {
+ String description = "description";
+ registry.setString(prefix + description, value.getDescription());
+ }
+ }
+ }
+
+ private void writeManagedRepositoryConfiguration(String prefix, ManagedRepositoryConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getLocation() != null
+ ) {
+ String location = "location";
+ registry.setString(prefix + location, value.getLocation());
+ }
+ String releases = "releases";
+ registry.setBoolean(prefix + releases, value.isReleases());
+ String blockRedeployments = "blockRedeployments";
+ registry.setBoolean(prefix + blockRedeployments, value.isBlockRedeployments());
+ String snapshots = "snapshots";
+ registry.setBoolean(prefix + snapshots, value.isSnapshots());
+ String scanned = "scanned";
+ registry.setBoolean(prefix + scanned, value.isScanned());
+ if (value.getRefreshCronExpression() != null && !value.getRefreshCronExpression().equals("0 0 * * * ?")
+ ) {
+ String refreshCronExpression = "refreshCronExpression";
+ registry.setString(prefix + refreshCronExpression, value.getRefreshCronExpression());
+ }
+ if (value.getRetentionCount() != 2
+ ) {
+ String retentionCount = "retentionCount";
+ registry.setInt(prefix + retentionCount, value.getRetentionCount());
+ }
+ if (value.getRetentionPeriod() != 100
+ ) {
+ String retentionPeriod = "retentionPeriod";
+ registry.setInt(prefix + retentionPeriod, value.getRetentionPeriod());
+ }
+ String deleteReleasedSnapshots = "deleteReleasedSnapshots";
+ registry.setBoolean(prefix + deleteReleasedSnapshots, value.isDeleteReleasedSnapshots());
+ String skipPackedIndexCreation = "skipPackedIndexCreation";
+ registry.setBoolean(prefix + skipPackedIndexCreation, value.isSkipPackedIndexCreation());
+ String stageRepoNeeded = "stageRepoNeeded";
+ registry.setBoolean(prefix + stageRepoNeeded, value.isStageRepoNeeded());
+ if (value.getId() != null
+ ) {
+ String id = "id";
+ registry.setString(prefix + id, value.getId());
+ }
+ if (value.getType() != null && !value.getType().equals("MAVEN")
+ ) {
+ String type = "type";
+ registry.setString(prefix + type, value.getType());
+ }
+ if (value.getName() != null
+ ) {
+ String name = "name";
+ registry.setString(prefix + name, value.getName());
+ }
+ if (value.getLayout() != null && !value.getLayout().equals("default")
+ ) {
+ String layout = "layout";
+ registry.setString(prefix + layout, value.getLayout());
+ }
+ if (value.getIndexDir() != null && !value.getIndexDir().equals("")
+ ) {
+ String indexDir = "indexDir";
+ registry.setString(prefix + indexDir, value.getIndexDir());
+ }
+ if (value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals("")
+ ) {
+ String packedIndexDir = "packedIndexDir";
+ registry.setString(prefix + packedIndexDir, value.getPackedIndexDir());
+ }
+ if (value.getDescription() != null && !value.getDescription().equals("")
+ ) {
+ String description = "description";
+ registry.setString(prefix + description, value.getDescription());
+ }
+ }
+ }
+
+ private void writeLegacyArtifactPath(String prefix, LegacyArtifactPath value, Registry registry) {
+ if (value != null) {
+ if (value.getPath() != null
+ ) {
+ String path = "path";
+ registry.setString(prefix + path, value.getPath());
+ }
+ if (value.getArtifact() != null
+ ) {
+ String artifact = "artifact";
+ registry.setString(prefix + artifact, value.getArtifact());
+ }
+ }
+ }
+
+ private void writeRepositoryGroupConfiguration(String prefix, RepositoryGroupConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getId() != null
+ ) {
+ String id = "id";
+ registry.setString(prefix + id, value.getId());
+ }
+ if (value.getName() != null) {
+ registry.setString(prefix + "name", value.getName());
+ }
+ if (value.getType() != null) {
+ registry.setString(prefix + "type", value.getType());
+ }
+ if (value.getLocation()!=null) {
+ registry.setString( prefix+"location", value.getType( ) );
+ }
+ if (value.getMergedIndexPath() != null && !value.getMergedIndexPath().equals(".indexer")
+ ) {
+ String mergedIndexPath = "mergedIndexPath";
+ registry.setString(prefix + mergedIndexPath, value.getMergedIndexPath());
+ }
+ if (value.getMergedIndexTtl() != 30
+ ) {
+ String mergedIndexTtl = "mergedIndexTtl";
+ registry.setInt(prefix + mergedIndexTtl, value.getMergedIndexTtl());
+ }
+ if (value.getCronExpression() != null && !value.getCronExpression().equals("")
+ ) {
+ String cronExpression = "cronExpression";
+ registry.setString(prefix + cronExpression, value.getCronExpression());
+ }
+ if (value.getRepositories() != null && value.getRepositories().size() > 0
+ ) {
+ registry.removeSubset(prefix + "repositories");
+
+ int count = 0;
+ for (Iterator iter = value.getRepositories().iterator(); iter.hasNext(); count++) {
+ String name = "repositories.repository(" + count + ")";
+ String repository = (String) iter.next();
+ registry.setString(prefix + name, repository);
+ }
+ }
+ }
+ }
+
+ private void writeRepositoryCheckPath( String prefix, RepositoryCheckPath value, Registry registry) {
+ if (value != null) {
+ if (value.getUrl() != null
+ ) {
+ String url = "url";
+ registry.setString(prefix + url, value.getUrl());
+ }
+ if (value.getPath() != null
+ ) {
+ String path = "path";
+ registry.setString(prefix + path, value.getPath());
+ }
+ }
+ }
+
+ private void writeAbstractRepositoryConnectorConfiguration( String prefix, AbstractRepositoryConnectorConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getSourceRepoId() != null
+ ) {
+ String sourceRepoId = "sourceRepoId";
+ registry.setString(prefix + sourceRepoId, value.getSourceRepoId());
+ }
+ if (value.getTargetRepoId() != null
+ ) {
+ String targetRepoId = "targetRepoId";
+ registry.setString(prefix + targetRepoId, value.getTargetRepoId());
+ }
+ if (value.getProxyId() != null
+ ) {
+ String proxyId = "proxyId";
+ registry.setString(prefix + proxyId, value.getProxyId());
+ }
+ if (value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "blackListPatterns");
+
+ int count = 0;
+ for (Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "blackListPatterns.blackListPattern(" + count + ")";
+ String blackListPattern = (String) iter.next();
+ registry.setString(prefix + name, blackListPattern);
+ }
+ }
+ if (value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "whiteListPatterns");
+
+ int count = 0;
+ for (Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "whiteListPatterns.whiteListPattern(" + count + ")";
+ String whiteListPattern = (String) iter.next();
+ registry.setString(prefix + name, whiteListPattern);
+ }
+ }
+ if (value.getPolicies() != null && value.getPolicies().size() > 0
+ ) {
+ registry.removeSubset(prefix + "policies");
+
+ for (Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getPolicies().get(key);
+
+ registry.setString(prefix + "policies." + key, v);
+ }
+ }
+ if (value.getProperties() != null && value.getProperties().size() > 0
+ ) {
+ registry.removeSubset(prefix + "properties");
+
+ for (Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getProperties().get(key);
+
+ registry.setString(prefix + "properties." + key, v);
+ }
+ }
+ String disabled = "disabled";
+ registry.setBoolean(prefix + disabled, value.isDisabled());
+ }
+ }
+
+ private void writeProxyConnectorRuleConfiguration(String prefix, ProxyConnectorRuleConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getRuleType() != null
+ ) {
+ String ruleType = "ruleType";
+ registry.setString(prefix + ruleType, value.getRuleType());
+ }
+ if (value.getPattern() != null
+ ) {
+ String pattern = "pattern";
+ registry.setString(prefix + pattern, value.getPattern());
+ }
+ if (value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
+ ) {
+ registry.removeSubset(prefix + "proxyConnectors");
+
+ int count = 0;
+ for (Iterator iter = value.getProxyConnectors().iterator(); iter.hasNext(); count++) {
+ String name = "proxyConnectors.proxyConnector(" + count + ")";
+ ProxyConnectorConfiguration o = (ProxyConnectorConfiguration) iter.next();
+ writeProxyConnectorConfiguration(prefix + name + ".", o, registry);
+ }
+ }
+ }
+ }
+
+ private void writeProxyConnectorConfiguration(String prefix, ProxyConnectorConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getOrder() != 0
+ ) {
+ String order = "order";
+ registry.setInt(prefix + order, value.getOrder());
+ }
+ if (value.getSourceRepoId() != null
+ ) {
+ String sourceRepoId = "sourceRepoId";
+ registry.setString(prefix + sourceRepoId, value.getSourceRepoId());
+ }
+ if (value.getTargetRepoId() != null
+ ) {
+ String targetRepoId = "targetRepoId";
+ registry.setString(prefix + targetRepoId, value.getTargetRepoId());
+ }
+ if (value.getProxyId() != null
+ ) {
+ String proxyId = "proxyId";
+ registry.setString(prefix + proxyId, value.getProxyId());
+ }
+ if (value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "blackListPatterns");
+
+ int count = 0;
+ for (Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "blackListPatterns.blackListPattern(" + count + ")";
+ String blackListPattern = (String) iter.next();
+ registry.setString(prefix + name, blackListPattern);
+ }
+ }
+ if (value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "whiteListPatterns");
+
+ int count = 0;
+ for (Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "whiteListPatterns.whiteListPattern(" + count + ")";
+ String whiteListPattern = (String) iter.next();
+ registry.setString(prefix + name, whiteListPattern);
+ }
+ }
+ if (value.getPolicies() != null && value.getPolicies().size() > 0
+ ) {
+ registry.removeSubset(prefix + "policies");
+
+ for (Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getPolicies().get(key);
+
+ registry.setString(prefix + "policies." + key, v);
+ }
+ }
+ if (value.getProperties() != null && value.getProperties().size() > 0
+ ) {
+ registry.removeSubset(prefix + "properties");
+
+ for (Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getProperties().get(key);
+
+ registry.setString(prefix + "properties." + key, v);
+ }
+ }
+ String disabled = "disabled";
+ registry.setBoolean(prefix + disabled, value.isDisabled());
+ }
+ }
+
+ private void writeSyncConnectorConfiguration( String prefix, SyncConnectorConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getCronExpression() != null && !value.getCronExpression().equals("0 0 * * * ?")
+ ) {
+ String cronExpression = "cronExpression";
+ registry.setString(prefix + cronExpression, value.getCronExpression());
+ }
+ if (value.getMethod() != null && !value.getMethod().equals("rsync")
+ ) {
+ String method = "method";
+ registry.setString(prefix + method, value.getMethod());
+ }
+ if (value.getSourceRepoId() != null
+ ) {
+ String sourceRepoId = "sourceRepoId";
+ registry.setString(prefix + sourceRepoId, value.getSourceRepoId());
+ }
+ if (value.getTargetRepoId() != null
+ ) {
+ String targetRepoId = "targetRepoId";
+ registry.setString(prefix + targetRepoId, value.getTargetRepoId());
+ }
+ if (value.getProxyId() != null
+ ) {
+ String proxyId = "proxyId";
+ registry.setString(prefix + proxyId, value.getProxyId());
+ }
+ if (value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "blackListPatterns");
+
+ int count = 0;
+ for (Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "blackListPatterns.blackListPattern(" + count + ")";
+ String blackListPattern = (String) iter.next();
+ registry.setString(prefix + name, blackListPattern);
+ }
+ }
+ if (value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "whiteListPatterns");
+
+ int count = 0;
+ for (Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "whiteListPatterns.whiteListPattern(" + count + ")";
+ String whiteListPattern = (String) iter.next();
+ registry.setString(prefix + name, whiteListPattern);
+ }
+ }
+ if (value.getPolicies() != null && value.getPolicies().size() > 0
+ ) {
+ registry.removeSubset(prefix + "policies");
+
+ for (Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getPolicies().get(key);
+
+ registry.setString(prefix + "policies." + key, v);
+ }
+ }
+ if (value.getProperties() != null && value.getProperties().size() > 0
+ ) {
+ registry.removeSubset(prefix + "properties");
+
+ for (Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getProperties().get(key);
+
+ registry.setString(prefix + "properties." + key, v);
+ }
+ }
+ String disabled = "disabled";
+ registry.setBoolean(prefix + disabled, value.isDisabled());
+ }
+ }
+
+ private void writeNetworkProxyConfiguration(String prefix, NetworkProxyConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getId() != null
+ ) {
+ String id = "id";
+ registry.setString(prefix + id, value.getId());
+ }
+ if (value.getProtocol() != null && !value.getProtocol().equals("http")
+ ) {
+ String protocol = "protocol";
+ registry.setString(prefix + protocol, value.getProtocol());
+ }
+ if (value.getHost() != null
+ ) {
+ String host = "host";
+ registry.setString(prefix + host, value.getHost());
+ }
+ if (value.getPort() != 8080
+ ) {
+ String port = "port";
+ registry.setInt(prefix + port, value.getPort());
+ }
+ if (value.getUsername() != null
+ ) {
+ String username = "username";
+ registry.setString(prefix + username, value.getUsername());
+ }
+ if (value.getPassword() != null
+ ) {
+ String password = "password";
+ registry.setString(prefix + password, value.getPassword());
+ }
+ String useNtlm = "useNtlm";
+ registry.setBoolean(prefix + useNtlm, value.isUseNtlm());
+ }
+ }
+
+ private void writeRepositoryScanningConfiguration( String prefix, RepositoryScanningConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getFileTypes() != null && value.getFileTypes().size() > 0
+ ) {
+ registry.removeSubset(prefix + "fileTypes");
+
+ int count = 0;
+ for (Iterator iter = value.getFileTypes().iterator(); iter.hasNext(); count++) {
+ String name = "fileTypes.fileType(" + count + ")";
+ FileType o = (FileType) iter.next();
+ writeFileType(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getKnownContentConsumers() != null && value.getKnownContentConsumers().size() > 0
+ ) {
+ registry.removeSubset(prefix + "knownContentConsumers");
+
+ int count = 0;
+ for (Iterator iter = value.getKnownContentConsumers().iterator(); iter.hasNext(); count++) {
+ String name = "knownContentConsumers.knownContentConsumer(" + count + ")";
+ String knownContentConsumer = (String) iter.next();
+ registry.setString(prefix + name, knownContentConsumer);
+ }
+ }
+ if (value.getInvalidContentConsumers() != null && value.getInvalidContentConsumers().size() > 0
+ ) {
+ registry.removeSubset(prefix + "invalidContentConsumers");
+
+ int count = 0;
+ for (Iterator iter = value.getInvalidContentConsumers().iterator(); iter.hasNext(); count++) {
+ String name = "invalidContentConsumers.invalidContentConsumer(" + count + ")";
+ String invalidContentConsumer = (String) iter.next();
+ registry.setString(prefix + name, invalidContentConsumer);
+ }
+ }
+ }
+ }
+
+ private void writeFileType(String prefix, FileType value, Registry registry) {
+ if (value != null) {
+ if (value.getId() != null
+ ) {
+ String id = "id";
+ registry.setString(prefix + id, value.getId());
+ }
+ if (value.getPatterns() != null && value.getPatterns().size() > 0
+ ) {
+ registry.removeSubset(prefix + "patterns");
+
+ int count = 0;
+ for (Iterator iter = value.getPatterns().iterator(); iter.hasNext(); count++) {
+ String name = "patterns.pattern(" + count + ")";
+ String pattern = (String) iter.next();
+ registry.setString(prefix + name, pattern);
+ }
+ }
+ }
+ }
+
+ private void writeOrganisationInformation( String prefix, OrganisationInformation value, Registry registry) {
+ if (value != null) {
+ if (value.getName() != null
+ ) {
+ String name = "name";
+ registry.setString(prefix + name, value.getName());
+ }
+ if (value.getUrl() != null
+ ) {
+ String url = "url";
+ registry.setString(prefix + url, value.getUrl());
+ }
+ if (value.getLogoLocation() != null
+ ) {
+ String logoLocation = "logoLocation";
+ registry.setString(prefix + logoLocation, value.getLogoLocation());
+ }
+ }
+ }
+
+ private void writeWebappConfiguration( String prefix, WebappConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getUi() != null
+ ) {
+ writeUserInterfaceOptions(prefix + "ui.", value.getUi(), registry);
+ }
+ }
+ }
+
+ private void writeUserInterfaceOptions( String prefix, UserInterfaceOptions value, Registry registry) {
+ if (value != null) {
+ String showFindArtifacts = "showFindArtifacts";
+ registry.setBoolean(prefix + showFindArtifacts, value.isShowFindArtifacts());
+ String appletFindEnabled = "appletFindEnabled";
+ registry.setBoolean(prefix + appletFindEnabled, value.isAppletFindEnabled());
+ String disableEasterEggs = "disableEasterEggs";
+ registry.setBoolean(prefix + disableEasterEggs, value.isDisableEasterEggs());
+ if (value.getApplicationUrl() != null
+ ) {
+ String applicationUrl = "applicationUrl";
+ registry.setString(prefix + applicationUrl, value.getApplicationUrl());
+ }
+ String disableRegistration = "disableRegistration";
+ registry.setBoolean(prefix + disableRegistration, value.isDisableRegistration());
+ }
+ }
+
+ private void writeNetworkConfiguration( String prefix, NetworkConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getMaxTotal() != 30
+ ) {
+ String maxTotal = "maxTotal";
+ registry.setInt(prefix + maxTotal, value.getMaxTotal());
+ }
+ if (value.getMaxTotalPerHost() != 30
+ ) {
+ String maxTotalPerHost = "maxTotalPerHost";
+ registry.setInt(prefix + maxTotalPerHost, value.getMaxTotalPerHost());
+ }
+ String usePooling = "usePooling";
+ registry.setBoolean(prefix + usePooling, value.isUsePooling());
+ }
+ }
+
+ private void writeArchivaRuntimeConfiguration( String prefix, ArchivaRuntimeConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getUrlFailureCacheConfiguration() != null
+ ) {
+ writeCacheConfiguration(prefix + "urlFailureCacheConfiguration.", value.getUrlFailureCacheConfiguration(), registry);
+ }
+ if (value.getFileLockConfiguration() != null
+ ) {
+ writeFileLockConfiguration(prefix + "fileLockConfiguration.", value.getFileLockConfiguration(), registry);
+ }
+ if (value.getDataDirectory() != null
+ ) {
+ String dataDirectory = "dataDirectory";
+ registry.setString(prefix + dataDirectory, value.getDataDirectory());
+ }
+ if (value.getRepositoryBaseDirectory() != null
+ ) {
+ String repositoryBaseDirectory = "repositoryBaseDirectory";
+ registry.setString(prefix + repositoryBaseDirectory, value.getRepositoryBaseDirectory());
+ }
+ if (value.getRemoteRepositoryBaseDirectory() != null
+ ) {
+ String remoteRepositoryBaseDirectory = "remoteRepositoryBaseDirectory";
+ registry.setString(prefix + remoteRepositoryBaseDirectory, value.getRemoteRepositoryBaseDirectory());
+ }
+ if (value.getRepositoryGroupBaseDirectory() != null
+ ) {
+ String repositoryGroupBaseDirectory = "repositoryGroupBaseDirectory";
+ registry.setString(prefix + repositoryGroupBaseDirectory, value.getRepositoryGroupBaseDirectory());
+ }
+
+ if (value.getDefaultLanguage() != null && !value.getDefaultLanguage().equals("en-US")
+ ) {
+ String defaultLanguage = "defaultLanguage";
+ registry.setString(prefix + defaultLanguage, value.getDefaultLanguage());
+ }
+ if (value.getLanguageRange() != null && !value.getLanguageRange().equals("en,fr,de")
+ ) {
+ String languageRange = "languageRange";
+ registry.setString(prefix + languageRange, value.getLanguageRange());
+ }
+ writeList(registry, value.getChecksumTypes(), prefix+"checksumTypes", "type");
+ }
+ }
+
+ private void writeRedbackRuntimeConfiguration( String prefix, RedbackRuntimeConfiguration value, Registry registry) {
+ if (value != null) {
+ String migratedFromRedbackConfiguration = "migratedFromRedbackConfiguration";
+ registry.setBoolean(prefix + migratedFromRedbackConfiguration, value.isMigratedFromRedbackConfiguration());
+ if (value.getUserManagerImpls() != null && value.getUserManagerImpls().size() > 0
+ ) {
+ registry.removeSubset(prefix + "userManagerImpls");
+
+ int count = 0;
+ for (Iterator iter = value.getUserManagerImpls().iterator(); iter.hasNext(); count++) {
+ String name = "userManagerImpls.userManagerImpl(" + count + ")";
+ String userManagerImpl = (String) iter.next();
+ registry.setString(prefix + name, userManagerImpl);
+ }
+ }
+ if (value.getRbacManagerImpls() != null && value.getRbacManagerImpls().size() > 0
+ ) {
+ registry.removeSubset(prefix + "rbacManagerImpls");
+
+ int count = 0;
+ for (Iterator iter = value.getRbacManagerImpls().iterator(); iter.hasNext(); count++) {
+ String name = "rbacManagerImpls.rbacManagerImpl(" + count + ")";
+ String rbacManagerImpl = (String) iter.next();
+ registry.setString(prefix + name, rbacManagerImpl);
+ }
+ }
+ if (value.getLdapConfiguration() != null
+ ) {
+ writeLdapConfiguration(prefix + "ldapConfiguration.", value.getLdapConfiguration(), registry);
+ }
+ if (value.getLdapGroupMappings() != null && value.getLdapGroupMappings().size() > 0
+ ) {
+ registry.removeSubset(prefix + "ldapGroupMappings");
+
+ int count = 0;
+ for (Iterator iter = value.getLdapGroupMappings().iterator(); iter.hasNext(); count++) {
+ String name = "ldapGroupMappings.ldapGroupMapping(" + count + ")";
+ LdapGroupMapping o = (LdapGroupMapping) iter.next();
+ writeLdapGroupMapping(prefix + name + ".", o, registry);
+ }
+ }
+ if (value.getConfigurationProperties() != null && value.getConfigurationProperties().size() > 0
+ ) {
+ registry.removeSubset(prefix + "configurationProperties");
+
+ for (Iterator iter = value.getConfigurationProperties().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getConfigurationProperties().get(key);
+
+ registry.setString(prefix + "configurationProperties." + key, v);
+ }
+ }
+ String useUsersCache = "useUsersCache";
+ registry.setBoolean(prefix + useUsersCache, value.isUseUsersCache());
+ if (value.getUsersCacheConfiguration() != null
+ ) {
+ writeCacheConfiguration(prefix + "usersCacheConfiguration.", value.getUsersCacheConfiguration(), registry);
+ }
+ }
+ }
+
+ private void writeArchivaDefaultConfiguration( String prefix, ArchivaDefaultConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getDefaultCheckPaths() != null && value.getDefaultCheckPaths().size() > 0
+ ) {
+ registry.removeSubset(prefix + "defaultCheckPaths");
+
+ int count = 0;
+ for (Iterator iter = value.getDefaultCheckPaths().iterator(); iter.hasNext(); count++) {
+ String name = "defaultCheckPaths.defaultCheckPath(" + count + ")";
+ RepositoryCheckPath o = (RepositoryCheckPath) iter.next();
+ writeRepositoryCheckPath(prefix + name + ".", o, registry);
+ }
+ }
+ }
+ }
+
+ private void writeLdapConfiguration( String prefix, LdapConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getHostName() != null
+ ) {
+ String hostName = "hostName";
+ registry.setString(prefix + hostName, value.getHostName());
+ }
+ if (value.getPort() != 0
+ ) {
+ String port = "port";
+ registry.setInt(prefix + port, value.getPort());
+ }
+ String ssl = "ssl";
+ registry.setBoolean(prefix + ssl, value.isSsl());
+ if (value.getBaseDn() != null
+ ) {
+ String baseDn = "baseDn";
+ registry.setString(prefix + baseDn, value.getBaseDn());
+ }
+ if (value.getBaseGroupsDn() != null
+ ) {
+ String baseGroupsDn = "baseGroupsDn";
+ registry.setString(prefix + baseGroupsDn, value.getBaseGroupsDn());
+ }
+ if (value.getContextFactory() != null
+ ) {
+ String contextFactory = "contextFactory";
+ registry.setString(prefix + contextFactory, value.getContextFactory());
+ }
+ if (value.getBindDn() != null
+ ) {
+ String bindDn = "bindDn";
+ registry.setString(prefix + bindDn, value.getBindDn());
+ }
+ if (value.getPassword() != null
+ ) {
+ String password = "password";
+ registry.setString(prefix + password, value.getPassword());
+ }
+ if (value.getAuthenticationMethod() != null
+ ) {
+ String authenticationMethod = "authenticationMethod";
+ registry.setString(prefix + authenticationMethod, value.getAuthenticationMethod());
+ }
+ String bindAuthenticatorEnabled = "bindAuthenticatorEnabled";
+ registry.setBoolean(prefix + bindAuthenticatorEnabled, value.isBindAuthenticatorEnabled());
+ String writable = "writable";
+ registry.setBoolean(prefix + writable, value.isWritable());
+ String useRoleNameAsGroup = "useRoleNameAsGroup";
+ registry.setBoolean(prefix + useRoleNameAsGroup, value.isUseRoleNameAsGroup());
+ if (value.getExtraProperties() != null && value.getExtraProperties().size() > 0
+ ) {
+ registry.removeSubset(prefix + "extraProperties");
+
+ for (Iterator iter = value.getExtraProperties().keySet().iterator(); iter.hasNext(); ) {
+ String key = (String) iter.next();
+ String v = (String) value.getExtraProperties().get(key);
+
+ registry.setString(prefix + "extraProperties." + key, v);
+ }
+ }
+ }
+ }
+
+ private void writeFileLockConfiguration( String prefix, FileLockConfiguration value, Registry registry) {
+ if (value != null) {
+ String skipLocking = "skipLocking";
+ registry.setBoolean(prefix + skipLocking, value.isSkipLocking());
+ if (value.getLockingTimeout() != 0
+ ) {
+ String lockingTimeout = "lockingTimeout";
+ registry.setInt(prefix + lockingTimeout, value.getLockingTimeout());
+ }
+ }
+ }
+
+ private void writeCacheConfiguration( String prefix, CacheConfiguration value, Registry registry) {
+ if (value != null) {
+ if (value.getTimeToIdleSeconds() != -1
+ ) {
+ String timeToIdleSeconds = "timeToIdleSeconds";
+ registry.setInt(prefix + timeToIdleSeconds, value.getTimeToIdleSeconds());
+ }
+ if (value.getTimeToLiveSeconds() != -1
+ ) {
+ String timeToLiveSeconds = "timeToLiveSeconds";
+ registry.setInt(prefix + timeToLiveSeconds, value.getTimeToLiveSeconds());
+ }
+ if (value.getMaxElementsInMemory() != -1
+ ) {
+ String maxElementsInMemory = "maxElementsInMemory";
+ registry.setInt(prefix + maxElementsInMemory, value.getMaxElementsInMemory());
+ }
+ if (value.getMaxElementsOnDisk() != -1
+ ) {
+ String maxElementsOnDisk = "maxElementsOnDisk";
+ registry.setInt(prefix + maxElementsOnDisk, value.getMaxElementsOnDisk());
+ }
+ }
+ }
+
+ private void writeLdapGroupMapping(String prefix, LdapGroupMapping value, Registry registry) {
+ if (value != null) {
+ if (value.getGroup() != null
+ ) {
+ String group = "group";
+ registry.setString(prefix + group, value.getGroup());
+ }
+ if (value.getRoleNames() != null && value.getRoleNames().size() > 0
+ ) {
+ registry.removeSubset(prefix + "roleNames");
+
+ int count = 0;
+ for (Iterator iter = value.getRoleNames().iterator(); iter.hasNext(); count++) {
+ String name = "roleNames.roleName(" + count + ")";
+ String roleName = (String) iter.next();
+ registry.setString(prefix + name, roleName);
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package org.apache.archiva.configuration.provider.util;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * Helper class that can be used for mapping configuration keys (e.g. user configuration keys) to
+ * archiva configuration objects.
+ *
+ * @param <T> The class used to retrieve the attribute data
+ * @param <K> The class used to retrieve the data that is for prefix matching
+ * @author Martin Stockhammer <martin_s@apache.org>
+ * @since 3.0
+ */
+public class ConfigMapper<T, K>
+{
+ private final Map<String, Function<T, String>> stringFunctionMap = new HashMap<>( );
+ private final Map<String, Function<T, Integer>> intFunctionMap = new HashMap<>( );
+ private final Map<String, Function<T, Boolean>> booleanFunctionMap = new HashMap<>( );
+ private final Map<String, BiFunction<String, K, String>> prefixStringFunctionMap = new HashMap<>( );
+
+ public void addStringMapping( String attributeName, Function<T, String> mapping) {
+ this.stringFunctionMap.put( attributeName, mapping );
+ }
+
+ public void addPrefixStringMapping(String prefix, BiFunction<String, K, String> mapping) {
+ prefixStringFunctionMap.put( prefix, mapping );
+ }
+
+ public String getString( String attributeName, T instance) {
+ return stringFunctionMap.get( attributeName ).apply( instance );
+ }
+
+ public String getPrefixString(String attributeName, K instance) {
+ BiFunction<String, K, String> function = prefixStringFunctionMap.entrySet( ).stream( ).filter( entry -> attributeName.startsWith( entry.getKey( ) ) ).findFirst( )
+ .map( entry -> entry.getValue( ) )
+ .get( );
+ return function.apply( attributeName, instance );
+ }
+
+ public boolean isStringMapping(String attributeName) {
+ return stringFunctionMap.containsKey( attributeName );
+ }
+
+ public boolean isIntMapping(String attributeName) {
+ return intFunctionMap.containsKey( attributeName );
+ }
+
+ public boolean isBooleanMapping(String attributeName) {
+ return booleanFunctionMap.containsKey( attributeName );
+ }
+
+ public boolean isPrefixMapping(String attributeName) {
+ return prefixStringFunctionMap.keySet( ).stream( ).anyMatch( prefix -> attributeName.startsWith( prefix ) );
+ }
+
+ public boolean isMapping(String attributeName) {
+ return isStringMapping( attributeName ) || isIntMapping( attributeName ) || isBooleanMapping( attributeName );
+ }
+
+ public void addIntMapping( String attributeName, Function<T, Integer> mapping) {
+ this.intFunctionMap.put( attributeName, mapping );
+ }
+
+ public int getInt( String attributeName, T instance) {
+ return this.intFunctionMap.get( attributeName ).apply( instance );
+ }
+
+ public void addBooleanMapping( String attributeName, Function<T, Boolean> mapping) {
+ this.booleanFunctionMap.put( attributeName, mapping );
+ }
+
+ public boolean getBoolean( String attributeName, T instance) {
+ return this.booleanFunctionMap.get( attributeName ).apply( instance );
+ }
+
+ public List<String> getStringAttributes() {
+ return new ArrayList<>( stringFunctionMap.keySet( ) );
+ }
+
+ public List<String> getIntAttributes() {
+ return new ArrayList<>( intFunctionMap.keySet( ) );
+ }
+
+ public List<String> getBooleanAttributes() {
+ return new ArrayList<>( booleanFunctionMap.keySet( ) );
+ }
+
+ public List<String> getAllAttributes() {
+ return Arrays.asList( stringFunctionMap,intFunctionMap, booleanFunctionMap).stream()
+ .flatMap( map->map.keySet().stream() ).collect( Collectors.toList());
+ }
+
+}
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.configuration"/>
+ <!-- olamy could be removed as only here temporary for plexus-spring -->
+ <alias name="archivaConfiguration#default" alias="archivaConfiguration"/>
+
+</beans>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <version>3.0.0</version>
+ <managedRepositories>
+ <managedRepository>
+ <id>internal</id>
+ <name>Archiva Managed Internal Repository</name>
+ <location>${appserver.base}/repositories/internal</location>
+ <indexDir>${appserver.base}/repositories/internal/.indexer</indexDir>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <blockRedeployments>true</blockRedeployments>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ <retentionPeriod>30</retentionPeriod>
+ </managedRepository>
+ <managedRepository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <location>${appserver.base}/repositories/snapshots</location>
+ <indexDir>${appserver.base}/repositories/snapshots/.indexer</indexDir>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <blockRedeployments>false</blockRedeployments>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
+ <retentionPeriod>30</retentionPeriod>
+ </managedRepository>
+ </managedRepositories>
+ <remoteRepositories>
+ <remoteRepository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>https://repo.maven.apache.org/maven2</url>
+ <layout>default</layout>
+ </remoteRepository>
+ </remoteRepositories>
+
+ <proxyConnectors>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>central</targetRepoId>
+ <proxyId/>
+ <policies>
+ <snapshots>disabled</snapshots>
+ <releases>once</releases>
+ <checksum>fix</checksum>
+ <cache-failures>cached</cache-failures>
+ </policies>
+ <whiteListPatterns>
+ <whiteListPattern>**/*</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ </proxyConnectors>
+
+ <legacyArtifactPaths>
+ <legacyArtifactPath>
+ <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
+ <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
+ </legacyArtifactPath>
+ </legacyArtifactPaths>
+
+ <repositoryScanning>
+ <fileTypes>
+ <fileType>
+ <id>artifacts</id>
+ <patterns>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.jar</pattern>
+ <pattern>**/*.ear</pattern>
+ <pattern>**/*.war</pattern>
+ <pattern>**/*.car</pattern>
+ <pattern>**/*.sar</pattern>
+ <pattern>**/*.mar</pattern>
+ <pattern>**/*.rar</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ <pattern>**/*.tar.gz</pattern>
+ <pattern>**/*.tar.bz2</pattern>
+ <pattern>**/*.zip</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>indexable-content</id>
+ <patterns>
+ <pattern>**/*.txt</pattern>
+ <pattern>**/*.TXT</pattern>
+ <pattern>**/*.block</pattern>
+ <pattern>**/*.config</pattern>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.xml</pattern>
+ <pattern>**/*.xsd</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>auto-remove</id>
+ <patterns>
+ <pattern>**/*.bak</pattern>
+ <pattern>**/*~</pattern>
+ <pattern>**/*-</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>ignored</id>
+ <patterns>
+ <pattern>**/.htaccess</pattern>
+ <pattern>**/KEYS</pattern>
+ <pattern>**/*.rb</pattern>
+ <pattern>**/*.sh</pattern>
+ <pattern>**/.svn/**</pattern>
+ <pattern>**/.DAV/**</pattern>
+ <pattern>.index/**</pattern>
+ <pattern>.indexer/**</pattern>
+ </patterns>
+ </fileType>
+ </fileTypes>
+ <knownContentConsumers>
+ <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+ <knownContentConsumer>validate-checksum</knownContentConsumer>
+ <knownContentConsumer>validate-signature</knownContentConsumer>
+ <knownContentConsumer>index-content</knownContentConsumer>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ <knownContentConsumer>auto-rename</knownContentConsumer>
+ <knownContentConsumer>metadata-updater</knownContentConsumer>
+ <knownContentConsumer>create-archiva-metadata</knownContentConsumer>
+ <knownContentConsumer>duplicate-artifacts</knownContentConsumer>
+ <!--knownContentConsumer>repository-purge</knownContentConsumer-->
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>true</showFindArtifacts>
+ <appletFindEnabled>true</appletFindEnabled>
+ </ui>
+ </webapp>
+
+ <archivaRuntimeConfiguration>
+ <checksumTypes>
+ <type>MD5</type>
+ <type>SHA1</type>
+ <type>SHA256</type>
+ </checksumTypes>
+ </archivaRuntimeConfiguration>
+
+ <redbackRuntimeConfiguration>
+ <userManagerImpls>
+ <userManagerImpl>jpa</userManagerImpl>
+ </userManagerImpls>
+ <rbacManagerImpls>
+ <rbacManagerImpl>cached</rbacManagerImpl>
+ </rbacManagerImpls>
+ </redbackRuntimeConfiguration>
+
+ <archivaDefaultConfiguration>
+ <defaultCheckPaths>
+ <defaultCheckPath>
+ <url>http://download.oracle.com/maven</url>
+ <path>com/sleepycat/je/license.txt</path>
+ </defaultCheckPath>
+ <defaultCheckPath>
+ <url>https://download.oracle.com/maven</url>
+ <path>com/sleepycat/je/license.txt</path>
+ </defaultCheckPath>
+ </defaultCheckPaths>
+ </archivaDefaultConfiguration>
+
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+ <repositories>
+ <repository>
+ <directory>managed-repository</directory>
+ <id>local</id>
+ <name>local</name>
+ </repository>
+ </repositories>
+ <proxiedRepositories>
+ <proxiedRepository>
+ <url>http://www.ibiblio.org/maven2/</url>
+ <managedRepository>local</managedRepository>
+ <useNetworkProxy>true</useNetworkProxy>
+ <id>ibiblio</id>
+ <name>Ibiblio</name>
+ </proxiedRepository>
+ <proxiedRepository>
+ <url>http://repository.codehaus.org/</url>
+ <managedRepository>local</managedRepository>
+ <id>codehaus</id>
+ <name>Codehaus</name>
+ </proxiedRepository>
+ </proxiedRepositories>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<configuration>
+<version>2</version>
+<repositoryScanning>
+<fileTypes>
+<fileType>
+<id>artifacts</id>
+<patterns>
+<pattern>**/*.pom</pattern>
+<pattern>**/*.jar</pattern>
+<pattern>**/*.ear</pattern>
+<pattern>**/*.war</pattern>
+<pattern>**/*.car</pattern>
+<pattern>**/*.sar</pattern>
+<pattern>**/*.mar</pattern>
+<pattern>**/*.rar</pattern>
+<pattern>**/*.dtd</pattern>
+<pattern>**/*.tld</pattern>
+<pattern>**/*.tar.gz</pattern>
+<pattern>**/*.tar.bz2</pattern>
+<pattern>**/*.zip</pattern>
+</patterns>
+</fileType>
+<fileType>
+<id>indexable-content</id>
+<patterns>
+<pattern>**/*.txt</pattern>
+<pattern>**/*.TXT</pattern>
+<pattern>**/*.block</pattern>
+<pattern>**/*.config</pattern>
+<pattern>**/*.pom</pattern>
+<pattern>**/*.xml</pattern>
+<pattern>**/*.xsd</pattern>
+<pattern>**/*.dtd</pattern>
+<pattern>**/*.tld</pattern>
+</patterns>
+</fileType>
+<fileType>
+<id>auto-remove</id>
+<patterns>
+<pattern>**/*.bak</pattern>
+<pattern>**/*~</pattern>
+<pattern>**/*-</pattern>
+</patterns>
+</fileType>
+<fileType>
+<id>ignored</id>
+<patterns>
+<pattern>**/.htaccess</pattern>
+<pattern>**/KEYS</pattern>
+<pattern>**/*.rb</pattern>
+<pattern>**/*.sh</pattern>
+<pattern>**/.svn/**</pattern>
+<pattern>**/.DAV/**</pattern>
+</patterns>
+</fileType>
+</fileTypes>
+<knownContentConsumers>
+<knownContentConsumer>update-db-artifact</knownContentConsumer>
+<knownContentConsumer>create-missing-checksums</knownContentConsumer>
+<knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+<knownContentConsumer>validate-checksum</knownContentConsumer>
+<knownContentConsumer>validate-signature</knownContentConsumer>
+<knownContentConsumer>index-content</knownContentConsumer>
+<knownContentConsumer>auto-remove</knownContentConsumer>
+<knownContentConsumer>auto-rename</knownContentConsumer>
+<knownContentConsumer>metadata-updater</knownContentConsumer>
+</knownContentConsumers>
+<invalidContentConsumers>
+<invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+</invalidContentConsumers>
+</repositoryScanning>
+<databaseScanning>
+<cronExpression>0 0 * * * ?</cronExpression>
+<unprocessedConsumers>
+<unprocessedConsumer>update-db-project</unprocessedConsumer>
+</unprocessedConsumers>
+<cleanupConsumers>
+<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+<cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+<cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+</cleanupConsumers>
+</databaseScanning>
+<managedRepositories>
+<managedRepository>
+<location>${appserver.base}/data/repositories/internal</location>
+<blockRedeployments>true</blockRedeployments>
+<retentionPeriod>30</retentionPeriod>
+<id>internal</id>
+<name>Archiva Managed Internal Repository</name>
+</managedRepository>
+<managedRepository>
+<location>${appserver.base}/data/repositories/snapshots</location>
+<releases>false</releases>
+<snapshots>true</snapshots>
+<refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
+<retentionPeriod>30</retentionPeriod>
+<id>snapshots</id>
+<name>Archiva Managed Snapshot Repository</name>
+</managedRepository>
+</managedRepositories>
+<remoteRepositories>
+<remoteRepository>
+<url>http://repo1.maven.org/maven2</url>
+<id>central</id>
+<name>Central Repository</name>
+</remoteRepository>
+<remoteRepository>
+<url>http://download.java.net/maven/2/</url>
+<id>maven2-repository.dev.java.net</id>
+<name>Java.net Repository for Maven 2</name>
+</remoteRepository>
+</remoteRepositories>
+<proxyConnectors>
+<proxyConnector>
+<order>1</order>
+<sourceRepoId>internal</sourceRepoId>
+<targetRepoId>central</targetRepoId>
+<proxyId/>
+<whiteListPatterns>
+<whiteListPattern>**/*</whiteListPattern>
+</whiteListPatterns>
+<policies>
+<releases>once</releases>
+<checksum>fix</checksum>
+<snapshots>never</snapshots>
+<cache-failures>yes</cache-failures>
+</policies>
+</proxyConnector>
+<proxyConnector>
+<order>2</order>
+<sourceRepoId>internal</sourceRepoId>
+<targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+<proxyId/>
+<whiteListPatterns>
+<whiteListPattern>javax/**</whiteListPattern>
+<whiteListPattern>org/jvnet/**</whiteListPattern>
+<whiteListPattern>com/sun/**</whiteListPattern>
+</whiteListPatterns>
+<policies>
+<releases>once</releases>
+<checksum>fix</checksum>
+<snapshots>never</snapshots>
+<cache-failures>yes</cache-failures>
+</policies>
+</proxyConnector>
+</proxyConnectors>
+<legacyArtifactPaths>
+<legacyArtifactPath>
+<path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
+<artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
+</legacyArtifactPath>
+</legacyArtifactPaths>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+ <repositories>
+ <repository>
+ <id>internal</id>
+ <name>Archiva Managed Internal Repository</name>
+ <url>file://${appserver.base}/repositories/internal</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <indexed>true</indexed>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ </repository>
+ <repository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <url>file://${appserver.base}/repositories/snapshots</url>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <indexed>false</indexed>
+ <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
+ </repository>
+ <repository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <indexed>false</indexed>
+ </repository>
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>https://maven2-repository.dev.java.net/nonav/repository</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <indexed>false</indexed>
+ </repository>
+ </repositories>
+
+ <proxyConnectors>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>central</targetRepoId>
+ <proxyId/>
+ <snapshotsPolicy>disabled</snapshotsPolicy>
+ <releasePolicy>never</releasePolicy>
+ <failurePolicy>not-found</failurePolicy>
+ </proxyConnector>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+ <proxyId/>
+ <snapshotsPolicy>disabled</snapshotsPolicy>
+ <releasePolicy>never</releasePolicy>
+ <failurePolicy>not-found</failurePolicy>
+ <whiteListPatterns>
+ <whiteListPattern>javax/**</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ </proxyConnectors>
+
+ <networkProxies>
+ <networkProxy>
+ <id>example</id>
+ <protocol>http</protocol>
+ <host>proxy.mycompany.com</host>
+ <port>8080</port>
+ <username>myself</username>
+ <password>mypass</password>
+ </networkProxy>
+ </networkProxies>
+
+ <repositoryScanning>
+ <fileTypes>
+ <fileType>
+ <id>artifacts</id>
+ <patterns>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.jar</pattern>
+ <pattern>**/*.ear</pattern>
+ <pattern>**/*.war</pattern>
+ <pattern>**/*.car</pattern>
+ <pattern>**/*.sar</pattern>
+ <pattern>**/*.mar</pattern>
+ <pattern>**/*.rar</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ <pattern>**/*.tar.gz</pattern>
+ <pattern>**/*.tar.bz2</pattern>
+ <pattern>**/*.zip</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>indexable-content</id>
+ <patterns>
+ <pattern>**/*.txt</pattern>
+ <pattern>**/*.TXT</pattern>
+ <pattern>**/*.block</pattern>
+ <pattern>**/*.config</pattern>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.xml</pattern>
+ <pattern>**/*.xsd</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>auto-remove</id>
+ <patterns>
+ <pattern>**/*.bak</pattern>
+ <pattern>**/*~</pattern>
+ <pattern>**/*-</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>ignored</id>
+ <patterns>
+ <pattern>**/.htaccess</pattern>
+ <pattern>**/KEYS</pattern>
+ <pattern>**/*.rb</pattern>
+ <pattern>**/*.sh</pattern>
+ <pattern>**/.svn/**</pattern>
+ <pattern>**/.DAV/**</pattern>
+ </patterns>
+ </fileType>
+ </fileTypes>
+ <knownContentConsumers>
+ <knownContentConsumer>update-db-artifact</knownContentConsumer>
+ <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+ <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+ <knownContentConsumer>validate-checksum</knownContentConsumer>
+ <knownContentConsumer>validate-signature</knownContentConsumer>
+ <knownContentConsumer>index-content</knownContentConsumer>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ <knownContentConsumer>auto-rename</knownContentConsumer>
+ <knownContentConsumer>metadata-updater</knownContentConsumer>
+ <!--knownContentConsumer>repository-purge</knownContentConsumer-->
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+
+ <databaseScanning>
+ <cronExpression>0 0 * * * ?</cronExpression>
+ <unprocessedConsumers>
+ <unprocessedConsumer>index-artifact</unprocessedConsumer>
+ <unprocessedConsumer>update-db-project</unprocessedConsumer>
+ <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+ <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>true</showFindArtifacts>
+ <appletFindEnabled>true</appletFindEnabled>
+ </ui>
+ </webapp>
+
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+ <repositories>
+ <repository>
+ <id>internal</id>
+ <name>Archiva Managed Internal Repository</name>
+ <url>file://${appserver.base}/repositories/internal</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <indexed>true</indexed>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ </repository>
+ <repository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <url>file:${appserver.base}/repositories/snapshots</url>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <indexed>true</indexed>
+ <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
+ </repository>
+ <repository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <indexed>false</indexed>
+ </repository>
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>https://maven2-repository.dev.java.net/nonav/repository</url>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <indexed>false</indexed>
+ </repository>
+ </repositories>
+
+ <proxyConnectors>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>central</targetRepoId>
+ <proxyId/>
+ <snapshotsPolicy>disabled</snapshotsPolicy>
+ <releasePolicy>never</releasePolicy>
+ <failurePolicy>not-found</failurePolicy>
+ </proxyConnector>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+ <proxyId/>
+ <snapshotsPolicy>disabled</snapshotsPolicy>
+ <releasePolicy>never</releasePolicy>
+ <failurePolicy>not-found</failurePolicy>
+ <whiteListPatterns>
+ <whiteListPattern>javax/**</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ </proxyConnectors>
+
+ <networkProxies>
+ <networkProxy>
+ <id>example</id>
+ <protocol>http</protocol>
+ <host>proxy.mycompany.com</host>
+ <port>8080</port>
+ <username>myself</username>
+ <password>mypass</password>
+ </networkProxy>
+ </networkProxies>
+
+ <repositoryScanning>
+ <fileTypes>
+ <fileType>
+ <id>artifacts</id>
+ <patterns>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.jar</pattern>
+ <pattern>**/*.ear</pattern>
+ <pattern>**/*.war</pattern>
+ <pattern>**/*.car</pattern>
+ <pattern>**/*.sar</pattern>
+ <pattern>**/*.mar</pattern>
+ <pattern>**/*.rar</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ <pattern>**/*.tar.gz</pattern>
+ <pattern>**/*.tar.bz2</pattern>
+ <pattern>**/*.zip</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>indexable-content</id>
+ <patterns>
+ <pattern>**/*.txt</pattern>
+ <pattern>**/*.TXT</pattern>
+ <pattern>**/*.block</pattern>
+ <pattern>**/*.config</pattern>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.xml</pattern>
+ <pattern>**/*.xsd</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>auto-remove</id>
+ <patterns>
+ <pattern>**/*.bak</pattern>
+ <pattern>**/*~</pattern>
+ <pattern>**/*-</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>ignored</id>
+ <patterns>
+ <pattern>**/.htaccess</pattern>
+ <pattern>**/KEYS</pattern>
+ <pattern>**/*.rb</pattern>
+ <pattern>**/*.sh</pattern>
+ <pattern>**/.svn/**</pattern>
+ <pattern>**/.DAV/**</pattern>
+ </patterns>
+ </fileType>
+ </fileTypes>
+ <knownContentConsumers>
+ <knownContentConsumer>update-db-artifact</knownContentConsumer>
+ <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+ <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+ <knownContentConsumer>validate-checksum</knownContentConsumer>
+ <knownContentConsumer>validate-signature</knownContentConsumer>
+ <knownContentConsumer>index-content</knownContentConsumer>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ <knownContentConsumer>auto-rename</knownContentConsumer>
+ <knownContentConsumer>metadata-updater</knownContentConsumer>
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+
+ <databaseScanning>
+ <cronExpression>0 0 * * * ?</cronExpression>
+ <unprocessedConsumers>
+ <unprocessedConsumer>index-artifact</unprocessedConsumer>
+ <unprocessedConsumer>update-db-project</unprocessedConsumer>
+ <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+ <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>true</showFindArtifacts>
+ <appletFindEnabled>true</appletFindEnabled>
+ </ui>
+ </webapp>
+
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+ <version>2</version>
+ <managedRepositories>
+ <managedRepository>
+ <id>internal</id>
+ <name>Archiva Managed Internal Repository</name>
+ <location>${appserver.base}/repositories/internal</location>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ </managedRepository>
+ <managedRepository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <location>${appserver.base}/repositories/snapshots</location>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
+ </managedRepository>
+ </managedRepositories>
+ <remoteRepositories>
+ <remoteRepository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ <layout>default</layout>
+ </remoteRepository>
+ <remoteRepository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>https://maven2-repository.dev.java.net/nonav/repository</url>
+ <layout>default</layout>
+ </remoteRepository>
+ </remoteRepositories>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>false</showFindArtifacts>
+ </ui>
+ </webapp>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+ <version>2</version>
+ <repositoryGroups>
+ <repositoryGroup>
+ <id>default</id>
+ <repositories>
+ <repository>snapshots</repository>
+ </repositories>
+ </repositoryGroup>
+ </repositoryGroups>
+ <managedRepositories>
+ <managedRepository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <location>${appserver.base}/repositories/snapshots</location>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
+ </managedRepository>
+ </managedRepositories>
+ <remoteRepositories>
+ <remoteRepository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ <layout>default</layout>
+ </remoteRepository>
+ </remoteRepositories>
+ <proxyConnectors>
+ <proxyConnector>
+ <order>2</order>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+ <proxyId/>
+ <whiteListPatterns>
+ <whiteListPattern>javax/**</whiteListPattern>
+ </whiteListPatterns>
+ <policies>
+ <releases>once</releases>
+ <checksum>fix</checksum>
+ <snapshots>never</snapshots>
+ <cache-failures>yes</cache-failures>
+ </policies>
+ </proxyConnector>
+ </proxyConnectors>
+ <networkProxies>
+ <networkProxy>
+ <id>proxy</id>
+ <host>proxy</host>
+ <port>8080</port>
+ </networkProxy>
+ </networkProxies>
+ <legacyArtifactPaths>
+ <legacyArtifactPath>
+ <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
+ <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
+ </legacyArtifactPath>
+ </legacyArtifactPaths>
+ <repositoryScanning>
+ <knownContentConsumers>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+ <databaseScanning>
+ <unprocessedConsumers>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<configuration>
+ <version>2</version>
+ <proxyConnectors>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>central</targetRepoId>
+ <proxyId/>
+ <snapshotsPolicy>disabled</snapshotsPolicy>
+ <releasePolicy>never</releasePolicy>
+ <failurePolicy>not-found</failurePolicy>
+ </proxyConnector>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+ <proxyId/>
+ <snapshotsPolicy>disabled</snapshotsPolicy>
+ <releasePolicy>never</releasePolicy>
+ <failurePolicy>not-found</failurePolicy>
+ <whiteListPatterns>
+ <whiteListPattern>javax/**</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ </proxyConnectors>
+
+ <webapp>
+ <ui>
+ <appletFindEnabled>false</appletFindEnabled>
+ </ui>
+ </webapp>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<configuration>
+ <version>2</version>
+ <managedRepositories>
+ <managedRepository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <location>file://${appserver.base}/repositories/internal</location>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
+ </managedRepository>
+ </managedRepositories>
+ <databaseScanning>
+ <cronExpression>0 0 0 * * ?</cronExpression>
+ <unprocessedConsumers>
+ <unprocessedConsumer>index-artifact</unprocessedConsumer>
+ <unprocessedConsumer>update-db-project</unprocessedConsumer>
+ <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+ <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>false</showFindArtifacts>
+ </ui>
+ </webapp>
+</configuration>
--- /dev/null
+################ GLOBAL SETTINGS
+# This is where maven-proxy stores files it has downloaded
+repo.local.store=target
+
+#The port to listen on - not used if loaded as a webapp
+port=9999
+
+#This is the base area that all files are loaded from. While it is possible to leave this blank, this behaviour
+#is deprecated and will be disabled in version 2.0. There are too many namespace conflicts caused by not using
+#a prefix.
+#The repository will be shown at http://localhost:9999/repository/
+#for the .war loaded into a webapp server, the default prefix is "repository" (edit the web.xml to change)
+# As maven doesn't like a trailing slash, this address shouldn't have one either.
+prefix=repository
+
+#This is the simple date format used to display the last modified date while browsing the repository.
+lastModifiedDateFormat=yyyy/MM/dd HH:mm:ss
+
+################ SNAPSHOT HANDLING
+#If you want the proxy to look for newer snapshots, set to true
+snapshot.update=true
+
+################ M2 METADATA HANDLING
+#If you want the proxy to prevent looking for newer metadata, set to false (default is true)
+#metadata.update=false
+
+################ M2 POM HANDLING
+#If you want the proxy to look for newer POMs, set to true (default is false)
+pom.update=true
+
+################ PROMOTION HANDLING
+# ***** NOT CURRENTLY IMPLEMENTED *****
+#Promotion describes the process by which new artifacts are loaded to global maven-proxy repository. It
+# is designed to be used by "higher security installations" that do not want to acquire artifacts from
+# remote repositories without approval.
+#
+#If promotion handling is enabled, then the proxy will not download remote artifacts without permission
+# (local repositories with copy=false are considered to be local)
+#
+#Permission to download is granted via the Promotion menu which will be enabled
+# when promotion handling is enabled.
+#
+#If promotion is false, artifacts are sourced from any repository as per normal.
+#
+#Promotion and snapshots: If promotion is enabled, snapshots are not downloadable. The concept of using
+# a snapshot in a production build (which is primarily what promotion is for) is counterintuitive.
+##
+promotion=false
+
+################ WEB INTERFACE
+# This defines the absolute URL the server should use to identify itself.
+# This can often be determined automatically, but we recommend you specify
+# it explicitly to prevent problems during startup.
+# The prefix will be added to this for the actual repository
+# i.e. proxy available at http://localhost:9999/, repository at http://localhost:9999/repository
+serverName=http://localhost:9999
+
+#If true, the repository can be browsed
+browsable=true
+
+#If true, the repository can be searched
+searchable=true
+
+#Not currently implemented. Will allow webdav access to the repository at some point.
+webdav=true
+
+#Stylesheet - if configured, will override the default stylesheet shipped with maven-proxy - absolute URLs only
+#eg. /maven-proxy/style.css, http://www.example.com/style.css
+stylesheet=/maven-proxy/style.css
+
+#bgColor / bgColorHighlight are replaced in the built in stylesheet to produce a simple color scheme.
+#If a stylesheet is set, these are not used.
+bgColor=#14B
+bgColorHighlight=#94B
+
+#rowColor / rowColorHighlight are replaced in the built in stylesheet to produce a simple color scheme.
+#If a stylesheet is set, these are not used.
+rowColor=#CCF
+rowColorHighlight=#DDF
+
+
+################ PROXIES
+#This is just a hack, it should auto discover them
+proxy.list=one,two,three
+
+#Unauthenticated proxy
+proxy.one.host=proxy1.example.com
+proxy.one.port=3128
+
+#Authenticated proxy
+proxy.two.host=proxy2.example.org
+proxy.two.port=80
+proxy.two.username=username2
+proxy.two.password=password2
+
+#Authenticated proxy
+proxy.three.host=proxy3.example.net
+proxy.three.port=3129
+proxy.three.username=username3
+proxy.three.password=password3
+
+
+################# REPOSITORIES
+#This is not just a hack, it specifies the order repositories should be checked
+#Note that the proxy adds a "/" which is why the urls aren't suffixed with a "/"
+repo.list=local-repo,www-ibiblio-org,dist-codehaus-org,private-example-com
+
+#local-store
+# The local store represents a location that local jars you host can be located.
+# This could also be achieved by having a local http repository, but this is less cumbersome
+repo.local-repo.url=file://target
+repo.local-repo.description=Super Secret Custom Repository
+#If copy is true, jars are copied from the store to the proxy-repo. Only configurable for file:/// repos
+repo.local-repo.copy=false
+#If hardfail is true, any unexpected errors from the repository will cause
+#the client download to fail (typically with a 500 error)
+repo.local-repo.hardfail=true
+#Don't cache a file repository
+repo.local-repo.cache.period=0
+
+
+#www.ibiblio.org
+repo.www-ibiblio-org.url=http://www.ibiblio.org/maven2
+repo.www-ibiblio-org.description=www.ibiblio.org
+repo.www-ibiblio-org.proxy=one
+repo.www-ibiblio-org.hardfail=true
+#Cache this repository for 1 hour
+repo.www-ibiblio-org.cache.period=3600
+repo.www-ibiblio-org.cache.failures=true
+
+#dist.codehaus.org
+repo.dist-codehaus-org.url=http://dist.codehaus.org
+repo.dist-codehaus-org.proxy=two
+repo.dist-codehaus-org.hardfail=false
+repo.dist-codehaus-org.cache.period=3600
+repo.dist-codehaus-org.cache.failures=true
+
+#private.example.com
+repo.private-example-com.url=http://private.example.com/internal
+repo.private-example-com.description=Commercial In Confidence Repository
+repo.private-example-com.username=username1
+repo.private-example-com.password=password1
+repo.private-example-com.proxy=three
+repo.private-example-com.cache.period=3600
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+ <version>2</version>
+ <managedRepositories>
+ <managedRepository>
+ <id>internal</id>
+ <name>Archiva Managed Internal Repository</name>
+ <location>${appserver.base}/repositories/internal</location>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ </managedRepository>
+ <managedRepository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <location>${appserver.base}/repositories/internal</location>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
+ </managedRepository>
+ </managedRepositories>
+ <remoteRepositories>
+ <remoteRepository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ <layout>default</layout>
+ </remoteRepository>
+ <remoteRepository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>https://maven2-repository.dev.java.net/nonav/repository</url>
+ <layout>default</layout>
+ <username></username>
+ <password></password>
+ </remoteRepository>
+ </remoteRepositories>
+
+ <proxyConnectors>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>central</targetRepoId>
+ <proxyId/>
+ <policies>
+ <releases>ignored</releases>
+ <snapshots>disabled</snapshots>
+ <cache-failures>cached</cache-failures>
+ </policies>
+ </proxyConnector>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+ <proxyId/>
+ <policies>
+ <releases>ignored</releases>
+ <snapshots>disabled</snapshots>
+ <cache-failures>cached</cache-failures>
+ </policies>
+ <whiteListPatterns>
+ <whiteListPattern>javax/**</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ </proxyConnectors>
+
+ <networkProxies>
+ <networkProxy>
+ <id>example</id>
+ <protocol>http</protocol>
+ <host>proxy.mycompany.com</host>
+ <port>8080</port>
+ <username>myself</username>
+ <password>mypass</password>
+ </networkProxy>
+ </networkProxies>
+
+ <repositoryScanning>
+ <fileTypes>
+ <fileType>
+ <id>artifacts</id>
+ <patterns>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.jar</pattern>
+ <pattern>**/*.ear</pattern>
+ <pattern>**/*.war</pattern>
+ <pattern>**/*.car</pattern>
+ <pattern>**/*.sar</pattern>
+ <pattern>**/*.mar</pattern>
+ <pattern>**/*.rar</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ <pattern>**/*.tar.gz</pattern>
+ <pattern>**/*.tar.bz2</pattern>
+ <pattern>**/*.zip</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>indexable-content</id>
+ <patterns>
+ <pattern>**/*.txt</pattern>
+ <pattern>**/*.TXT</pattern>
+ <pattern>**/*.block</pattern>
+ <pattern>**/*.config</pattern>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.xml</pattern>
+ <pattern>**/*.xsd</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>auto-remove</id>
+ <patterns>
+ <pattern>**/*.bak</pattern>
+ <pattern>**/*~</pattern>
+ <pattern>**/*-</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>ignored</id>
+ <patterns>
+ <pattern>**/.htaccess</pattern>
+ <pattern>**/KEYS</pattern>
+ <pattern>**/*.rb</pattern>
+ <pattern>**/*.sh</pattern>
+ <pattern>**/.svn/**</pattern>
+ <pattern>**/.DAV/**</pattern>
+ </patterns>
+ </fileType>
+ </fileTypes>
+ <knownContentConsumers>
+ <knownContentConsumer>update-db-artifact</knownContentConsumer>
+ <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+ <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+ <knownContentConsumer>validate-checksum</knownContentConsumer>
+ <knownContentConsumer>validate-signature</knownContentConsumer>
+ <knownContentConsumer>index-content</knownContentConsumer>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ <knownContentConsumer>auto-rename</knownContentConsumer>
+ <knownContentConsumer>metadata-updater</knownContentConsumer>
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+
+ <databaseScanning>
+ <cronExpression>0 0 * * * ?</cronExpression>
+ <unprocessedConsumers>
+ <unprocessedConsumer>index-artifact</unprocessedConsumer>
+ <unprocessedConsumer>update-db-project</unprocessedConsumer>
+ <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+ <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>true</showFindArtifacts>
+ <appletFindEnabled>true</appletFindEnabled>
+ </ui>
+ </webapp>
+
+</configuration>
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.model.UserInterfaceOptions;
+import org.apache.archiva.configuration.model.WebappConfiguration;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test the configuration store.
+ */
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+public class ArchivaConfigurationMRM789Test
+{
+
+ private static String FILE_ENCODING = "UTF-8";
+
+ @Inject
+ protected ApplicationContext applicationContext;
+
+ @Inject
+ FileTypes filetypes;
+
+ public static Path getTestFile( String path )
+ {
+ return Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), path );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ protected <T> T lookup( Class<T> clazz, String hint )
+ {
+ return (T) applicationContext.getBean( "archivaConfiguration#" + hint, ArchivaConfiguration.class );
+ }
+
+ // test for [MRM-789]
+ @Test
+ public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting()
+ throws Exception
+ {
+ Path repo = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-classes/existing_snapshots" );
+ Files.createDirectories(repo);
+
+ repo = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-classes/existing_internal" );
+ Files.createDirectories(repo);
+
+ String existingTestDefaultArchivaConfigFile = FileUtils.readFileToString(
+ getTestFile( "target/test-classes/org/apache/archiva/configuration/test-default-archiva.xml" ).toFile(), FILE_ENCODING );
+ existingTestDefaultArchivaConfigFile =
+ StringUtils.replace( existingTestDefaultArchivaConfigFile, "${appserver.base}", org.apache.archiva.common.utils.FileUtils.getBasedir() );
+
+ Path generatedTestDefaultArchivaConfigFile = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(),
+ "target/test-classes/org/apache/archiva/configuration/default-archiva.xml" );
+
+ FileUtils.writeStringToFile( generatedTestDefaultArchivaConfigFile.toFile(), existingTestDefaultArchivaConfigFile,
+ Charset.forName(FILE_ENCODING) );
+
+ ArchivaConfiguration archivaConfiguration =
+ lookup( ArchivaConfiguration.class, "test-defaults-default-repo-location-exists" );
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertConfiguration( configuration, 2, 2, 2 );
+
+ ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+ assertTrue( "check managed repositories", repository.getLocation().endsWith( "data/repositories/internal" ) );
+
+ Files.deleteIfExists(generatedTestDefaultArchivaConfigFile);
+ assertFalse( Files.exists(generatedTestDefaultArchivaConfigFile) );
+ }
+
+
+ /**
+ * Ensures that the provided configuration matches the details present in the archiva-default.xml file.
+ */
+ private void assertConfiguration( Configuration configuration, int managedExpected, int remoteExpected,
+ int proxyConnectorExpected )
+ throws Exception
+ {
+
+ assertEquals( "check managed repositories: " + configuration.getManagedRepositories(), managedExpected,
+ configuration.getManagedRepositories().size() );
+ assertEquals( "check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected,
+ configuration.getRemoteRepositories().size() );
+ assertEquals( "check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected,
+ configuration.getProxyConnectors().size() );
+
+ RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
+ assertNotNull( "check repository scanning", repoScanning );
+ assertEquals( "check file types", 4, repoScanning.getFileTypes().size() );
+ assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers().size() );
+ assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() );
+
+ List<String> patterns = filetypes.getFileTypePatterns( "artifacts" );
+ assertNotNull( "check 'artifacts' file type", patterns );
+ assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
+
+ WebappConfiguration webapp = configuration.getWebapp();
+ assertNotNull( "check webapp", webapp );
+
+ UserInterfaceOptions ui = webapp.getUi();
+ assertNotNull( "check webapp ui", ui );
+ assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts() );
+ assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled() );
+ }
+
+
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.components.registry.RegistryException;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.LegacyArtifactPath;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.model.UserInterfaceOptions;
+import org.apache.archiva.configuration.model.WebappConfiguration;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+/**
+ * Test the configuration store.
+ */
+@RunWith(ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
+@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+public class ArchivaConfigurationTest
+{
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject
+ protected ApplicationContext applicationContext;
+
+ @Inject
+ FileTypes filetypes;
+
+ public static Path getTestFile( String path )
+ {
+ return Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), path );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ protected <T> T lookup( Class<T> clazz, String hint )
+ {
+ return (T) applicationContext.getBean( "archivaConfiguration#" + hint, ArchivaConfiguration.class );
+ }
+
+ @Test
+ public void testGetConfigurationFromDefaults()
+ throws Exception
+ {
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-defaults" );
+ Configuration configuration = archivaConfiguration.getConfiguration();
+
+ assertConfiguration( configuration, 2, 1, 1 );
+ assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
+
+ ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+
+ assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
+ repository.getLocation() );
+ assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
+ assertEquals( "check managed repositories", "internal", repository.getId() );
+ assertEquals( "check managed repositories", "default", repository.getLayout() );
+ assertTrue( "check managed repositories", repository.isScanned() );
+ }
+
+ @Test
+ public void testGetConfigurationFromRegistryWithASingleNamedConfigurationResource()
+ throws Exception
+ {
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertConfiguration( configuration, 2, 2, 2 );
+ assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() );
+
+ ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+
+ assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
+ repository.getLocation() );
+ assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
+ assertEquals( "check managed repositories", "internal", repository.getId() );
+ assertEquals( "check managed repositories", "default", repository.getLayout() );
+ assertTrue( "check managed repositories", repository.isScanned() );
+ }
+
+ /**
+ * Ensures that the provided configuration matches the details present in the archiva-default.xml file.
+ */
+ private void assertConfiguration( Configuration configuration, int managedExpected, int remoteExpected,
+ int proxyConnectorExpected )
+ throws Exception
+ {
+
+ assertEquals( "check managed repositories: " + configuration.getManagedRepositories(), managedExpected,
+ configuration.getManagedRepositories().size() );
+ assertEquals( "check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected,
+ configuration.getRemoteRepositories().size() );
+ assertEquals( "check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected,
+ configuration.getProxyConnectors().size() );
+
+ RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
+ assertNotNull( "check repository scanning", repoScanning );
+ assertEquals( "check file types", 4, repoScanning.getFileTypes().size() );
+ assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers().size() );
+ assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() );
+
+ List<String> patterns = filetypes.getFileTypePatterns( "artifacts" );
+ assertNotNull( "check 'artifacts' file type", patterns );
+ assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
+
+ WebappConfiguration webapp = configuration.getWebapp();
+ assertNotNull( "check webapp", webapp );
+
+ UserInterfaceOptions ui = webapp.getUi();
+ assertNotNull( "check webapp ui", ui );
+ assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts() );
+ assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled() );
+ }
+
+ @Test
+ public void testGetConfigurationFromRegistryWithTwoConfigurationResources()
+ throws Exception
+ {
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration-both" );
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+
+ // from base
+ assertEquals( "check repositories", 2, configuration.getManagedRepositories().size() );
+ assertEquals( "check repositories", 2, configuration.getRemoteRepositories().size() );
+ // from user
+ assertEquals( "check proxy connectors", 2, configuration.getProxyConnectors().size() );
+
+ WebappConfiguration webapp = configuration.getWebapp();
+ assertNotNull( "check webapp", webapp );
+
+ UserInterfaceOptions ui = webapp.getUi();
+ assertNotNull( "check webapp ui", ui );
+ // from base
+ assertFalse( "check showFindArtifacts", ui.isShowFindArtifacts() );
+ // from user
+ assertFalse( "check appletFindEnabled", ui.isAppletFindEnabled() );
+ }
+
+ @Test
+ public void testGetConfigurationSystemOverride()
+ throws Exception
+ {
+
+ System.setProperty( "org.apache.archiva.webapp.ui.appletFindEnabled", "false" );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
+
+ archivaConfiguration.reload();
+
+ try
+ {
+ Configuration configuration = archivaConfiguration.getConfiguration();
+
+ assertFalse( "check boolean", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+ finally
+ {
+ System.getProperties().remove( "org.apache.archiva.webapp.ui.appletFindEnabled" );
+ archivaConfiguration.reload();
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertTrue( "check boolean", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+ }
+
+ @Test
+ public void testStoreConfiguration()
+ throws Exception
+ {
+ Path file = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(file);
+ assertFalse( Files.exists(file) );
+
+ // TODO: remove with commons-configuration 1.4
+ //file.getParentFile().mkdirs();
+ //FileUtils.writeStringToFile( file, "<configuration/>", null );
+
+ DefaultArchivaConfiguration archivaConfiguration =
+ (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = new Configuration();
+ configuration.setVersion( "1" );
+ configuration.setWebapp( new WebappConfiguration() );
+ configuration.getWebapp().setUi( new UserInterfaceOptions() );
+ configuration.getWebapp().getUi().setAppletFindEnabled( false );
+
+ // add a change listener
+ ConfigurationListener listener = mock( ConfigurationListener.class );
+ archivaConfiguration.addListener( listener );
+
+ listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
+
+ archivaConfiguration.save( configuration );
+
+ assertTrue( "Check file exists", Files.exists(file) );
+
+ // check it
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+
+ // read it back
+ archivaConfiguration = (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-read-saved" );
+
+ archivaConfiguration.reload();
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+
+ private static ConfigurationListener createConfigurationListenerMockControl()
+ {
+ return mock( ConfigurationListener.class );// MockControl.createControl( ConfigurationListener.class );
+ }
+
+ @Test
+ public void testStoreConfigurationUser()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists( baseFile );
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists( userFile );
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories(userFile.getParent());
+ FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
+
+ Configuration configuration = new Configuration();
+ configuration.setWebapp( new WebappConfiguration() );
+ configuration.getWebapp().setUi( new UserInterfaceOptions() );
+ configuration.getWebapp().getUi().setAppletFindEnabled( false );
+
+ archivaConfiguration.save( configuration );
+
+ assertTrue( "Check file exists", Files.exists(userFile) );
+ assertFalse( "Check file not created", Files.exists(baseFile) );
+
+ // check it
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+
+ @Test
+ public void testStoreConfigurationLoadedFromDefaults()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.delete(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user-defaults" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = new Configuration();
+ configuration.setWebapp( new WebappConfiguration() );
+ configuration.getWebapp().setUi( new UserInterfaceOptions() );
+ configuration.getWebapp().getUi().setAppletFindEnabled( false );
+
+ // add a change listener
+ ConfigurationListener listener = createConfigurationListenerMockControl();
+ archivaConfiguration.addListener( listener );
+
+ listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
+
+ archivaConfiguration.save( configuration );
+
+ assertTrue( "Check file exists", Files.exists(userFile) );
+ assertFalse( "Check file not created", Files.exists(baseFile) );
+
+ // check it
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+
+ @Test
+ public void testDefaultUserConfigFilename()
+ throws Exception
+ {
+ DefaultArchivaConfiguration archivaConfiguration =
+ (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "default" );
+ String expectedFile = System.getProperty( "user.home" ) + "/.m2/archiva.xml";
+ String systemFile = System.getProperty(ArchivaConfiguration.USER_CONFIG_PROPERTY);
+ if (StringUtils.isNotEmpty( systemFile )) {
+ expectedFile = systemFile;
+ } else
+ {
+ String envFile = System.getenv( ArchivaConfiguration.USER_CONFIG_ENVVAR );
+ if ( StringUtils.isNotEmpty( envFile ) )
+ expectedFile = envFile;
+ }
+
+ archivaConfiguration.reload();
+
+ assertEquals( expectedFile,
+ archivaConfiguration.getUserConfigFilename() );
+ assertEquals( System.getProperty( "appserver.base", "${appserver.base}" ) + "/conf/archiva.xml",
+ archivaConfiguration.getAltConfigFilename() );
+ }
+
+ @Test
+ public void testStoreConfigurationFallback()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories( baseFile.getParent());
+ FileUtils.writeStringToFile( baseFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ ArchivaConfiguration archivaConfiguration =
+ (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user-fallback" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = new Configuration();
+ configuration.setWebapp( new WebappConfiguration() );
+ configuration.getWebapp().setUi( new UserInterfaceOptions() );
+ configuration.getWebapp().getUi().setAppletFindEnabled( false );
+
+ archivaConfiguration.save( configuration );
+
+ assertTrue( "Check file exists", Files.exists(baseFile) );
+ assertFalse( "Check file not created", Files.exists(userFile) );
+
+ // check it
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+
+ @Test
+ public void testStoreConfigurationFailsWhenReadFromBothLocationsNoLists()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories( baseFile.getParent() );
+ FileUtils.writeStringToFile( baseFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ Files.createDirectories( userFile.getParent());
+ FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+
+ configuration.getWebapp().getUi().setAppletFindEnabled( false );
+
+ archivaConfiguration.save( configuration );
+
+ assertTrue( "Check file exists", Files.exists(baseFile) );
+ assertEquals( "Check base file is unchanged", "<configuration/>",
+ FileUtils.readFileToString( baseFile.toFile(), Charset.forName( "UTF-8" ) ) );
+ assertTrue( "Check file exists", Files.exists(userFile) );
+ assertFalse( "Check base file is changed",
+ "<configuration/>".equals( FileUtils.readFileToString( userFile.toFile(), Charset.forName( "UTF-8" ) ) ) );
+
+ // check it
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+
+ @Test
+ public void testStoreConfigurationFailsWhenReadFromBothLocationsUserHasLists()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories( userFile.getParent() );
+ FileUtils.copyFile( getTestFile( "src/test/conf/conf-user.xml" ).toFile(), userFile.toFile() );
+
+ Files.createDirectories(baseFile.getParent());
+ FileUtils.writeStringToFile( baseFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertTrue( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() );
+
+ configuration.getWebapp().getUi().setShowFindArtifacts( false );
+
+ archivaConfiguration.save( configuration );
+
+ assertTrue( "Check file exists", Files.exists(baseFile) );
+ assertEquals( "Check base file is unchanged", "<configuration/>",
+ FileUtils.readFileToString( baseFile.toFile(), Charset.forName( "UTF-8" ) ) );
+ assertTrue( "Check file exists", Files.exists(userFile) );
+ assertFalse( "Check base file is changed",
+ "<configuration/>".equals( FileUtils.readFileToString( userFile.toFile(), Charset.forName( "UTF-8" ) ) ) );
+
+ // check it
+ configuration = archivaConfiguration.getConfiguration();
+ assertFalse( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() );
+ }
+
+ @Test
+ public void testStoreConfigurationFailsWhenReadFromBothLocationsAppserverHasLists()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories(baseFile.getParent());
+ FileUtils.copyFile( getTestFile( "src/test/conf/conf-base.xml" ).toFile(), baseFile.toFile() );
+
+ Files.createDirectories(userFile.getParent());
+ FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+
+ configuration.getWebapp().getUi().setAppletFindEnabled( false );
+
+ try
+ {
+ archivaConfiguration.save( configuration );
+ fail( "Configuration saving should not succeed if it was loaded from two locations" );
+ }
+ catch ( IndeterminateConfigurationException e )
+ {
+ // check it was reverted
+ configuration = archivaConfiguration.getConfiguration();
+ assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+ }
+ }
+
+ @Test
+ public void testLoadConfigurationFromInvalidBothLocationsOnDisk()
+ throws Exception
+ {
+ String propFile = System.getProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY );
+ System.setProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY, "/../../..//*intentionally:invalid*/.m2/archiva-user.xml" );
+ ArchivaConfiguration archivaConfiguration =
+ lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-both" );
+ Configuration config = archivaConfiguration.getConfiguration();
+
+ try
+ {
+ archivaConfiguration.save( config );
+ fail( "Should have thrown a RegistryException because the configuration can't be saved." );
+ }
+ catch ( RegistryException e )
+ {
+ /* expected exception */
+ }
+ if (propFile!=null)
+ {
+ System.setProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY, propFile );
+ }
+ }
+
+ @Test
+ public void testLoadConfigurationFromInvalidUserLocationOnDisk()
+ throws Exception
+ {
+ Path testConfDir = getTestFile( "target/test-appserver-base/conf/" );
+ Files.createDirectories( testConfDir );
+
+ ArchivaConfiguration archivaConfiguration =
+ lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-user" );
+ Configuration config = archivaConfiguration.getConfiguration();
+ archivaConfiguration.save( config );
+ // No Exception == test passes.
+ // Expected Path is: Should not have thrown an exception.
+ }
+
+
+ @Test
+ public void testConfigurationUpgradeFrom13()
+ throws Exception
+ {
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-upgrade-1.3" );
+
+ // we just use the defaults when upgrading from 1.3 at this point.
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertConfiguration( configuration, 2, 2, 2 );
+ assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
+
+ ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+
+ assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal",
+ repository.getLocation() );
+ assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
+ assertEquals( "check managed repositories", "internal", repository.getId() );
+ assertEquals( "check managed repositories", "default", repository.getLayout() );
+ assertTrue( "check managed repositories", repository.isScanned() );
+
+ log.info( "knowContentConsumers {}", configuration.getRepositoryScanning().getKnownContentConsumers() );
+
+ assertFalse(
+ configuration.getRepositoryScanning().getKnownContentConsumers().contains( "update-db-artifact" ) );
+ assertFalse( configuration.getRepositoryScanning().getKnownContentConsumers().contains(
+ "update-db-repository-metadata" ) );
+
+ assertTrue(
+ configuration.getRepositoryScanning().getKnownContentConsumers().contains( "create-archiva-metadata" ) );
+
+ assertTrue(
+ configuration.getRepositoryScanning().getKnownContentConsumers().contains( "duplicate-artifacts" ) );
+ }
+
+
+ @Test
+ public void testCronExpressionsWithComma()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories(baseFile.getParent());
+ FileUtils.copyFile( getTestFile( "src/test/conf/escape-cron-expressions.xml" ).toFile(), baseFile.toFile() );
+
+ Files.createDirectories(userFile.getParent());
+ FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.defaultCharset() );
+
+ final ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-cron-expressions" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+
+ ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+
+ assertEquals( "check cron expression", "0 0,30 * * * ?", repository.getRefreshCronExpression().trim() );
+
+ // add a test listener to confirm it doesn't see the escaped format. We don't need to test the number of calls,
+ // etc. as it's done in other tests
+ archivaConfiguration.addListener( new ConfigurationListener()
+ {
+ @Override
+ public void configurationEvent( ConfigurationEvent event )
+ {
+ assertEquals( ConfigurationEvent.SAVED, event.getType() );
+
+ }
+ } );
+
+ archivaConfiguration.save( configuration );
+
+ configuration = archivaConfiguration.getConfiguration();
+
+ // test for the escape character '\' showing up on repositories.jsp
+ repository.setRefreshCronExpression( "0 0,20 0 * * ?" );
+
+ archivaConfiguration.save( configuration );
+
+ repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( "snapshots" );
+
+ assertEquals( "check cron expression", "0 0,20 0 * * ?", repository.getRefreshCronExpression() );
+ }
+
+ @Test
+ public void testRemoveLastElements()
+ throws Exception
+ {
+ Path baseFile = getTestFile( "target/test/test-file.xml" );
+ Files.deleteIfExists(baseFile);
+ assertFalse( Files.exists(baseFile) );
+
+ Path userFile = getTestFile( "target/test/test-file-user.xml" );
+ Files.deleteIfExists(userFile);
+ assertFalse( Files.exists(userFile) );
+
+ Files.createDirectories( baseFile.getParent() );
+ FileUtils.copyFile( getTestFile( "src/test/conf/conf-single-list-elements.xml" ).toFile(), baseFile.toFile() );
+
+ Files.createDirectories( userFile.getParent());
+ FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
+
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-remove-central" );
+
+ archivaConfiguration.reload();
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+
+ RepositoryGroupConfiguration repositoryGroup = configuration.getRepositoryGroups().get( 0 );
+ assertNotNull( repositoryGroup );
+ configuration.removeRepositoryGroup( repositoryGroup );
+ assertTrue( configuration.getRepositoryGroups().isEmpty() );
+
+ RemoteRepositoryConfiguration repository = configuration.getRemoteRepositoriesAsMap().get( "central" );
+ assertNotNull( repository );
+ configuration.removeRemoteRepository( repository );
+ assertTrue( configuration.getRemoteRepositories().isEmpty() );
+
+ ManagedRepositoryConfiguration managedRepository =
+ configuration.getManagedRepositoriesAsMap().get( "snapshots" );
+ assertNotNull( managedRepository );
+ configuration.removeManagedRepository( managedRepository );
+ assertTrue( configuration.getManagedRepositories().isEmpty() );
+
+ ProxyConnectorConfiguration proxyConnector = configuration.getProxyConnectors().get( 0 );
+ assertNotNull( proxyConnector );
+ configuration.removeProxyConnector( proxyConnector );
+ assertTrue( configuration.getProxyConnectors().isEmpty() );
+
+ NetworkProxyConfiguration networkProxy = configuration.getNetworkProxiesAsMap().get( "proxy" );
+ assertNotNull( networkProxy );
+ configuration.removeNetworkProxy( networkProxy );
+ assertTrue( configuration.getNetworkProxies().isEmpty() );
+
+ LegacyArtifactPath path = configuration.getLegacyArtifactPaths().get( 0 );
+ assertNotNull( path );
+ configuration.removeLegacyArtifactPath( path );
+ assertTrue( configuration.getLegacyArtifactPaths().isEmpty() );
+
+ RepositoryScanningConfiguration scanning = configuration.getRepositoryScanning();
+ String consumer = scanning.getKnownContentConsumers().get( 0 );
+ assertNotNull( consumer );
+ scanning.removeKnownContentConsumer( consumer );
+ // default values
+ assertFalse( scanning.getKnownContentConsumers().isEmpty() );
+ consumer = scanning.getInvalidContentConsumers().get( 0 );
+ assertNotNull( consumer );
+ scanning.removeInvalidContentConsumer( consumer );
+ assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
+
+ archivaConfiguration.save( configuration );
+
+ archivaConfiguration = lookup( ArchivaConfiguration.class, "test-read-saved" );
+ configuration = archivaConfiguration.getConfiguration();
+ assertNull( configuration.getRemoteRepositoriesAsMap().get( "central" ) );
+ assertTrue( configuration.getRepositoryGroups().isEmpty() );
+ assertNull( configuration.getManagedRepositoriesAsMap().get( "snapshots" ) );
+ assertTrue( configuration.getProxyConnectors().isEmpty() );
+ assertNull( configuration.getNetworkProxiesAsMap().get( "proxy" ) );
+ assertTrue( configuration.getLegacyArtifactPaths().isEmpty() );
+ scanning = configuration.getRepositoryScanning();
+ assertFalse( scanning.getKnownContentConsumers().isEmpty() );
+ assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
+ }
+
+ /**
+ * [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
+ */
+ @Test
+ public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword()
+ throws Exception
+ {
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
+
+ Configuration configuration = archivaConfiguration.getConfiguration();
+ assertConfiguration( configuration, 2, 2, 2 );
+ assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories().size() );
+
+ RemoteRepositoryConfiguration repository =
+ configuration.getRemoteRepositoriesAsMap().get( "maven2-repository.dev.java.net" );
+
+ assertEquals( "remote repository.url", "https://maven2-repository.dev.java.net/nonav/repository",
+ repository.getUrl() );
+ assertEquals( "remote repository.name", "Java.net Repository for Maven 2", repository.getName() );
+ assertEquals( "remote repository.id", "maven2-repository.dev.java.net", repository.getId() );
+ assertEquals( "remote repository.layout", "default", repository.getLayout() );
+ assertNull( "remote repository.username == null", repository.getUsername() );
+ assertNull( "remote repository.password == null", repository.getPassword() );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test the generated Configuration class from Modello. This is primarily to test the hand coded methods.
+ */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
+public class ConfigurationTest
+{
+ private Configuration configuration = new Configuration();
+
+ @Test
+ public void testNetworkProxyRetrieval()
+ {
+ NetworkProxyConfiguration proxy1 = createNetworkProxy( "id1", "host1", 8080 );
+ configuration.addNetworkProxy( proxy1 );
+ NetworkProxyConfiguration proxy2 = createNetworkProxy( "id2", "host2", 9090 );
+ configuration.addNetworkProxy( proxy2 );
+
+ Map<String, NetworkProxyConfiguration> map = configuration.getNetworkProxiesAsMap();
+ assertNotNull( map );
+ assertEquals( 2, map.size() );
+ assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() );
+ assertEquals( new HashSet<NetworkProxyConfiguration>( Arrays.asList( proxy1, proxy2 ) ),
+ new HashSet<NetworkProxyConfiguration>( map.values() ) );
+ }
+
+ private NetworkProxyConfiguration createNetworkProxy( String id, String host, int port )
+ {
+ NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
+ proxy.setId( id );
+ proxy.setHost( host );
+ proxy.setPort( port );
+ proxy.setProtocol( "http" );
+ return proxy;
+ }
+
+ @Test
+ public void testRemoteRepositoryRetrieval()
+ {
+ RemoteRepositoryConfiguration repo1 = createRemoteRepository( "id1", "name 1", "url 1" );
+ configuration.addRemoteRepository( repo1 );
+ RemoteRepositoryConfiguration repo2 = createRemoteRepository( "id2", "name 2", "url 2" );
+ configuration.addRemoteRepository( repo2 );
+
+ Map<String, RemoteRepositoryConfiguration> map = configuration.getRemoteRepositoriesAsMap();
+ assertNotNull( map );
+ assertEquals( 2, map.size() );
+ assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() );
+ assertEquals( new HashSet<RemoteRepositoryConfiguration>( Arrays.asList( repo1, repo2 ) ),
+ new HashSet<RemoteRepositoryConfiguration>( map.values() ) );
+
+ assertEquals( repo1, configuration.findRemoteRepositoryById( "id1" ) );
+ assertEquals( repo2, configuration.findRemoteRepositoryById( "id2" ) );
+ assertNull( configuration.findRemoteRepositoryById( "id3" ) );
+ }
+
+ private RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+ {
+ RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLayout( "default" );
+ repo.setUrl( url );
+ return repo;
+ }
+
+ @Test
+ public void testManagedRepositoryRetrieval()
+ {
+ ManagedRepositoryConfiguration repo1 = createManagedRepository( "id1", "name 1", "path 1", false );
+ configuration.addManagedRepository( repo1 );
+ ManagedRepositoryConfiguration repo2 = createManagedRepository( "id2", "name 2", "path 2", true );
+ configuration.addManagedRepository( repo2 );
+
+ Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap();
+ assertNotNull( map );
+ assertEquals( 2, map.size() );
+ assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() );
+ assertEquals( new HashSet<ManagedRepositoryConfiguration>( Arrays.asList( repo1, repo2 ) ),
+ new HashSet<ManagedRepositoryConfiguration>( map.values() ) );
+
+ assertEquals( repo1, configuration.findManagedRepositoryById( "id1" ) );
+ assertEquals( repo2, configuration.findManagedRepositoryById( "id2" ) );
+ assertNull( configuration.findManagedRepositoryById( "id3" ) );
+ }
+
+ private ManagedRepositoryConfiguration createManagedRepository( String id, String name, String location,
+ boolean scanned )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( location );
+ repo.setScanned( scanned );
+ return repo;
+ }
+
+ @Test
+ public void testNetworkProxyRetrievalWhenEmpty()
+ {
+ Map<String, NetworkProxyConfiguration> map = configuration.getNetworkProxiesAsMap();
+ assertNotNull( map );
+ assertTrue( map.isEmpty() );
+ }
+
+ @Test
+ public void testRemoteRepositoryRetrievalWhenEmpty()
+ {
+ Map<String, RemoteRepositoryConfiguration> map = configuration.getRemoteRepositoriesAsMap();
+ assertNotNull( map );
+ assertTrue( map.isEmpty() );
+
+ assertNull( configuration.findRemoteRepositoryById( "id" ) );
+ }
+
+ @Test
+ public void testManagedRepositoryRetrievalWhenEmpty()
+ {
+ Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap();
+ assertNotNull( map );
+ assertTrue( map.isEmpty() );
+
+ assertNull( configuration.findManagedRepositoryById( "id" ) );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
+public class FileTypesTest
+{
+ @Inject
+ private FileTypes filetypes;
+
+ @Test
+ public void testIsArtifact()
+ {
+ assertTrue( filetypes.matchesArtifactPattern( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) );
+ assertTrue( filetypes.matchesArtifactPattern(
+ "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) );
+ assertTrue( filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) );
+
+ assertFalse(
+ filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.sha1" ) );
+ assertFalse(
+ filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.md5" ) );
+ assertFalse(
+ filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.asc" ) );
+ assertFalse(
+ filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.pgp" ) );
+ assertFalse( filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/maven-metadata.xml" ) );
+ assertFalse( filetypes.matchesArtifactPattern( "org/apache/derby/derby/maven-metadata.xml" ) );
+ }
+
+ @Test
+ public void testDefaultExclusions()
+ {
+ assertTrue( filetypes.matchesDefaultExclusions( "repository/test/.index/nexus-maven-repository-index.gz" ) );
+ assertTrue( filetypes.matchesDefaultExclusions( "repository/test/.index/nexus-maven-repository-index.zip" ) );
+ assertTrue( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.sha1" ) );
+ assertTrue( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.md5" ) );
+ assertTrue( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/maven-metadata.xml" ) );
+ assertTrue( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/maven-metadata.xml.sha1" ) );
+ assertTrue( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/maven-metadata.xml.md5" ) );
+
+ assertFalse( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.zip" ) );
+ assertFalse( filetypes.matchesDefaultExclusions(
+ "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.LegacyArtifactPath;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.
+ *
+ * @since 1.1
+ */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
+public class LegacyArtifactPathTest
+{
+
+ private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();
+
+ @Test
+ public void testLegacyArtifactPathWithClassifierResolution()
+ {
+ legacyArtifactPath.setArtifact( "groupId:artifactId:version:classifier:type" );
+
+ assertEquals( "groupId", legacyArtifactPath.getGroupId() );
+ assertEquals( "artifactId", legacyArtifactPath.getArtifactId() );
+ assertEquals( "version", legacyArtifactPath.getVersion() );
+ assertEquals( "classifier", legacyArtifactPath.getClassifier() );
+ assertEquals( "type", legacyArtifactPath.getType() );
+ }
+
+ @Test
+ public void testLegacyArtifactPathWithoutClassifierResolution()
+ {
+ legacyArtifactPath.setArtifact( "groupId:artifactId:version::type" );
+
+ assertEquals( "groupId", legacyArtifactPath.getGroupId() );
+ assertEquals( "artifactId", legacyArtifactPath.getArtifactId() );
+ assertEquals( "version", legacyArtifactPath.getVersion() );
+ assertNull( legacyArtifactPath.getClassifier() );
+ assertEquals( "type", legacyArtifactPath.getType() );
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
+public class MavenProxyPropertyLoaderTest
+{
+ private MavenProxyPropertyLoader loader;
+
+ @Test
+ public void testLoadValidMavenProxyConfiguration()
+ throws IOException, InvalidConfigurationException
+ {
+ Path confFile = ArchivaConfigurationTest.getTestFile( "src/test/conf/maven-proxy-complete.conf" );
+
+ Configuration configuration = new Configuration();
+ NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
+ proxy.setHost( "original-host" );
+ configuration.addNetworkProxy( proxy ); // overwritten
+
+ loader.load( Files.newInputStream(confFile), configuration );
+
+ Map<String, ManagedRepositoryConfiguration> repositoryIdMap = configuration.getManagedRepositoriesAsMap();
+ assertEquals( "Count repositories", 1, repositoryIdMap.size() );
+ assertRepositoryExists( "maven-proxy", "target", repositoryIdMap.get( "maven-proxy" ) );
+
+ Map<String, RemoteRepositoryConfiguration> remoteRepositoryMap = configuration.getRemoteRepositoriesAsMap();
+ assertEquals( "Count repositories", 4, remoteRepositoryMap.size() );
+ assertRepositoryExists( "local-repo", "file://target", remoteRepositoryMap.get( "local-repo" ) );
+ assertRepositoryExists( "www-ibiblio-org", "http://www.ibiblio.org/maven2",
+ remoteRepositoryMap.get( "www-ibiblio-org" ) );
+ assertRepositoryExists( "dist-codehaus-org", "http://dist.codehaus.org",
+ remoteRepositoryMap.get( "dist-codehaus-org" ) );
+ assertRepositoryExists( "private-example-com", "http://private.example.com/internal",
+ remoteRepositoryMap.get( "private-example-com" ) );
+ }
+
+ private void assertRepositoryExists( String id, String expectedLocation, ManagedRepositoryConfiguration repo )
+ {
+ assertNotNull( "Repository id [" + id + "] should not be null", repo );
+ assertEquals( "Repository id", id, repo.getId() );
+ assertEquals( "Repository url", expectedLocation, repo.getLocation() );
+ }
+
+ private void assertRepositoryExists( String id, String expectedUrl, RemoteRepositoryConfiguration repo )
+ {
+ assertNotNull( "Repository id [" + id + "] should not be null", repo );
+ assertEquals( "Repository id", id, repo.getId() );
+ assertEquals( "Repository url", expectedUrl, repo.getUrl() );
+ }
+
+ @Test( expected=InvalidConfigurationException.class )
+ public void testInvalidConfiguration()
+ throws InvalidConfigurationException
+ {
+ Configuration configuration = new Configuration();
+ loader.load( new Properties(), configuration );
+ //fail( "Incomplete config should have failed" );
+ }
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ loader = new MavenProxyPropertyLoader();
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.functors.ProxyConnectorConfigurationOrderComparator;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * ProxyConnectorConfigurationOrderComparatorTest
+ *
+ *
+ */
+@SuppressWarnings( "deprecation" )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
+public class ProxyConnectorConfigurationOrderComparatorTest
+{
+ @Test
+ public void testSortOfAllZeros()
+ {
+ List<ProxyConnectorConfiguration> proxies = new ArrayList<>();
+
+ proxies.add( createConnector( "corporate", 0 ) );
+ proxies.add( createConnector( "snapshots", 0 ) );
+ proxies.add( createConnector( "3rdparty", 0 ) );
+ proxies.add( createConnector( "sandbox", 0 ) );
+
+ Collections.sort( proxies, ProxyConnectorConfigurationOrderComparator.getInstance() );
+
+ assertProxyOrder( new String[]{ "corporate", "snapshots", "3rdparty", "sandbox" }, proxies );
+ }
+
+ @Test
+ public void testSortNormal()
+ {
+ List<ProxyConnectorConfiguration> proxies = new ArrayList<>();
+
+ proxies.add( createConnector( "corporate", 3 ) );
+ proxies.add( createConnector( "snapshots", 1 ) );
+ proxies.add( createConnector( "3rdparty", 2 ) );
+ proxies.add( createConnector( "sandbox", 4 ) );
+
+ Collections.sort( proxies, new ProxyConnectorConfigurationOrderComparator() );
+
+ assertProxyOrder( new String[]{ "snapshots", "3rdparty", "corporate", "sandbox" }, proxies );
+ }
+
+ @Test
+ public void testSortPartial()
+ {
+ List<ProxyConnectorConfiguration> proxies = new ArrayList<>();
+
+ proxies.add( createConnector( "corporate", 3 ) );
+ proxies.add( createConnector( "snapshots", 0 ) );
+ proxies.add( createConnector( "3rdparty", 2 ) );
+ proxies.add( createConnector( "sandbox", 0 ) );
+
+ Collections.sort( proxies, new ProxyConnectorConfigurationOrderComparator() );
+
+ assertProxyOrder( new String[]{ "3rdparty", "corporate", "snapshots", "sandbox" }, proxies );
+ }
+
+ private void assertProxyOrder( String[] ids, List<ProxyConnectorConfiguration> proxies )
+ {
+ assertEquals( "Proxies.size() == ids.length", ids.length, proxies.size() );
+
+ int orderFailedAt = -1;
+
+ for ( int i = 0; i < ids.length; i++ )
+ {
+ if ( !StringUtils.equals( ids[i], proxies.get( i ).getProxyId() ) )
+ {
+ orderFailedAt = i;
+ break;
+ }
+ }
+
+ if ( orderFailedAt >= 0 )
+ {
+ StringBuilder msg = new StringBuilder();
+
+ msg.append( "Failed expected order of the proxies <" );
+ msg.append( StringUtils.join( ids, ", " ) );
+ msg.append( ">, actual <" );
+
+ boolean needsComma = false;
+ for ( ProxyConnectorConfiguration proxy : proxies )
+ {
+ if ( needsComma )
+ {
+ msg.append( ", " );
+ }
+ msg.append( proxy.getProxyId() );
+ needsComma = true;
+ }
+ msg.append( "> failure at index <" ).append( orderFailedAt ).append( ">." );
+
+ fail( msg.toString() );
+ }
+ }
+
+ private ProxyConnectorConfiguration createConnector( String id, int order )
+ {
+ ProxyConnectorConfiguration proxy = new ProxyConnectorConfiguration();
+ proxy.setProxyId( id );
+ proxy.setOrder( order );
+ proxy.setSourceRepoId( id + "_m" );
+ proxy.setTargetRepoId( id + "_r" );
+
+ return proxy;
+ }
+}
--- /dev/null
+package org.apache.archiva.configuration.provider.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.functors.RepositoryConfigurationComparator;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Comparator;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Test the repositry comparator.
+ */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
+public class RepositoryConfigurationComparatorTest
+{
+ @Test
+ public void testComparator()
+ {
+ Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator();
+
+ assertEquals( 0, comparator.compare( null, null ) );
+ assertEquals( 1, comparator.compare( createRepository( "id" ), null ) );
+ assertEquals( -1, comparator.compare( null, createRepository( "id" ) ) );
+ assertEquals( 0, comparator.compare( createRepository( "id1" ), createRepository( "id1" ) ) );
+ assertEquals( -1, comparator.compare( createRepository( "id1" ), createRepository( "id2" ) ) );
+ assertEquals( 1, comparator.compare( createRepository( "id2" ), createRepository( "id1" ) ) );
+ }
+
+ private ManagedRepositoryConfiguration createRepository( String id )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ return repo;
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<configuration>
+ <Properties>
+
+ </Properties>
+ <appenders>
+ <Console name="console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{ISO8601_PERIOD} [%L] [%t] %-5level %logger{3} - %msg%n"/>
+ </Console>
+ <!--
+ <RandomAccessFile name="LogFile" fileName="target/test.log">
+ <PatternLayout pattern="%d{ISO8601_PERIOD} [%L] [%t] %-5level %logger{3} - %msg%n"/>
+ </RandomAccessFile>
+ -->
+ </appenders>
+ <loggers>
+ <logger name="org.apache.archiva" level="info"/>
+ <logger name="org.apache.archiva.repository.scanner" level="info"/>
+ <root level="error" includeLocation="true">
+ <appender-ref ref="console"/>
+ </root>
+ </loggers>
+</configuration>
--- /dev/null
+<configuration>
+ <version>3.0.0</version>
+ <managedRepositories>
+ <managedRepository>
+ <id>internal</id>
+ <name>Archiva Managed Internal Repository</name>
+ <location>${appserver.base}/target/test-classes/existing_internal</location>
+ <layout>default</layout>
+ <releases>true</releases>
+ <snapshots>false</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
+ <retentionPeriod>30</retentionPeriod>
+ </managedRepository>
+ <managedRepository>
+ <id>snapshots</id>
+ <name>Archiva Managed Snapshot Repository</name>
+ <location>${appserver.base}/target/test-classes/existing_snapshots</location>
+ <layout>default</layout>
+ <releases>false</releases>
+ <snapshots>true</snapshots>
+ <scanned>true</scanned>
+ <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
+ <retentionPeriod>30</retentionPeriod>
+ </managedRepository>
+ </managedRepositories>
+ <remoteRepositories>
+ <remoteRepository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ <layout>default</layout>
+ </remoteRepository>
+ <remoteRepository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>http://download.java.net/maven/2/</url>
+ <layout>default</layout>
+ </remoteRepository>
+ </remoteRepositories>
+
+ <proxyConnectors>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>central</targetRepoId>
+ <proxyId/>
+ <policies>
+ <snapshots>disabled</snapshots>
+ <releases>once</releases>
+ <checksum>fix</checksum>
+ <cache-failures>cached</cache-failures>
+ </policies>
+ <whiteListPatterns>
+ <whiteListPattern>**/*</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ <proxyConnector>
+ <sourceRepoId>internal</sourceRepoId>
+ <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+ <proxyId/>
+ <policies>
+ <snapshots>disabled</snapshots>
+ <releases>once</releases>
+ <checksum>fix</checksum>
+ <cache-failures>cached</cache-failures>
+ </policies>
+ <whiteListPatterns>
+ <whiteListPattern>javax/**</whiteListPattern>
+ <whiteListPattern>org/jvnet/**</whiteListPattern>
+ <whiteListPattern>com/sun/**</whiteListPattern>
+ </whiteListPatterns>
+ </proxyConnector>
+ </proxyConnectors>
+
+ <legacyArtifactPaths>
+ <legacyArtifactPath>
+ <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
+ <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
+ </legacyArtifactPath>
+ </legacyArtifactPaths>
+
+ <repositoryScanning>
+ <fileTypes>
+ <fileType>
+ <id>artifacts</id>
+ <patterns>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.jar</pattern>
+ <pattern>**/*.ear</pattern>
+ <pattern>**/*.war</pattern>
+ <pattern>**/*.car</pattern>
+ <pattern>**/*.sar</pattern>
+ <pattern>**/*.mar</pattern>
+ <pattern>**/*.rar</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ <pattern>**/*.tar.gz</pattern>
+ <pattern>**/*.tar.bz2</pattern>
+ <pattern>**/*.zip</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>indexable-content</id>
+ <patterns>
+ <pattern>**/*.txt</pattern>
+ <pattern>**/*.TXT</pattern>
+ <pattern>**/*.block</pattern>
+ <pattern>**/*.config</pattern>
+ <pattern>**/*.pom</pattern>
+ <pattern>**/*.xml</pattern>
+ <pattern>**/*.xsd</pattern>
+ <pattern>**/*.dtd</pattern>
+ <pattern>**/*.tld</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>auto-remove</id>
+ <patterns>
+ <pattern>**/*.bak</pattern>
+ <pattern>**/*~</pattern>
+ <pattern>**/*-</pattern>
+ </patterns>
+ </fileType>
+ <fileType>
+ <id>ignored</id>
+ <patterns>
+ <pattern>**/.htaccess</pattern>
+ <pattern>**/KEYS</pattern>
+ <pattern>**/*.rb</pattern>
+ <pattern>**/*.sh</pattern>
+ <pattern>**/.svn/**</pattern>
+ <pattern>**/.DAV/**</pattern>
+ </patterns>
+ </fileType>
+ </fileTypes>
+ <knownContentConsumers>
+ <knownContentConsumer>update-db-artifact</knownContentConsumer>
+ <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+ <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+ <knownContentConsumer>validate-checksum</knownContentConsumer>
+ <knownContentConsumer>validate-signature</knownContentConsumer>
+ <knownContentConsumer>index-content</knownContentConsumer>
+ <knownContentConsumer>auto-remove</knownContentConsumer>
+ <knownContentConsumer>auto-rename</knownContentConsumer>
+ <knownContentConsumer>metadata-updater</knownContentConsumer>
+ <!--knownContentConsumer>repository-purge</knownContentConsumer-->
+ </knownContentConsumers>
+ <invalidContentConsumers>
+ <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+ </invalidContentConsumers>
+ </repositoryScanning>
+
+ <databaseScanning>
+ <cronExpression>0 0 * * * ?</cronExpression>
+ <unprocessedConsumers>
+ <unprocessedConsumer>index-artifact</unprocessedConsumer>
+ <unprocessedConsumer>update-db-project</unprocessedConsumer>
+ <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+ <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+ <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+ <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+ </unprocessedConsumers>
+ <cleanupConsumers>
+ <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+ <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+ </cleanupConsumers>
+ </databaseScanning>
+
+ <webapp>
+ <ui>
+ <showFindArtifacts>true</showFindArtifacts>
+ <appletFindEnabled>true</appletFindEnabled>
+ </ui>
+ </webapp>
+</configuration>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <context:property-placeholder system-properties-mode="OVERRIDE"/>
+
+ <bean name="archivaConfiguration#test-defaults-default-repo-location-exists" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#empty"/>
+ </bean>
+ <bean name="registry#empty" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"/>
+
+ <bean name="archivaConfiguration#test-defaults" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#emptydef"/>
+ </bean>
+ <bean name="registry#emptydef" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"/>
+
+ <bean name="archivaConfiguration#test-upgrade-09" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-upgrade-09"/>
+ </bean>
+
+
+
+ <bean name="registry#test-upgrade-09" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/src/test/conf/archiva-0.9.xml"
+ config-name="org.apache.archiva" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-upgrade-1.3" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-upgrade-1.3"/>
+ </bean>
+
+ <bean name="registry#test-upgrade-1.3" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/src/test/conf/archiva-1.3.xml"
+ config-name="org.apache.archiva" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-configuration" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#configured"/>
+ </bean>
+
+ <bean name="registry#configured" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <xml fileName="${basedir}/src/test/conf/repository-manager.xml"
+ config-name="org.apache.archiva" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+
+ <bean name="archivaConfiguration#test-autodetect-v1" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-autodetect-v1"/>
+ </bean>
+
+ <bean name="registry#test-autodetect-v1" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <xml fileName="${basedir}/target/test-autodetect-v1/archiva-user.xml" config-optional="true"
+ config-name="org.apache.archiva.user"
+ config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-archiva-v1" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-archiva-v1"/>
+ </bean>
+
+ <bean name="registry#test-archiva-v1" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <xml fileName="${basedir}/src/test/conf/archiva-v1.xml"
+ config-name="org.apache.archiva" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-save" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-save"/>
+ </bean>
+
+ <bean name="registry#test-save" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-save-user-defaults" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-save-user-defaults"/>
+ </bean>
+
+ <bean name="registry#test-save-user-defaults" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="false"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-save-user-fallback" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-save-user-fallback"/>
+ </bean>
+
+ <bean name="registry#test-save-user-fallback" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="false"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-save-user" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-save-user"/>
+ </bean>
+
+ <bean name="registry#test-save-user" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="false"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+
+ <bean name="archivaConfiguration#test-configuration-both" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-configuration-both"/>
+ </bean>
+
+ <bean name="registry#test-configuration-both" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/src/test/conf/conf-user.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ <xml fileName="${basedir}/src/test/conf/conf-base.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+
+ <bean name="archivaConfiguration#test-read-saved" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-read-saved"/>
+ </bean>
+
+ <bean name="registry#test-read-saved" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+
+ <bean name="archivaConfiguration#test-cron-expressions" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-cron-expressions"/>
+ <property name="userConfigFilename" value="${basedir}/target/test/test-file.xml"/>
+ </bean>
+
+ <bean name="registry#test-cron-expressions" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+
+ <bean name="archivaConfiguration#test-remove-central" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-remove-central"/>
+ </bean>
+
+ <bean name="registry#test-remove-central" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
+ config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+
+ <bean name="archivaConfiguration#test-not-allowed-to-write-to-both" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-not-allowed-to-write-to-both"/>
+ <property name="userConfigFilename" value="/../../..//target/*intentionally:invalid*/.m2/archiva-user.xml"/>
+ <property name="altConfigFilename" value="/../../..//target/*intentionally:invalid*/conf/archiva.xml"/>
+ </bean>
+
+ <bean name="registry#test-not-allowed-to-write-to-both" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="/../../..//*intentionally:invalid*/.m2/archiva-user.xml" config-optional="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ <xml fileName="/../../..//*intentionally:invalid*/conf/archiva.xml" config-optional="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="archivaConfiguration#test-not-allowed-to-write-to-user" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
+ <property name="registry" ref="registry#test-not-allowed-to-write-to-user"/>
+ <property name="userConfigFilename" value="${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml"/>
+ <property name="altConfigFilename" value="${basedir}/target/test-appserver-base/conf/archiva.xml"/>
+ </bean>
+
+ <bean name="registry#test-not-allowed-to-write-to-user" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="initialConfiguration">
+ <value>
+ <![CDATA[
+ <configuration>
+ <xml fileName="${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml" config-optional="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ <xml fileName="${basedir}/target/test-appserver-base/conf/archiva.xml" config-optional="true"
+ config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache">
+ <constructor-arg index="0" value="java.lang.String"/>
+ <constructor-arg index="1" value="java.util.Date"/>
+ <property name="diskExpiryThreadIntervalSeconds" value="600"/>
+ <property name="diskPersistent" value="false"/>
+ <property name="eternal" value="false"/>
+ <property name="maxElementsInMemory" value="1000"/>
+ <property name="memoryEvictionPolicy" value="LRU"/>
+ <property name="name" value="url-failures-cache"/>
+ <property name="overflowToDisk" value="false"/>
+ <property name="timeToIdleSeconds" value="2700"/>
+ <property name="timeToLiveSeconds" value="1800"/>
+ </bean>
+
+</beans>
\ No newline at end of file
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.archiva.configuration</groupId>
<artifactId>archiva-configuration</artifactId>
<name>Archiva Base :: Configuration</name>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
<properties>
<site.staging.base>${project.parent.parent.basedir}</site.staging.base>
</properties>
+ <modules>
+ <module>archiva-configuration-model</module>
+ <module>archiva-configuration-provider</module>
+ </modules>
<dependencies>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-policies</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva.components.registry</groupId>
- <artifactId>archiva-components-spring-registry-api</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva.components.registry</groupId>
- <artifactId>archiva-components-spring-registry-commons</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva.components</groupId>
- <artifactId>archiva-components-expression-evaluator</artifactId>
- </dependency>
-
- <dependency>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>jakarta.inject</groupId>
- <artifactId>jakarta.inject-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-configuration2</artifactId>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- </dependency>
-
-
- <!-- Test scope -->
-
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-test-utils</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-jcl</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <basedir>${basedir}</basedir>
- </systemPropertyVariables>
- <trimStackTrace>false</trimStackTrace>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>src/main/resources/org/apache/archiva/configuration/default-archiva.xml</exclude>
- <exclude>src/test/conf/maven-proxy-complete.conf</exclude>
- <exclude>src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml</exclude>
- <exclude>nbactions.xml</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
</project>
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class AbstractRepositoryConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class AbstractRepositoryConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The repository identifier.
- *
- */
- private String id;
-
- /**
- *
- * The repository type. Currently only MAVEN type
- * is known.
- *
- */
- private String type = "MAVEN";
-
- /**
- *
- * The descriptive name of the repository.
- *
- */
- private String name;
-
- /**
- *
- * The layout of the repository. Valid values are
- * "default" and "legacy".
- *
- */
- private String layout = "default";
-
- /**
- *
- * The directory for the indexes of this
- * repository.
- *
- */
- private String indexDir = "";
-
- /**
- *
- * The directory for the packed indexes of this
- * repository.
- *
- */
- private String packedIndexDir = "";
-
- /**
- *
- * The description of this repository.
- *
- */
- private String description = "";
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the description of this repository.
- *
- * @return String
- */
- public String getDescription()
- {
- return this.description;
- } //-- String getDescription()
-
- /**
- * Get the repository identifier.
- *
- * @return String
- */
- public String getId()
- {
- return this.id;
- } //-- String getId()
-
- /**
- * Get the directory for the indexes of this repository.
- *
- * @return String
- */
- public String getIndexDir()
- {
- return this.indexDir;
- } //-- String getIndexDir()
-
- /**
- * Get the layout of the repository. Valid values are "default"
- * and "legacy".
- *
- * @return String
- */
- public String getLayout()
- {
- return this.layout;
- } //-- String getLayout()
-
- /**
- * Get the descriptive name of the repository.
- *
- * @return String
- */
- public String getName()
- {
- return this.name;
- } //-- String getName()
-
- /**
- * Get the directory for the packed indexes of this repository.
- *
- * @return String
- */
- public String getPackedIndexDir()
- {
- return this.packedIndexDir;
- } //-- String getPackedIndexDir()
-
- /**
- * Get the repository type. Currently only MAVEN type is known.
- *
- * @return String
- */
- public String getType()
- {
- return this.type;
- } //-- String getType()
-
- /**
- * Set the description of this repository.
- *
- * @param description
- */
- public void setDescription( String description )
- {
- this.description = description;
- } //-- void setDescription( String )
-
- /**
- * Set the repository identifier.
- *
- * @param id
- */
- public void setId( String id )
- {
- this.id = id;
- } //-- void setId( String )
-
- /**
- * Set the directory for the indexes of this repository.
- *
- * @param indexDir
- */
- public void setIndexDir( String indexDir )
- {
- this.indexDir = indexDir;
- } //-- void setIndexDir( String )
-
- /**
- * Set the layout of the repository. Valid values are "default"
- * and "legacy".
- *
- * @param layout
- */
- public void setLayout( String layout )
- {
- this.layout = layout;
- } //-- void setLayout( String )
-
- /**
- * Set the descriptive name of the repository.
- *
- * @param name
- */
- public void setName( String name )
- {
- this.name = name;
- } //-- void setName( String )
-
- /**
- * Set the directory for the packed indexes of this repository.
- *
- * @param packedIndexDir
- */
- public void setPackedIndexDir( String packedIndexDir )
- {
- this.packedIndexDir = packedIndexDir;
- } //-- void setPackedIndexDir( String )
-
- /**
- * Set the repository type. Currently only MAVEN type is known.
- *
- * @param type
- */
- public void setType( String type )
- {
- this.type = type;
- } //-- void setType( String )
-
-
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + ( id != null ? id.hashCode() : 0 );
- return result;
- }
-
- public boolean equals( Object other )
- {
- if ( this == other )
- {
- return true;
- }
-
- if ( !( other instanceof AbstractRepositoryConfiguration ) )
- {
- return false;
- }
-
- AbstractRepositoryConfiguration that = (AbstractRepositoryConfiguration) other;
- boolean result = true;
- result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
- return result;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class AbstractRepositoryConnectorConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class AbstractRepositoryConnectorConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The Repository Source for this connector.
- *
- */
- private String sourceRepoId;
-
- /**
- *
- * The Repository Target for this connector.
- *
- */
- private String targetRepoId;
-
- /**
- *
- * The network proxy ID to use for this connector.
- *
- */
- private String proxyId;
-
- /**
- * Field blackListPatterns.
- */
- private java.util.List<String> blackListPatterns;
-
- /**
- * Field whiteListPatterns.
- */
- private java.util.List<String> whiteListPatterns;
-
- /**
- * Field policies.
- */
- private java.util.Map policies;
-
- /**
- * Field properties.
- */
- private java.util.Map properties;
-
- /**
- *
- * If the the repository proxy connector is
- * disabled or not
- * .
- */
- private boolean disabled = false;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addBlackListPattern.
- *
- * @param string
- */
- public void addBlackListPattern( String string )
- {
- getBlackListPatterns().add( string );
- } //-- void addBlackListPattern( String )
-
- /**
- * Method addPolicy.
- *
- * @param key
- * @param value
- */
- public void addPolicy( String key, String value )
- {
- getPolicies().put( key, value );
- } //-- void addPolicy( Object, String )
-
- /**
- * Method addProperty.
- *
- * @param key
- * @param value
- */
- public void addProperty( String key, String value )
- {
- getProperties().put( key, value );
- } //-- void addProperty( Object, String )
-
- /**
- * Method addWhiteListPattern.
- *
- * @param string
- */
- public void addWhiteListPattern( String string )
- {
- getWhiteListPatterns().add( string );
- } //-- void addWhiteListPattern( String )
-
- /**
- * Method getBlackListPatterns.
- *
- * @return List
- */
- public java.util.List<String> getBlackListPatterns()
- {
- if ( this.blackListPatterns == null )
- {
- this.blackListPatterns = new java.util.ArrayList<String>();
- }
-
- return this.blackListPatterns;
- } //-- java.util.List<String> getBlackListPatterns()
-
- /**
- * Method getPolicies.
- *
- * @return Map
- */
- public java.util.Map<String, String> getPolicies()
- {
- if ( this.policies == null )
- {
- this.policies = new java.util.HashMap();
- }
-
- return this.policies;
- } //-- java.util.Map getPolicies()
-
- /**
- * Method getProperties.
- *
- * @return Map
- */
- public java.util.Map<String, String> getProperties()
- {
- if ( this.properties == null )
- {
- this.properties = new java.util.HashMap();
- }
-
- return this.properties;
- } //-- java.util.Map getProperties()
-
- /**
- * Get the network proxy ID to use for this connector.
- *
- * @return String
- */
- public String getProxyId()
- {
- return this.proxyId;
- } //-- String getProxyId()
-
- /**
- * Get the Repository Source for this connector.
- *
- * @return String
- */
- public String getSourceRepoId()
- {
- return this.sourceRepoId;
- } //-- String getSourceRepoId()
-
- /**
- * Get the Repository Target for this connector.
- *
- * @return String
- */
- public String getTargetRepoId()
- {
- return this.targetRepoId;
- } //-- String getTargetRepoId()
-
- /**
- * Method getWhiteListPatterns.
- *
- * @return List
- */
- public java.util.List<String> getWhiteListPatterns()
- {
- if ( this.whiteListPatterns == null )
- {
- this.whiteListPatterns = new java.util.ArrayList<String>();
- }
-
- return this.whiteListPatterns;
- } //-- java.util.List<String> getWhiteListPatterns()
-
- /**
- * Get if the the repository proxy connector is disabled or
- * not.
- *
- * @return boolean
- */
- public boolean isDisabled()
- {
- return this.disabled;
- } //-- boolean isDisabled()
-
- /**
- * Method removeBlackListPattern.
- *
- * @param string
- */
- public void removeBlackListPattern( String string )
- {
- getBlackListPatterns().remove( string );
- } //-- void removeBlackListPattern( String )
-
- /**
- * Method removeWhiteListPattern.
- *
- * @param string
- */
- public void removeWhiteListPattern( String string )
- {
- getWhiteListPatterns().remove( string );
- } //-- void removeWhiteListPattern( String )
-
- /**
- * Set the list of blacklisted patterns for this connector.
- *
- * @param blackListPatterns
- */
- public void setBlackListPatterns( java.util.List<String> blackListPatterns )
- {
- this.blackListPatterns = blackListPatterns;
- } //-- void setBlackListPatterns( java.util.List )
-
- /**
- * Set if the the repository proxy connector is disabled or
- * not.
- *
- * @param disabled
- */
- public void setDisabled( boolean disabled )
- {
- this.disabled = disabled;
- } //-- void setDisabled( boolean )
-
- /**
- * Set policy configuration for the connector.
- *
- * @param policies
- */
- public void setPolicies( java.util.Map policies )
- {
- this.policies = policies;
- } //-- void setPolicies( java.util.Map )
-
- /**
- * Set configuration for the connector.
- *
- * @param properties
- */
- public void setProperties( java.util.Map properties )
- {
- this.properties = properties;
- } //-- void setProperties( java.util.Map )
-
- /**
- * Set the network proxy ID to use for this connector.
- *
- * @param proxyId
- */
- public void setProxyId( String proxyId )
- {
- this.proxyId = proxyId;
- } //-- void setProxyId( String )
-
- /**
- * Set the Repository Source for this connector.
- *
- * @param sourceRepoId
- */
- public void setSourceRepoId( String sourceRepoId )
- {
- this.sourceRepoId = sourceRepoId;
- } //-- void setSourceRepoId( String )
-
- /**
- * Set the Repository Target for this connector.
- *
- * @param targetRepoId
- */
- public void setTargetRepoId( String targetRepoId )
- {
- this.targetRepoId = targetRepoId;
- } //-- void setTargetRepoId( String )
-
- /**
- * Set the list of whitelisted patterns for this connector.
- *
- * @param whiteListPatterns
- */
- public void setWhiteListPatterns( java.util.List<String> whiteListPatterns )
- {
- this.whiteListPatterns = whiteListPatterns;
- } //-- void setWhiteListPatterns( java.util.List )
-
-
- /**
- * Obtain a specific policy from the underlying connector.
- *
- * @param policyId the policy id to fetch.
- * @param defaultValue the default value for the policy id.
- * @return the configured policy value (or default value if not found).
- */
- public String getPolicy( String policyId, String defaultValue )
- {
- if ( this.getPolicies() == null )
- {
- return null;
- }
-
- Object value = this.getPolicies().get( policyId );
-
- if ( value == null )
- {
- return defaultValue;
- }
-
- return (String) value;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.components.registry.Registry;
-import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.components.registry.RegistryListener;
-
-import java.nio.file.Path;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Configuration holder for the model read from the registry.
- */
-public interface ArchivaConfiguration
-{
-
-
- String USER_CONFIG_PROPERTY = "archiva.user.configFileName";
- String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE";
-
- /**
- * Get the configuration.
- *
- * @return the configuration
- */
- Configuration getConfiguration();
-
- /**
- * Save any updated configuration.
- *
- * @param configuration the configuration to save
- * @throws org.apache.archiva.components.registry.RegistryException
- * if there is a problem saving the registry data
- * @throws IndeterminateConfigurationException
- * if the configuration cannot be saved because it was read from two sources
- */
- void save( Configuration configuration )
- throws RegistryException, IndeterminateConfigurationException;
-
- /**
- * Save any updated configuration. This method allows to add a tag to the thrown event.
- * This allows to verify the origin if the caller is the same as the listener.
- *
- * @param configuration the configuration to save
- * @param eventTag the tag to add to the thrown event
- * @throws org.apache.archiva.components.registry.RegistryException
- * if there is a problem saving the registry data
- * @throws IndeterminateConfigurationException
- * if the configuration cannot be saved because it was read from two sources
- */
- void save( Configuration configuration, String eventTag )
- throws RegistryException, IndeterminateConfigurationException;
-
- /**
- * Determines if the configuration in use was as a result of a defaulted configuration.
- *
- * @return true if the configuration was created from the default-archiva.xml as opposed
- * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
- * ${appserver.base}/conf/archiva.xml
- */
- boolean isDefaulted();
-
- /**
- * Add a configuration listener to notify of changes to the configuration.
- *
- * @param listener the listener
- */
- void addListener( ConfigurationListener listener );
-
- /**
- * Remove a configuration listener to stop notifications of changes to the configuration.
- *
- * @param listener the listener
- */
- void removeListener( ConfigurationListener listener );
-
- /**
- * Add a registry listener to notify of events in spring-registry.
- *
- * @param listener the listener
- * TODO: Remove in future.
- */
- void addChangeListener( RegistryListener listener );
-
- void removeChangeListener( RegistryListener listener );
-
- /**
- * reload configuration from file included registry
- *
- * @since 1.4-M1
- */
- void reload();
-
- public Locale getDefaultLocale();
-
- public List<Locale.LanguageRange> getLanguagePriorities();
-
- public Path getAppServerBaseDir();
-
- /**
- * Returns the base directory for repositories that have a relative location path set.
- * @return
- */
- public Path getRepositoryBaseDir();
-
- /**
- * Returns the base directory for remote repositories
- * @return
- */
- public Path getRemoteRepositoryBaseDir();
-
- /**
- * Returns the base directory for repository group files.
- * @return
- */
- public Path getRepositoryGroupBaseDir();
-
- /**
- * Returns the data directory where repositories and metadata reside
- * @return
- */
- public Path getDataDirectory();
-
- /**
- * Return the used configuration registry
- * @return
- */
- Registry getRegistry( );
-}
-
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * Archiva default settings.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class ArchivaDefaultConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field defaultCheckPaths.
- */
- private java.util.List<RepositoryCheckPath> defaultCheckPaths;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addDefaultCheckPath.
- *
- * @param repositoryCheckPath
- */
- public void addDefaultCheckPath( RepositoryCheckPath repositoryCheckPath )
- {
- getDefaultCheckPaths().add( repositoryCheckPath );
- } //-- void addDefaultCheckPath( RepositoryCheckPath )
-
- /**
- * Method getDefaultCheckPaths.
- *
- * @return List
- */
- public java.util.List<RepositoryCheckPath> getDefaultCheckPaths()
- {
- if ( this.defaultCheckPaths == null )
- {
- this.defaultCheckPaths = new java.util.ArrayList<RepositoryCheckPath>();
- }
-
- return this.defaultCheckPaths;
- } //-- java.util.List<RepositoryCheckPath> getDefaultCheckPaths()
-
- /**
- * Method removeDefaultCheckPath.
- *
- * @param repositoryCheckPath
- */
- public void removeDefaultCheckPath( RepositoryCheckPath repositoryCheckPath )
- {
- getDefaultCheckPaths().remove( repositoryCheckPath );
- } //-- void removeDefaultCheckPath( RepositoryCheckPath )
-
- /**
- * Set the default check paths for certain remote repositories.
- *
- * @param defaultCheckPaths
- */
- public void setDefaultCheckPaths( java.util.List<RepositoryCheckPath> defaultCheckPaths )
- {
- this.defaultCheckPaths = defaultCheckPaths;
- } //-- void setDefaultCheckPaths( java.util.List )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- *
- * The runtime configuration.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class ArchivaRuntimeConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * the url failure cache configuration.
- */
- private CacheConfiguration urlFailureCacheConfiguration;
-
- /**
- * the FileLocking configuration.
- */
- private FileLockConfiguration fileLockConfiguration;
-
- /**
- * The base directory where the archiva data is stored. If not
- * set, the appserver.base is used.
- */
- private String dataDirectory;
-
- /**
- * The base directory for local storage of repository data. If
- * not set, it's ${dataDirectory}/repositories.
- */
- private String repositoryBaseDirectory;
-
- /**
- * The base directory for local storage of remote repository
- * data. If not set, it's ${dataDirectory}/remotes.
- */
- private String remoteRepositoryBaseDirectory;
-
- /**
- * The base directory for local storage of repository group files.
- * If not set, it's ${dataDirectory}/groups
- */
- private String repositoryGroupBaseDirectory;
-
- /**
- * The default language used for setting internationalized
- * strings.
- */
- private String defaultLanguage = "en-US";
-
- /**
- * Comma separated list of language patterns. Sorted by
- * priority descending. Used for display of internationalized
- * strings.
- */
- private String languageRange = "en,fr,de";
-
- /**
- * List of checksum types (algorithms) that should be applied to repository artifacts.
- */
- private List<String> checksumTypes = new ArrayList(Arrays.asList("MD5","SHA1","SHA256"));
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the base directory where the archiva data is stored. If
- * not set, the appserver.base is used.
- *
- * @return String
- */
- public String getDataDirectory()
- {
- return this.dataDirectory;
- } //-- String getDataDirectory()
-
- /**
- * Get the default language used for setting internationalized
- * strings.
- *
- * @return String
- */
- public String getDefaultLanguage()
- {
- return this.defaultLanguage;
- } //-- String getDefaultLanguage()
-
- /**
- * Get the FileLocking configuration.
- *
- * @return FileLockConfiguration
- */
- public FileLockConfiguration getFileLockConfiguration()
- {
- return this.fileLockConfiguration;
- } //-- FileLockConfiguration getFileLockConfiguration()
-
- /**
- * Get comma separated list of language patterns. Sorted by
- * priority descending. Used for display of internationalized
- * strings.
- *
- * @return String
- */
- public String getLanguageRange()
- {
- return this.languageRange;
- } //-- String getLanguageRange()
-
- /**
- * Get the base directory for local storage of remote
- * repository data. If not set, it's ${dataDirectory}/remotes.
- *
- * @return String
- */
- public String getRemoteRepositoryBaseDirectory()
- {
- return this.remoteRepositoryBaseDirectory;
- } //-- String getRemoteRepositoryBaseDirectory()
-
- /**
- * Get the base directory for local storage of repository data.
- * If not set, it's ${dataDirectory}/repositories.
- *
- * @return String
- */
- public String getRepositoryBaseDirectory()
- {
- return this.repositoryBaseDirectory;
- } //-- String getRepositoryBaseDirectory()
-
- /**
- * Get the base directory for local storage of repository group data.
- * If not set it's ${dataDirectory}/groups
- *
- * @return The path to the directory. Either a absolute path, or a path
- * relative to ${dataDirectory}
- */
- public String getRepositoryGroupBaseDirectory() {
- return this.repositoryGroupBaseDirectory;
- }
-
- /**
- * Get the url failure cache configuration.
- *
- * @return CacheConfiguration
- */
- public CacheConfiguration getUrlFailureCacheConfiguration()
- {
- return this.urlFailureCacheConfiguration;
- } //-- CacheConfiguration getUrlFailureCacheConfiguration()
-
- /**
- * Set the base directory where the archiva data is stored. If
- * not set, the appserver.base is used.
- *
- * @param dataDirectory
- */
- public void setDataDirectory( String dataDirectory )
- {
- this.dataDirectory = dataDirectory;
- } //-- void setDataDirectory( String )
-
- /**
- * Set the default language used for setting internationalized
- * strings.
- *
- * @param defaultLanguage
- */
- public void setDefaultLanguage( String defaultLanguage )
- {
- this.defaultLanguage = defaultLanguage;
- } //-- void setDefaultLanguage( String )
-
- /**
- * Set the FileLocking configuration.
- *
- * @param fileLockConfiguration
- */
- public void setFileLockConfiguration( FileLockConfiguration fileLockConfiguration )
- {
- this.fileLockConfiguration = fileLockConfiguration;
- } //-- void setFileLockConfiguration( FileLockConfiguration )
-
- /**
- * Set comma separated list of language patterns. Sorted by
- * priority descending. Used for display of internationalized
- * strings.
- *
- * @param languageRange
- */
- public void setLanguageRange( String languageRange )
- {
- this.languageRange = languageRange;
- } //-- void setLanguageRange( String )
-
- /**
- * Set the base directory for local storage of remote
- * repository data. If not set, it's ${dataDirectory}/remotes.
- *
- * @param remoteRepositoryBaseDirectory
- */
- public void setRemoteRepositoryBaseDirectory( String remoteRepositoryBaseDirectory )
- {
- this.remoteRepositoryBaseDirectory = remoteRepositoryBaseDirectory;
- } //-- void setRemoteRepositoryBaseDirectory( String )
-
- /**
- * Set the base directory for local storage of repository data.
- * If not set, it's ${dataDirectory}/repositories.
- *
- * @param repositoryBaseDirectory
- */
- public void setRepositoryBaseDirectory( String repositoryBaseDirectory )
- {
- this.repositoryBaseDirectory = repositoryBaseDirectory;
- } //-- void setRepositoryBaseDirectory( String )
-
-
- public void setRepositoryGroupBaseDirectory(String repositoryGroupBaseDirectory) {
- this.repositoryGroupBaseDirectory = repositoryGroupBaseDirectory;
- }
-
- /**
- * Set the url failure cache configuration.
- *
- * @param urlFailureCacheConfiguration
- */
- public void setUrlFailureCacheConfiguration( CacheConfiguration urlFailureCacheConfiguration )
- {
- this.urlFailureCacheConfiguration = urlFailureCacheConfiguration;
- } //-- void setUrlFailureCacheConfiguration( CacheConfiguration )
-
-
- /**
- * Returns the list of checksum types to generate
- * @return
- */
- public List<String> getChecksumTypes()
- {
- if ( this.checksumTypes == null )
- {
- this.checksumTypes = new java.util.ArrayList<String>();
- }
-
- return this.checksumTypes;
- }
-
- /**
- * Adds a checksum type
- * @param type
- */
- public void addChecksumType(String type) {
-
- if (!getChecksumTypes().contains(type)) {
- getChecksumTypes().add(type);
- }
- }
-
- /**
- * Removes a checksum type
- * @param type
- */
- public void removeChecksumType(String type) {
- getChecksumTypes().remove(type);
- }
-
- /**
- * Set all checksum types
- * @param checksumTypes
- */
- public void setChecksumTypes(List<String> checksumTypes) {
- if (checksumTypes!=null) {
- getChecksumTypes().clear();
- getChecksumTypes().addAll(checksumTypes);
- }
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Cache configuration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class CacheConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * TimeToIdleSeconds.
- */
- private int timeToIdleSeconds = -1;
-
- /**
- * TimeToLiveSeconds.
- */
- private int timeToLiveSeconds = -1;
-
- /**
- * max elements in memory.
- */
- private int maxElementsInMemory = -1;
-
- /**
- * max elements on disk.
- */
- private int maxElementsOnDisk = -1;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get max elements in memory.
- *
- * @return int
- */
- public int getMaxElementsInMemory()
- {
- return this.maxElementsInMemory;
- } //-- int getMaxElementsInMemory()
-
- /**
- * Get max elements on disk.
- *
- * @return int
- */
- public int getMaxElementsOnDisk()
- {
- return this.maxElementsOnDisk;
- } //-- int getMaxElementsOnDisk()
-
- /**
- * Get timeToIdleSeconds.
- *
- * @return int
- */
- public int getTimeToIdleSeconds()
- {
- return this.timeToIdleSeconds;
- } //-- int getTimeToIdleSeconds()
-
- /**
- * Get timeToLiveSeconds.
- *
- * @return int
- */
- public int getTimeToLiveSeconds()
- {
- return this.timeToLiveSeconds;
- } //-- int getTimeToLiveSeconds()
-
- /**
- * Set max elements in memory.
- *
- * @param maxElementsInMemory
- */
- public void setMaxElementsInMemory( int maxElementsInMemory )
- {
- this.maxElementsInMemory = maxElementsInMemory;
- } //-- void setMaxElementsInMemory( int )
-
- /**
- * Set max elements on disk.
- *
- * @param maxElementsOnDisk
- */
- public void setMaxElementsOnDisk( int maxElementsOnDisk )
- {
- this.maxElementsOnDisk = maxElementsOnDisk;
- } //-- void setMaxElementsOnDisk( int )
-
- /**
- * Set timeToIdleSeconds.
- *
- * @param timeToIdleSeconds
- */
- public void setTimeToIdleSeconds( int timeToIdleSeconds )
- {
- this.timeToIdleSeconds = timeToIdleSeconds;
- } //-- void setTimeToIdleSeconds( int )
-
- /**
- * Set timeToLiveSeconds.
- *
- * @param timeToLiveSeconds
- */
- public void setTimeToLiveSeconds( int timeToLiveSeconds )
- {
- this.timeToLiveSeconds = timeToLiveSeconds;
- } //-- void setTimeToLiveSeconds( int )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class Configuration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class Configuration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * This is the version of the configuration format.
- */
- private String version = "3.0.0";
-
- /**
- * The type of the metadata storage. Allowed values: jcr, file,
- * cassandra.
- */
- private String metadataStore = "jcr";
-
- /**
- * Field repositoryGroups.
- */
- private java.util.List<RepositoryGroupConfiguration> repositoryGroups;
-
- /**
- * Field managedRepositories.
- */
- private java.util.List<ManagedRepositoryConfiguration> managedRepositories;
-
- /**
- * Field remoteRepositories.
- */
- private java.util.List<RemoteRepositoryConfiguration> remoteRepositories;
-
- /**
- * Field proxyConnectors.
- */
- private java.util.List<ProxyConnectorConfiguration> proxyConnectors;
-
- /**
- * Field networkProxies.
- */
- private java.util.List<NetworkProxyConfiguration> networkProxies;
-
- /**
- * Field legacyArtifactPaths.
- */
- private java.util.List<LegacyArtifactPath> legacyArtifactPaths;
-
- /**
- *
- * The repository scanning configuration.
- *
- */
- private RepositoryScanningConfiguration repositoryScanning;
-
- /**
- *
- * The webapp configuration.
- *
- */
- private WebappConfiguration webapp;
-
- /**
- *
- * The organisation info.
- *
- */
- private OrganisationInformation organisationInfo;
-
- /**
- *
- * The NetworkConfiguration .
- *
- */
- private NetworkConfiguration networkConfiguration;
-
- /**
- * The RedbackRuntimeConfiguration.
- */
- private RedbackRuntimeConfiguration redbackRuntimeConfiguration;
-
- /**
- * The ArchivaRuntimeConfiguration.
- */
- private ArchivaRuntimeConfiguration archivaRuntimeConfiguration;
-
- /**
- * Field proxyConnectorRuleConfigurations.
- */
- private java.util.List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations;
-
- /**
- * Archiva default settings.
- */
- private ArchivaDefaultConfiguration archivaDefaultConfiguration;
-
- /**
- * Field modelEncoding.
- */
- private String modelEncoding = "UTF-8";
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addLegacyArtifactPath.
- *
- * @param legacyArtifactPath
- */
- public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
- {
- getLegacyArtifactPaths().add( legacyArtifactPath );
- } //-- void addLegacyArtifactPath( LegacyArtifactPath )
-
- /**
- * Method addManagedRepository.
- *
- * @param managedRepositoryConfiguration
- */
- public void addManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration )
- {
- getManagedRepositories().add( managedRepositoryConfiguration );
- } //-- void addManagedRepository( ManagedRepositoryConfiguration )
-
- /**
- * Method addNetworkProxy.
- *
- * @param networkProxyConfiguration
- */
- public void addNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
- {
- getNetworkProxies().add( networkProxyConfiguration );
- } //-- void addNetworkProxy( NetworkProxyConfiguration )
-
- /**
- * Method addProxyConnector.
- *
- * @param proxyConnectorConfiguration
- */
- public void addProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
- {
- getProxyConnectors().add( proxyConnectorConfiguration );
- } //-- void addProxyConnector( ProxyConnectorConfiguration )
-
- /**
- * Method addProxyConnectorRuleConfiguration.
- *
- * @param proxyConnectorRuleConfiguration
- */
- public void addProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration )
- {
- getProxyConnectorRuleConfigurations().add( proxyConnectorRuleConfiguration );
- } //-- void addProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration )
-
- /**
- * Method addRemoteRepository.
- *
- * @param remoteRepositoryConfiguration
- */
- public void addRemoteRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration )
- {
- getRemoteRepositories().add( remoteRepositoryConfiguration );
- } //-- void addRemoteRepository( RemoteRepositoryConfiguration )
-
- /**
- * Method addRepositoryGroup.
- *
- * @param repositoryGroupConfiguration
- */
- public void addRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration )
- {
- getRepositoryGroups().add( repositoryGroupConfiguration );
- } //-- void addRepositoryGroup( RepositoryGroupConfiguration )
-
- /**
- * Get archiva default settings.
- *
- * @return ArchivaDefaultConfiguration
- */
- public ArchivaDefaultConfiguration getArchivaDefaultConfiguration()
- {
- return this.archivaDefaultConfiguration;
- } //-- ArchivaDefaultConfiguration getArchivaDefaultConfiguration()
-
- /**
- * Get the ArchivaRuntimeConfiguration.
- *
- * @return ArchivaRuntimeConfiguration
- */
- public ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
- {
- return this.archivaRuntimeConfiguration;
- } //-- ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
-
- /**
- * Method getLegacyArtifactPaths.
- *
- * @return List
- */
- public java.util.List<LegacyArtifactPath> getLegacyArtifactPaths()
- {
- if ( this.legacyArtifactPaths == null )
- {
- this.legacyArtifactPaths = new java.util.ArrayList<LegacyArtifactPath>();
- }
-
- return this.legacyArtifactPaths;
- } //-- java.util.List<LegacyArtifactPath> getLegacyArtifactPaths()
-
- /**
- * Method getManagedRepositories.
- *
- * @return List
- */
- public java.util.List<ManagedRepositoryConfiguration> getManagedRepositories()
- {
- if ( this.managedRepositories == null )
- {
- this.managedRepositories = new java.util.ArrayList<ManagedRepositoryConfiguration>();
- }
-
- return this.managedRepositories;
- } //-- java.util.List<ManagedRepositoryConfiguration> getManagedRepositories()
-
- /**
- * Get the type of the metadata storage. Allowed values: jcr,
- * file, cassandra.
- *
- * @return String
- */
- public String getMetadataStore()
- {
- return this.metadataStore;
- } //-- String getMetadataStore()
-
- /**
- * Get the modelEncoding field.
- *
- * @return String
- */
- public String getModelEncoding()
- {
- return this.modelEncoding;
- } //-- String getModelEncoding()
-
- /**
- * Get the NetworkConfiguration .
- *
- * @return NetworkConfiguration
- */
- public NetworkConfiguration getNetworkConfiguration()
- {
- return this.networkConfiguration;
- } //-- NetworkConfiguration getNetworkConfiguration()
-
- /**
- * Method getNetworkProxies.
- *
- * @return List
- */
- public java.util.List<NetworkProxyConfiguration> getNetworkProxies()
- {
- if ( this.networkProxies == null )
- {
- this.networkProxies = new java.util.ArrayList<NetworkProxyConfiguration>();
- }
-
- return this.networkProxies;
- } //-- java.util.List<NetworkProxyConfiguration> getNetworkProxies()
-
- /**
- * Get the organisation info.
- *
- * @return OrganisationInformation
- */
- public OrganisationInformation getOrganisationInfo()
- {
- return this.organisationInfo;
- } //-- OrganisationInformation getOrganisationInfo()
-
- /**
- * Method getProxyConnectorRuleConfigurations.
- *
- * @return List
- */
- public java.util.List<ProxyConnectorRuleConfiguration> getProxyConnectorRuleConfigurations()
- {
- if ( this.proxyConnectorRuleConfigurations == null )
- {
- this.proxyConnectorRuleConfigurations = new java.util.ArrayList<ProxyConnectorRuleConfiguration>();
- }
-
- return this.proxyConnectorRuleConfigurations;
- } //-- java.util.List<ProxyConnectorRuleConfiguration> getProxyConnectorRuleConfigurations()
-
- /**
- * Method getProxyConnectors.
- *
- * @return List
- */
- public java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
- {
- if ( this.proxyConnectors == null )
- {
- this.proxyConnectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
- }
-
- return this.proxyConnectors;
- } //-- java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
-
- /**
- * Get the RedbackRuntimeConfiguration.
- *
- * @return RedbackRuntimeConfiguration
- */
- public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
- {
- return this.redbackRuntimeConfiguration;
- } //-- RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
-
- /**
- * Method getRemoteRepositories.
- *
- * @return List
- */
- public java.util.List<RemoteRepositoryConfiguration> getRemoteRepositories()
- {
- if ( this.remoteRepositories == null )
- {
- this.remoteRepositories = new java.util.ArrayList<RemoteRepositoryConfiguration>();
- }
-
- return this.remoteRepositories;
- } //-- java.util.List<RemoteRepositoryConfiguration> getRemoteRepositories()
-
- /**
- * Method getRepositoryGroups.
- *
- * @return List
- */
- public java.util.List<RepositoryGroupConfiguration> getRepositoryGroups()
- {
- if ( this.repositoryGroups == null )
- {
- this.repositoryGroups = new java.util.ArrayList<RepositoryGroupConfiguration>();
- }
-
- return this.repositoryGroups;
- } //-- java.util.List<RepositoryGroupConfiguration> getRepositoryGroups()
-
- /**
- * Get the repository scanning configuration.
- *
- * @return RepositoryScanningConfiguration
- */
- public RepositoryScanningConfiguration getRepositoryScanning()
- {
- return this.repositoryScanning;
- } //-- RepositoryScanningConfiguration getRepositoryScanning()
-
- /**
- * Get this is the version of the configuration format.
- *
- * @return String
- */
- public String getVersion()
- {
- return this.version;
- } //-- String getVersion()
-
- /**
- * Get the webapp configuration.
- *
- * @return WebappConfiguration
- */
- public WebappConfiguration getWebapp()
- {
- return this.webapp;
- } //-- WebappConfiguration getWebapp()
-
- /**
- * Method removeLegacyArtifactPath.
- *
- * @param legacyArtifactPath
- */
- public void removeLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
- {
- getLegacyArtifactPaths().remove( legacyArtifactPath );
- } //-- void removeLegacyArtifactPath( LegacyArtifactPath )
-
- /**
- * Method removeManagedRepository.
- *
- * @param managedRepositoryConfiguration
- */
- public void removeManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration )
- {
- getManagedRepositories().remove( managedRepositoryConfiguration );
- } //-- void removeManagedRepository( ManagedRepositoryConfiguration )
-
- /**
- * Method removeNetworkProxy.
- *
- * @param networkProxyConfiguration
- */
- public void removeNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
- {
- getNetworkProxies().remove( networkProxyConfiguration );
- } //-- void removeNetworkProxy( NetworkProxyConfiguration )
-
- /**
- * Method removeProxyConnector.
- *
- * @param proxyConnectorConfiguration
- */
- public void removeProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
- {
- getProxyConnectors().remove( proxyConnectorConfiguration );
- } //-- void removeProxyConnector( ProxyConnectorConfiguration )
-
- /**
- * Method removeProxyConnectorRuleConfiguration.
- *
- * @param proxyConnectorRuleConfiguration
- */
- public void removeProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration )
- {
- getProxyConnectorRuleConfigurations().remove( proxyConnectorRuleConfiguration );
- } //-- void removeProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration )
-
- /**
- * Method removeRemoteRepository.
- *
- * @param remoteRepositoryConfiguration
- */
- public void removeRemoteRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration )
- {
- getRemoteRepositories().remove( remoteRepositoryConfiguration );
- } //-- void removeRemoteRepository( RemoteRepositoryConfiguration )
-
- /**
- * Method removeRepositoryGroup.
- *
- * @param repositoryGroupConfiguration
- */
- public void removeRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration )
- {
- getRepositoryGroups().remove( repositoryGroupConfiguration );
- } //-- void removeRepositoryGroup( RepositoryGroupConfiguration )
-
- /**
- * Set archiva default settings.
- *
- * @param archivaDefaultConfiguration
- */
- public void setArchivaDefaultConfiguration( ArchivaDefaultConfiguration archivaDefaultConfiguration )
- {
- this.archivaDefaultConfiguration = archivaDefaultConfiguration;
- } //-- void setArchivaDefaultConfiguration( ArchivaDefaultConfiguration )
-
- /**
- * Set the ArchivaRuntimeConfiguration.
- *
- * @param archivaRuntimeConfiguration
- */
- public void setArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
- {
- this.archivaRuntimeConfiguration = archivaRuntimeConfiguration;
- } //-- void setArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration )
-
- /**
- * Set the list of custom legacy path to artifact.
- *
- * @param legacyArtifactPaths
- */
- public void setLegacyArtifactPaths( java.util.List<LegacyArtifactPath> legacyArtifactPaths )
- {
- this.legacyArtifactPaths = legacyArtifactPaths;
- } //-- void setLegacyArtifactPaths( java.util.List )
-
- /**
- * Set the list of repositories that this archiva instance
- * uses.
- *
- * @param managedRepositories
- */
- public void setManagedRepositories( java.util.List<ManagedRepositoryConfiguration> managedRepositories )
- {
- this.managedRepositories = managedRepositories;
- } //-- void setManagedRepositories( java.util.List )
-
- /**
- * Set the type of the metadata storage. Allowed values: jcr,
- * file, cassandra.
- *
- * @param metadataStore
- */
- public void setMetadataStore( String metadataStore )
- {
- this.metadataStore = metadataStore;
- } //-- void setMetadataStore( String )
-
- /**
- * Set the modelEncoding field.
- *
- * @param modelEncoding
- */
- public void setModelEncoding( String modelEncoding )
- {
- this.modelEncoding = modelEncoding;
- } //-- void setModelEncoding( String )
-
- /**
- * Set the NetworkConfiguration .
- *
- * @param networkConfiguration
- */
- public void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
- {
- this.networkConfiguration = networkConfiguration;
- } //-- void setNetworkConfiguration( NetworkConfiguration )
-
- /**
- * Set the list of network proxies to use for outgoing
- * requests.
- *
- * @param networkProxies
- */
- public void setNetworkProxies( java.util.List<NetworkProxyConfiguration> networkProxies )
- {
- this.networkProxies = networkProxies;
- } //-- void setNetworkProxies( java.util.List )
-
- /**
- * Set the organisation info.
- *
- * @param organisationInfo
- */
- public void setOrganisationInfo( OrganisationInformation organisationInfo )
- {
- this.organisationInfo = organisationInfo;
- } //-- void setOrganisationInfo( OrganisationInformation )
-
- /**
- * Set the list of ProxyConnectorRuleConfigurations.
- *
- * @param proxyConnectorRuleConfigurations
- */
- public void setProxyConnectorRuleConfigurations( java.util.List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations )
- {
- this.proxyConnectorRuleConfigurations = proxyConnectorRuleConfigurations;
- } //-- void setProxyConnectorRuleConfigurations( java.util.List )
-
- /**
- * Set the list of proxy connectors for this archiva instance.
- *
- * @param proxyConnectors
- */
- public void setProxyConnectors( java.util.List<ProxyConnectorConfiguration> proxyConnectors )
- {
- this.proxyConnectors = proxyConnectors;
- } //-- void setProxyConnectors( java.util.List )
-
- /**
- * Set the RedbackRuntimeConfiguration.
- *
- * @param redbackRuntimeConfiguration
- */
- public void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
- {
- this.redbackRuntimeConfiguration = redbackRuntimeConfiguration;
- } //-- void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration )
-
- /**
- * Set the list of repositories that this archiva can retrieve
- * from or publish to.
- *
- * @param remoteRepositories
- */
- public void setRemoteRepositories( java.util.List<RemoteRepositoryConfiguration> remoteRepositories )
- {
- this.remoteRepositories = remoteRepositories;
- } //-- void setRemoteRepositories( java.util.List )
-
- /**
- * Set the list of repository groups.
- *
- * @param repositoryGroups
- */
- public void setRepositoryGroups( java.util.List<RepositoryGroupConfiguration> repositoryGroups )
- {
- this.repositoryGroups = repositoryGroups;
- } //-- void setRepositoryGroups( java.util.List )
-
- /**
- * Set the repository scanning configuration.
- *
- * @param repositoryScanning
- */
- public void setRepositoryScanning( RepositoryScanningConfiguration repositoryScanning )
- {
- this.repositoryScanning = repositoryScanning;
- } //-- void setRepositoryScanning( RepositoryScanningConfiguration )
-
- /**
- * Set this is the version of the configuration format.
- *
- * @param version
- */
- public void setVersion( String version )
- {
- this.version = version;
- } //-- void setVersion( String )
-
- /**
- * Set the webapp configuration.
- *
- * @param webapp
- */
- public void setWebapp( WebappConfiguration webapp )
- {
- this.webapp = webapp;
- } //-- void setWebapp( WebappConfiguration )
-
-
- private java.util.Map<String, java.util.List<String>> repositoryToGroupMap;
-
- public java.util.Map<String, java.util.List<String>> getRepositoryToGroupMap()
- {
- if ( repositoryGroups != null )
- {
- java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
-
- for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
- {
- for ( String repositoryId : (java.util.List<String>) group.getRepositories() )
- {
- java.util.List<String> groups = map.get( repositoryId );
- if ( groups == null )
- {
- groups = new java.util.ArrayList<String>();
- map.put( repositoryId, groups );
- }
- groups.add( group.getId() );
- }
- }
-
- repositoryToGroupMap = map;
- }
- return repositoryToGroupMap;
- }
-
- public java.util.Map<String, RepositoryGroupConfiguration> getRepositoryGroupsAsMap()
- {
- java.util.Map<String, RepositoryGroupConfiguration> map = new java.util.HashMap<String, RepositoryGroupConfiguration>();
- if ( repositoryGroups != null )
- {
- for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
- {
- map.put( group.getId(), group );
- }
- }
- return map;
- }
-
- public RepositoryGroupConfiguration findRepositoryGroupById( String id )
- {
- if ( repositoryGroups != null && id!=null)
- {
- return ( (java.util.List<RepositoryGroupConfiguration>) repositoryGroups ).stream( ).filter( g -> g != null && id.equals( g.getId( ) ) ).findFirst( ).orElse( null );
- }
- return null;
- }
-
- private java.util.Map<String, java.util.List<String>> groupToRepositoryMap;
-
- public java.util.Map<String, java.util.List<String>> getGroupToRepositoryMap()
- {
- if ( repositoryGroups != null && managedRepositories != null )
- {
- java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
-
- for ( ManagedRepositoryConfiguration repo : (java.util.List<ManagedRepositoryConfiguration>) managedRepositories )
- {
- for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
- {
- if ( !group.getRepositories().contains( repo.getId() ) )
- {
- String groupId = group.getId();
- java.util.List<String> repos = map.get( groupId );
- if ( repos == null )
- {
- repos = new java.util.ArrayList<String>();
- map.put( groupId, repos );
- }
- repos.add( repo.getId() );
- }
- }
- }
- groupToRepositoryMap = map;
- }
- return groupToRepositoryMap;
- }
-
-
- public java.util.Map<String, NetworkProxyConfiguration> getNetworkProxiesAsMap()
- {
- java.util.Map<String, NetworkProxyConfiguration> map = new java.util.HashMap<String, NetworkProxyConfiguration>();
- if ( networkProxies != null )
- {
- for ( java.util.Iterator<NetworkProxyConfiguration> i = networkProxies.iterator(); i.hasNext(); )
- {
- NetworkProxyConfiguration proxy = i.next();
- map.put( proxy.getId(), proxy );
- }
- }
- return map;
- }
-
- public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap()
- {
- java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
- new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>();
-
- if( proxyConnectors != null )
- {
- java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator();
- while ( it.hasNext() )
- {
- ProxyConnectorConfiguration proxyConfig = it.next();
- String key = proxyConfig.getSourceRepoId();
-
- java.util.List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key );
- if ( connectors == null )
- {
- connectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
- proxyConnectorMap.put( key, connectors );
- }
-
- connectors.add( proxyConfig );
- java.util.Collections.sort( connectors,
- org.apache.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator.getInstance() );
- }
- }
-
- return proxyConnectorMap;
- }
-
- public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap()
- {
- java.util.Map<String, RemoteRepositoryConfiguration> map = new java.util.HashMap<String, RemoteRepositoryConfiguration>();
- if ( remoteRepositories != null )
- {
- for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); )
- {
- RemoteRepositoryConfiguration repo = i.next();
- map.put( repo.getId(), repo );
- }
- }
- return map;
- }
-
- public RemoteRepositoryConfiguration findRemoteRepositoryById( String id )
- {
- if ( remoteRepositories != null )
- {
- for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); )
- {
- RemoteRepositoryConfiguration repo = i.next();
- if ( repo.getId().equals( id ) )
- {
- return repo;
- }
- }
- }
- return null;
- }
-
- public java.util.Map<String, ManagedRepositoryConfiguration> getManagedRepositoriesAsMap()
- {
- java.util.Map<String, ManagedRepositoryConfiguration> map = new java.util.HashMap<String, ManagedRepositoryConfiguration>();
- if ( managedRepositories != null )
- {
- for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); )
- {
- ManagedRepositoryConfiguration repo = i.next();
- map.put( repo.getId(), repo );
- }
- }
- return map;
- }
-
- public ManagedRepositoryConfiguration findManagedRepositoryById( String id )
- {
- if ( managedRepositories != null )
- {
- for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); )
- {
- ManagedRepositoryConfiguration repo = i.next();
- if ( repo.getId().equals( id ) )
- {
- return repo;
- }
- }
- }
- return null;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * ConfigurationEvent
- *
- *
- */
-public class ConfigurationEvent
-{
- public static final int SAVED = 1;
-
- public static final int CHANGED = 2;
-
- private int type;
-
- private String tag;
-
- public ConfigurationEvent( int type )
- {
- this.type = type;
- tag = "";
- }
-
- public ConfigurationEvent(int type, String tag) {
- this.type = type;
- this.tag = tag;
- }
-
- public int getType()
- {
- return type;
- }
-
- public String getTag( )
- {
- return tag;
- }
-
- public void setTag( String tag )
- {
- this.tag = tag;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o ) return true;
- if ( o == null || getClass( ) != o.getClass( ) ) return false;
-
- ConfigurationEvent that = (ConfigurationEvent) o;
-
- if ( type != that.type ) return false;
- return tag.equals( that.tag );
- }
-
- @Override
- public int hashCode( )
- {
- int result = type;
- result = 31 * result + tag.hashCode( );
- return result;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * ConfigurationListener
- *
- *
- */
-public interface ConfigurationListener
-{
- /**
- * Generic event point to notify components that something has happend in the configuration.
- */
- void configurationEvent( ConfigurationEvent event );
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Utility methods for testing the configuration property name.
- *
- *
- */
-public class ConfigurationNames
-{
- public static boolean isNetworkProxy( String propertyName )
- {
- return startsWith( "networkProxies.", propertyName );
- }
-
- public static boolean isRepositoryScanning( String propertyName )
- {
- return startsWith( "repositoryScanning.", propertyName );
- }
-
- public static boolean isManagedRepositories( String propertyName )
- {
- return startsWith( "managedRepositories.", propertyName );
- }
-
- public static boolean isRemoteRepositories( String propertyName )
- {
- return startsWith( "remoteRepositories.", propertyName );
- }
-
- public static boolean isProxyConnector( String propertyName )
- {
- return startsWith( "proxyConnectors.", propertyName );
- }
-
- private static boolean startsWith( String prefix, String name )
- {
- if ( name == null )
- {
- return false;
- }
-
- if ( name.length() <= 0 )
- {
- return false;
- }
-
- return name.startsWith( prefix );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Unrecoverable exception in the configuration mechanism that is the result of a programming error.
- */
-public class ConfigurationRuntimeException
- extends RuntimeException
-{
- public ConfigurationRuntimeException( String msg, Throwable cause )
- {
- super( msg, cause );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator;
-import org.apache.archiva.configuration.io.registry.ConfigurationRegistryReader;
-import org.apache.archiva.configuration.io.registry.ConfigurationRegistryWriter;
-import org.apache.archiva.policies.AbstractUpdatePolicy;
-import org.apache.archiva.policies.CachedFailuresPolicy;
-import org.apache.archiva.policies.ChecksumPolicy;
-import org.apache.archiva.components.evaluator.DefaultExpressionEvaluator;
-import org.apache.archiva.components.evaluator.EvaluatorException;
-import org.apache.archiva.components.evaluator.ExpressionEvaluator;
-import org.apache.archiva.components.evaluator.sources.SystemPropertyExpressionSource;
-import org.apache.archiva.components.registry.Registry;
-import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.ListUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.InvalidPathException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.*;
-import java.util.Map.Entry;
-
-/**
- * <p>
- * Implementation of configuration holder that retrieves it from the registry.
- * </p>
- * <p>
- * The registry layers and merges the 2 configuration files: user, and application server.
- * </p>
- * <p>
- * Instead of relying on the model defaults, if the registry is empty a default configuration file is loaded and
- * applied from a resource. The defaults are not loaded into the registry as the lists (eg repositories) could no longer
- * be removed if that was the case.
- * </p>
- * <p>
- * When saving the configuration, it is saved to the location it was read from. If it was read from the defaults, it
- * will be saved to the user location.
- * However, if the configuration contains information from both sources, an exception is raised as this is currently
- * unsupported. The reason for this is that it is not possible to identify where to re-save elements, and can result
- * in list configurations (eg repositories) becoming inconsistent.
- * </p>
- * <p>
- * If the configuration is outdated, it will be upgraded when it is loaded. This is done by checking the version flag
- * before reading it from the registry.
- * <p>
- * FIXME: The synchronization must be improved, the current impl may lead to inconsistent data or multiple getConfiguration() calls (martin_s@apache.org)
- * </p>
- */
-@Service("archivaConfiguration#default")
-public class DefaultArchivaConfiguration
- implements ArchivaConfiguration, RegistryListener {
- private final Logger log = LoggerFactory.getLogger(DefaultArchivaConfiguration.class);
-
- private static String FILE_ENCODING = "UTF-8";
-
- /**
- * Plexus registry to read the configuration from.
- */
- @Inject
- @Named(value = "commons-configuration")
- private Registry registry;
-
- /**
- * The configuration that has been converted.
- */
- private Configuration configuration;
-
- /**
- * see #initialize
- * default-value="${user.home}/.m2/archiva.xml"
- */
- private String userConfigFilename = "${user.home}/.m2/archiva.xml";
-
- /**
- * see #initialize
- * default-value="${appserver.base}/conf/archiva.xml"
- */
- private String altConfigFilename = "${appserver.base}/conf/archiva.xml";
-
- /**
- * Configuration Listeners we've registered.
- */
- private Set<ConfigurationListener> listeners = new HashSet<>();
-
- /**
- * Registry Listeners we've registered.
- */
- private Set<RegistryListener> registryListeners = new HashSet<>();
-
- /**
- * Boolean to help determine if the configuration exists as a result of pulling in
- * the default-archiva.xml
- */
- private boolean isConfigurationDefaulted = false;
-
- private static final String KEY = "org.apache.archiva";
-
- // Section used for default only configuration
- private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default";
-
- private Locale defaultLocale = Locale.getDefault();
-
- private List<Locale.LanguageRange> languagePriorities = new ArrayList<>();
-
- private volatile Path dataDirectory;
- private volatile Path repositoryBaseDirectory;
- private volatile Path remoteRepositoryBaseDirectory;
- private volatile Path repositoryGroupBaseDirectory;
-
- @PostConstruct
- private void init() {
- languagePriorities = Locale.LanguageRange.parse("en,fr,de");
- }
-
-
- @Override
- public Configuration getConfiguration() {
- return loadConfiguration();
- }
-
- private synchronized Configuration loadConfiguration() {
- if (configuration == null) {
- configuration = load();
- configuration = unescapeExpressions(configuration);
- if (isConfigurationDefaulted) {
- configuration = checkRepositoryLocations(configuration);
- }
- }
-
- return configuration;
- }
-
- private boolean hasConfigVersionChanged(Configuration current, Registry defaultOnlyConfiguration) {
- return current == null || current.getVersion() == null ||
- !current.getVersion().trim().equals(defaultOnlyConfiguration.getString("version", "").trim());
- }
-
- @SuppressWarnings("unchecked")
- private Configuration load() {
- // TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties)
- Registry subset = registry.getSubset(KEY);
- if (subset.getString("version") == null) {
- if (subset.getSubset("repositoryScanning").isEmpty()) {
- // only for empty
- subset = readDefaultConfiguration();
- } else {
- throw new RuntimeException("No version tag found in configuration. Archiva configuration version 1.x is not longer supported.");
- }
- }
-
- Configuration config = new ConfigurationRegistryReader().read(subset);
-
- // Resolving data and repositories directories
- // If the config entries are absolute, the path is used as it is
- // if the config entries are empty, they are resolved:
- // dataDirectory = ${appserver.base}/data
- // repositoryDirectory = ${dataDirectory}/repositories
- // If the entries are relative they are resolved
- // relative to the appserver.base, for dataDirectory
- // relative to dataDirectory for repositoryBase
- String dataDir = config.getArchivaRuntimeConfiguration().getDataDirectory();
- if (StringUtils.isEmpty(dataDir)) {
- dataDirectory = getAppServerBaseDir().resolve("data");
- } else {
- Path tmpDataDir = Paths.get(dataDir);
- if (tmpDataDir.isAbsolute()) {
- dataDirectory = tmpDataDir;
- } else {
- dataDirectory = getAppServerBaseDir().resolve(tmpDataDir);
- }
- }
- config.getArchivaRuntimeConfiguration().setDataDirectory(dataDirectory.normalize().toString());
- String repoBaseDir = config.getArchivaRuntimeConfiguration().getRepositoryBaseDirectory();
- if (StringUtils.isEmpty(repoBaseDir)) {
- repositoryBaseDirectory = dataDirectory.resolve("repositories");
-
- } else {
- Path tmpRepoBaseDir = Paths.get(repoBaseDir);
- if (tmpRepoBaseDir.isAbsolute()) {
- repositoryBaseDirectory = tmpRepoBaseDir;
- } else {
- dataDirectory.resolve(tmpRepoBaseDir);
- }
- }
-
- String remoteRepoBaseDir = config.getArchivaRuntimeConfiguration().getRemoteRepositoryBaseDirectory();
- if (StringUtils.isEmpty(remoteRepoBaseDir)) {
- remoteRepositoryBaseDirectory = dataDirectory.resolve("remotes");
- } else {
- Path tmpRemoteRepoDir = Paths.get(remoteRepoBaseDir);
- if (tmpRemoteRepoDir.isAbsolute()) {
- remoteRepositoryBaseDirectory = tmpRemoteRepoDir;
- } else {
- dataDirectory.resolve(tmpRemoteRepoDir);
- }
- }
-
- String repositoryGroupBaseDir = config.getArchivaRuntimeConfiguration().getRepositoryGroupBaseDirectory();
- if (StringUtils.isEmpty(repositoryGroupBaseDir)) {
- repositoryGroupBaseDirectory = dataDirectory.resolve("groups");
- } else {
- Path tmpGroupDir = Paths.get(repositoryGroupBaseDir);
- if (tmpGroupDir.isAbsolute()) {
- repositoryGroupBaseDirectory = tmpGroupDir;
- } else {
- dataDirectory.resolve(tmpGroupDir);
- }
- }
-
-
- config.getRepositoryGroups();
- config.getRepositoryGroupsAsMap();
- if (!CollectionUtils.isEmpty(config.getRemoteRepositories())) {
- List<RemoteRepositoryConfiguration> remoteRepos = config.getRemoteRepositories();
- for (RemoteRepositoryConfiguration repo : remoteRepos) {
- // [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
- if (StringUtils.isBlank(repo.getUsername())) {
- repo.setUsername(null);
- }
-
- if (StringUtils.isBlank(repo.getPassword())) {
- repo.setPassword(null);
- }
- }
- }
-
- if (!config.getProxyConnectors().isEmpty()) {
- // Fix Proxy Connector Settings.
-
- // Create a copy of the list to read from (to prevent concurrent modification exceptions)
- List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<>(config.getProxyConnectors());
- // Remove the old connector list.
- config.getProxyConnectors().clear();
-
- for (ProxyConnectorConfiguration connector : proxyConnectorList) {
- // Fix policies
- boolean connectorValid = true;
-
- Map<String, String> policies = new HashMap<>();
- // Make copy of policies
- policies.putAll(connector.getPolicies());
- // Clear out policies
- connector.getPolicies().clear();
-
- // Work thru policies. cleaning them up.
- for (Entry<String, String> entry : policies.entrySet()) {
- String policyId = entry.getKey();
- String setting = entry.getValue();
-
- // Upgrade old policy settings.
- if ("releases".equals(policyId) || "snapshots".equals(policyId)) {
- if ("ignored".equals(setting)) {
- setting = AbstractUpdatePolicy.ALWAYS.getId();
- } else if ("disabled".equals(setting)) {
- setting = AbstractUpdatePolicy.NEVER.getId();
- }
- } else if ("cache-failures".equals(policyId)) {
- if ("ignored".equals(setting)) {
- setting = CachedFailuresPolicy.NO.getId();
- } else if ("cached".equals(setting)) {
- setting = CachedFailuresPolicy.YES.getId();
- }
- } else if ("checksum".equals(policyId)) {
- if ("ignored".equals(setting)) {
- setting = ChecksumPolicy.IGNORE.getId();
- }
- }
-
- // Validate existance of policy key.
- connector.addPolicy(policyId, setting);
- }
-
- if (connectorValid) {
- config.addProxyConnector(connector);
- }
- }
-
- // Normalize the order fields in the proxy connectors.
- Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
- config.getProxyConnectorAsMap();
-
- for (List<ProxyConnectorConfiguration> connectors : proxyConnectorMap.values()) {
- // Sort connectors by order field.
- Collections.sort(connectors, ProxyConnectorConfigurationOrderComparator.getInstance());
-
- // Normalize the order field values.
- int order = 1;
- for (ProxyConnectorConfiguration connector : connectors) {
- connector.setOrder(order++);
- }
- }
- }
-
- this.defaultLocale = Locale.forLanguageTag(config.getArchivaRuntimeConfiguration().getDefaultLanguage());
- this.languagePriorities = Locale.LanguageRange.parse(config.getArchivaRuntimeConfiguration().getLanguageRange());
- return config;
- }
-
- /*
- * Updates the checkpath list for repositories.
- *
- * We are replacing existing ones and adding new ones. This allows to update the list with new releases.
- *
- * We are also updating existing remote repositories, if they exist already.
- *
- * This update method should only be called, if the config version changes to avoid overwriting
- * user repository settings all the time.
- */
- private void updateCheckPathDefaults(Configuration config, Registry defaultConfiguration) {
- List<RepositoryCheckPath> existingCheckPathList = config.getArchivaDefaultConfiguration().getDefaultCheckPaths();
- HashMap<String, RepositoryCheckPath> existingCheckPaths = new HashMap<>();
- HashMap<String, RepositoryCheckPath> newCheckPaths = new HashMap<>();
- for (RepositoryCheckPath path : config.getArchivaDefaultConfiguration().getDefaultCheckPaths()) {
- existingCheckPaths.put(path.getUrl(), path);
- }
- List defaultCheckPathsSubsets = defaultConfiguration.getSubsetList("archivaDefaultConfiguration.defaultCheckPaths.defaultCheckPath");
- for (Iterator i = defaultCheckPathsSubsets.iterator(); i.hasNext(); ) {
- RepositoryCheckPath v = readRepositoryCheckPath((Registry) i.next());
- if (existingCheckPaths.containsKey(v.getUrl())) {
- existingCheckPathList.remove(existingCheckPaths.get(v.getUrl()));
- }
- existingCheckPathList.add(v);
- newCheckPaths.put(v.getUrl(), v);
- }
- // Remote repositories update
- for (RemoteRepositoryConfiguration remoteRepositoryConfiguration : config.getRemoteRepositories()) {
- String url = remoteRepositoryConfiguration.getUrl().toLowerCase();
- if (newCheckPaths.containsKey(url)) {
- String currentPath = remoteRepositoryConfiguration.getCheckPath();
- String newPath = newCheckPaths.get(url).getPath();
- log.info("Updating connection check path for repository {}, from '{}' to '{}'.", remoteRepositoryConfiguration.getId(),
- currentPath, newPath);
- remoteRepositoryConfiguration.setCheckPath(newPath);
- }
- }
- }
-
- private RepositoryCheckPath readRepositoryCheckPath(Registry registry) {
- RepositoryCheckPath value = new RepositoryCheckPath();
-
- String url = registry.getString("url", value.getUrl());
-
- value.setUrl(url);
- String path = registry.getString("path", value.getPath());
- value.setPath(path);
- return value;
- }
-
-
- private Registry readDefaultConfiguration() {
- // if it contains some old configuration, remove it (Archiva 0.9)
- registry.removeSubset(KEY);
-
- try {
- registry.addConfigurationFromResource("org/apache/archiva/configuration/default-archiva.xml", KEY);
- this.isConfigurationDefaulted = true;
- } catch (RegistryException e) {
- throw new ConfigurationRuntimeException(
- "Fatal error: Unable to find the built-in default configuration and load it into the registry", e);
- }
- return registry.getSubset(KEY);
- }
-
- /*
- * Reads the default only configuration into a special prefix. This allows to check for changes
- * of the default configuration.
- */
- private Registry readDefaultOnlyConfiguration() {
- registry.removeSubset(KEY_DEFAULT_ONLY);
- try {
- registry.addConfigurationFromResource("org/apache/archiva/configuration/default-archiva.xml", KEY_DEFAULT_ONLY);
- } catch (RegistryException e) {
- throw new ConfigurationRuntimeException(
- "Fatal error: Unable to find the built-in default configuration and load it into the registry", e);
- }
- return registry.getSubset(KEY_DEFAULT_ONLY);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public synchronized void save(Configuration configuration) throws IndeterminateConfigurationException, RegistryException
- {
- save( configuration, "" );
- }
-
- /**
- * Saves the configuration and adds the given tag to the event.
- * @param configuration the configuration to save
- * @param eventTag the tag to add to the configuration saved event
- * @throws IndeterminateConfigurationException if the
- * @throws RegistryException
- */
- @Override
- public synchronized void save(Configuration configuration, String eventTag)
- throws IndeterminateConfigurationException, RegistryException {
- Registry section = registry.getSection(KEY + ".user");
- Registry baseSection = registry.getSection(KEY + ".base");
- if (section == null) {
- section = baseSection;
- if (section == null) {
- section = createDefaultConfigurationFile(eventTag);
- }
- } else if (baseSection != null) {
- Collection<String> keys = baseSection.getKeys();
- boolean foundList = false;
- for (Iterator<String> i = keys.iterator(); i.hasNext() && !foundList; ) {
- String key = i.next();
-
- // a little aggressive with the repositoryScanning and databaseScanning - should be no need to split
- // that configuration
- if (key.startsWith("repositories") //
- || key.startsWith("proxyConnectors") //
- || key.startsWith("networkProxies") //
- || key.startsWith("repositoryScanning") //
- || key.startsWith("remoteRepositories") //
- || key.startsWith("managedRepositories") //
- || key.startsWith("repositoryGroups")) //
- {
- foundList = true;
- }
- }
-
- if (foundList) {
- this.configuration = null;
-
- throw new IndeterminateConfigurationException(
- "Configuration can not be saved when it is loaded from two sources");
- }
- }
-
- // escape all cron expressions to handle ','
- escapeCronExpressions(configuration);
-
- // [MRM-661] Due to a bug in the modello registry writer, we need to take these out by hand. They'll be put back by the writer.
- if (section != null) {
- if (configuration.getManagedRepositories().isEmpty()) {
- section.removeSubset("managedRepositories");
- }
- if (configuration.getRemoteRepositories().isEmpty()) {
- section.removeSubset("remoteRepositories");
-
- }
- if (configuration.getProxyConnectors().isEmpty()) {
- section.removeSubset("proxyConnectors");
- }
- if (configuration.getNetworkProxies().isEmpty()) {
- section.removeSubset("networkProxies");
- }
- if (configuration.getLegacyArtifactPaths().isEmpty()) {
- section.removeSubset("legacyArtifactPaths");
- }
- if (configuration.getRepositoryGroups().isEmpty()) {
- section.removeSubset("repositoryGroups");
- }
- if (configuration.getRepositoryScanning() != null) {
- if (configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty()) {
- section.removeSubset("repositoryScanning.knownContentConsumers");
- }
- if (configuration.getRepositoryScanning().getInvalidContentConsumers().isEmpty()) {
- section.removeSubset("repositoryScanning.invalidContentConsumers");
- }
- }
- if (configuration.getArchivaRuntimeConfiguration() != null) {
- section.removeSubset("archivaRuntimeConfiguration.defaultCheckPaths");
- }
-
- new ConfigurationRegistryWriter().write(configuration, section);
- section.save();
- }
-
-
- this.configuration = unescapeExpressions(configuration);
- isConfigurationDefaulted = false;
-
- triggerEvent(ConfigurationEvent.SAVED, eventTag);
- }
-
- private void escapeCronExpressions(Configuration configuration) {
- for (ManagedRepositoryConfiguration c : configuration.getManagedRepositories()) {
- c.setRefreshCronExpression(escapeCronExpression(c.getRefreshCronExpression()));
- }
- }
-
- private Registry createDefaultConfigurationFile(String eventTag)
- throws RegistryException {
- // TODO: may not be needed under commons-configuration 1.4 - check
-
- String contents = "<configuration />";
-
- String fileLocation = userConfigFilename;
-
- if (!writeFile("user configuration", userConfigFilename, contents)) {
- fileLocation = altConfigFilename;
- if (!writeFile("alternative configuration", altConfigFilename, contents, true)) {
- throw new RegistryException(
- "Unable to create configuration file in either user [" + userConfigFilename + "] or alternative ["
- + altConfigFilename
- + "] locations on disk, usually happens when not allowed to write to those locations.");
- }
- }
-
- // olamy hackish I know :-)
- contents = "<configuration><xml fileName=\"" + fileLocation
- + "\" config-forceCreate=\"true\" config-name=\"org.apache.archiva.user\"/>" + "</configuration>";
-
- ((CommonsConfigurationRegistry) registry).setInitialConfiguration(contents);
-
- registry.initialize();
-
- for (RegistryListener regListener : registryListeners) {
- addRegistryChangeListener(regListener);
- }
-
- triggerEvent(ConfigurationEvent.SAVED, eventTag==null?"default-file":eventTag);
-
- Registry section = registry.getSection(KEY + ".user");
- if (section == null) {
- return new CommonsConfigurationRegistry( );
- } else {
- return section;
- }
- }
-
- private boolean writeFile(String filetype, String path, String contents) {
- return writeFile( filetype, path, contents, false );
- }
-
- /**
- * Attempts to write the contents to a file, if an IOException occurs, return false.
- * <p/>
- * The file will be created if the directory to the file exists, otherwise this will return false.
- *
- * @param filetype the filetype (freeform text) to use in logging messages when failure to write.
- * @param path the path to write to.
- * @param contents the contents to write.
- * @return true if write successful.
- */
- private boolean writeFile(String filetype, String path, String contents, boolean createDirs) {
- try {
- Path file = Paths.get(path);
- // Check parent directory (if it is declared)
- final Path parent = file.getParent();
- if (parent != null) {
- // Check that directory exists
- if (!Files.exists( parent ) && createDirs) {
- Files.createDirectories( parent );
- }
- if (!Files.isDirectory(parent)) {
- // Directory to file must exist for file to be created
- return false;
- }
- }
- FileUtils.writeStringToFile(file.toFile(), contents, FILE_ENCODING);
- return true;
- } catch (IOException e) {
- log.error("Unable to create {} file: {}", filetype, e.getMessage(), e);
- return false;
- } catch (InvalidPathException ipe) {
- log.error("Unable to read {} file: {}", path, ipe.getMessage(), ipe);
- return false;
- }
- }
-
- private void triggerEvent(int type, String eventTag) {
- ConfigurationEvent evt = new ConfigurationEvent(type, eventTag);
- for (ConfigurationListener listener : listeners) {
- listener.configurationEvent(evt);
- }
- }
-
- @Override
- public void addListener(ConfigurationListener listener) {
- if (listener == null) {
- return;
- }
-
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(ConfigurationListener listener) {
- if (listener == null) {
- return;
- }
-
- listeners.remove(listener);
- }
-
-
- @Override
- public void addChangeListener(RegistryListener listener) {
- addRegistryChangeListener(listener);
-
- // keep track for later
- registryListeners.add(listener);
- }
-
- private void addRegistryChangeListener(RegistryListener listener) {
- Registry section = registry.getSection(KEY + ".user");
- if (section != null) {
- section.addChangeListener(listener);
- }
- section = registry.getSection(KEY + ".base");
- if (section != null) {
- section.addChangeListener(listener);
- }
- }
-
- @Override
- public void removeChangeListener(RegistryListener listener) {
- boolean removed = registryListeners.remove(listener);
- log.debug("RegistryListener: '{}' removed {}", listener, removed);
-
- Registry section = registry.getSection(KEY + ".user");
- if (section != null) {
- section.removeChangeListener(listener);
- }
- section = registry.getSection(KEY + ".base");
- if (section != null) {
- section.removeChangeListener(listener);
- }
-
- }
-
- @PostConstruct
- public void initialize() {
-
- // Resolve expressions in the userConfigFilename and altConfigFilename
- try {
- ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
- expressionEvaluator.addExpressionSource(new SystemPropertyExpressionSource());
- String userConfigFileNameSysProps = System.getProperty(USER_CONFIG_PROPERTY);
- if (StringUtils.isNotBlank(userConfigFileNameSysProps)) {
- userConfigFilename = userConfigFileNameSysProps;
- } else {
- String userConfigFileNameEnv = System.getenv(USER_CONFIG_ENVVAR);
- if (StringUtils.isNotBlank(userConfigFileNameEnv)) {
- userConfigFilename = userConfigFileNameEnv;
- } else {
- userConfigFilename = expressionEvaluator.expand(userConfigFilename);
- }
- }
- altConfigFilename = expressionEvaluator.expand(altConfigFilename);
- loadConfiguration();
- handleUpgradeConfiguration();
- } catch (IndeterminateConfigurationException | RegistryException e) {
- throw new RuntimeException("failed during upgrade from previous version" + e.getMessage(), e);
- } catch (EvaluatorException e) {
- throw new RuntimeException(
- "Unable to evaluate expressions found in " + "userConfigFilename or altConfigFilename.", e);
- }
- registry.addChangeListener(this);
- }
-
- /**
- * Handle upgrade to newer version
- */
- private void handleUpgradeConfiguration()
- throws RegistryException, IndeterminateConfigurationException {
-
- List<String> dbConsumers = Arrays.asList("update-db-artifact", "update-db-repository-metadata");
-
- // remove database consumers if here
- List<String> intersec =
- ListUtils.intersection(dbConsumers, configuration.getRepositoryScanning().getKnownContentConsumers());
-
- if (!intersec.isEmpty()) {
-
- List<String> knowContentConsumers =
- new ArrayList<>(configuration.getRepositoryScanning().getKnownContentConsumers().size());
- for (String knowContentConsumer : configuration.getRepositoryScanning().getKnownContentConsumers()) {
- if (!dbConsumers.contains(knowContentConsumer)) {
- knowContentConsumers.add(knowContentConsumer);
- }
- }
-
- configuration.getRepositoryScanning().setKnownContentConsumers(knowContentConsumers);
- }
-
- // ensure create-archiva-metadata is here
- if (!configuration.getRepositoryScanning().getKnownContentConsumers().contains("create-archiva-metadata")) {
- List<String> knowContentConsumers =
- new ArrayList<>(configuration.getRepositoryScanning().getKnownContentConsumers());
- knowContentConsumers.add("create-archiva-metadata");
- configuration.getRepositoryScanning().setKnownContentConsumers(knowContentConsumers);
- }
-
- // ensure duplicate-artifacts is here
- if (!configuration.getRepositoryScanning().getKnownContentConsumers().contains("duplicate-artifacts")) {
- List<String> knowContentConsumers =
- new ArrayList<>(configuration.getRepositoryScanning().getKnownContentConsumers());
- knowContentConsumers.add("duplicate-artifacts");
- configuration.getRepositoryScanning().setKnownContentConsumers(knowContentConsumers);
- }
-
- Registry defaultOnlyConfiguration = readDefaultOnlyConfiguration();
- // Currently we check only for configuration version change, not certain version numbers.
- if (hasConfigVersionChanged(configuration, defaultOnlyConfiguration)) {
- updateCheckPathDefaults(configuration, defaultOnlyConfiguration);
- String newVersion = defaultOnlyConfiguration.getString("version");
- if (newVersion == null) {
- throw new IndeterminateConfigurationException("The default configuration has no version information!");
- }
- configuration.setVersion(newVersion);
- try {
- save(configuration);
- } catch (IndeterminateConfigurationException e) {
- log.error("Error occured during configuration update to new version: {}", e.getMessage());
- } catch (RegistryException e) {
- log.error("Error occured during configuration update to new version: {}", e.getMessage());
- }
- }
- }
-
- @Override
- public void reload() {
- this.configuration = null;
- try {
- this.registry.initialize();
- } catch (RegistryException e) {
- throw new ConfigurationRuntimeException(e.getMessage(), e);
- }
- this.initialize();
- }
-
- @Override
- public Locale getDefaultLocale() {
- return defaultLocale;
- }
-
- @Override
- public List<Locale.LanguageRange> getLanguagePriorities() {
- return languagePriorities;
- }
-
- @Override
- public Path getAppServerBaseDir() {
- String basePath = registry.getString("appserver.base");
- if (!StringUtils.isEmpty(basePath)) {
- return Paths.get(basePath);
- } else {
- return Paths.get("");
- }
- }
-
- @Override
- public Path getRepositoryBaseDir() {
- if (repositoryBaseDirectory == null) {
- getConfiguration();
- }
- return repositoryBaseDirectory;
-
- }
-
- @Override
- public Path getRemoteRepositoryBaseDir() {
- if (remoteRepositoryBaseDirectory == null) {
- getConfiguration();
- }
- return remoteRepositoryBaseDirectory;
- }
-
- @Override
- public Path getRepositoryGroupBaseDir() {
- if (repositoryGroupBaseDirectory == null) {
- getConfiguration();
- }
- return repositoryGroupBaseDirectory;
- }
-
- @Override
- public Path getDataDirectory() {
- if (dataDirectory == null) {
- getConfiguration();
- }
- return dataDirectory;
- }
-
- @Override
- public void beforeConfigurationChange(Registry registry, String propertyName, Object propertyValue) {
- // nothing to do here
- }
-
- @Override
- public synchronized void afterConfigurationChange(Registry registry, String propertyName, Object propertyValue) {
- // configuration = null;
- // this.dataDirectory = null;
- // this.repositoryBaseDirectory = null;
- }
-
- private String removeExpressions(String directory) {
- String value = StringUtils.replace(directory, "${appserver.base}",
- registry.getString("appserver.base", "${appserver.base}"));
- value = StringUtils.replace(value, "${appserver.home}",
- registry.getString("appserver.home", "${appserver.home}"));
- return value;
- }
-
- private String unescapeCronExpression(String cronExpression) {
- return StringUtils.replace(cronExpression, "\\,", ",");
- }
-
- private String escapeCronExpression(String cronExpression) {
- return StringUtils.replace(cronExpression, ",", "\\,");
- }
-
- private Configuration unescapeExpressions(Configuration config) {
- // TODO: for commons-configuration 1.3 only
- for (ManagedRepositoryConfiguration c : config.getManagedRepositories()) {
- c.setLocation(removeExpressions(c.getLocation()));
- c.setRefreshCronExpression(unescapeCronExpression(c.getRefreshCronExpression()));
- }
-
- return config;
- }
-
- private Configuration checkRepositoryLocations(Configuration config) {
- // additional check for [MRM-789], ensure that the location of the default repositories
- // are not installed in the server installation
- for (ManagedRepositoryConfiguration repo : (List<ManagedRepositoryConfiguration>) config.getManagedRepositories()) {
- String repoPath = repo.getLocation();
- Path repoLocation = Paths.get(repoPath);
-
- if (Files.exists(repoLocation) && Files.isDirectory(repoLocation) && !repoPath.endsWith(
- "/repositories/" + repo.getId())) {
- repo.setLocation(repoPath + "/data/repositories/" + repo.getId());
- }
- }
-
- return config;
- }
-
- public String getUserConfigFilename() {
- return userConfigFilename;
- }
-
- public String getAltConfigFilename() {
- return altConfigFilename;
- }
-
- @Override
- public boolean isDefaulted() {
- return this.isConfigurationDefaulted;
- }
-
- public Registry getRegistry() {
- return registry;
- }
-
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
-
- public void setUserConfigFilename(String userConfigFilename) {
- this.userConfigFilename = userConfigFilename;
- }
-
- public void setAltConfigFilename(String altConfigFilename) {
- this.altConfigFilename = altConfigFilename;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * File Locking configuration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class FileLockConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * skipping the locking mechanism.
- */
- private boolean skipLocking = true;
-
- /**
- * maximum time to wait to get the file lock (0 infinite).
- */
- private int lockingTimeout = 0;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get maximum time to wait to get the file lock (0 infinite).
- *
- * @return int
- */
- public int getLockingTimeout()
- {
- return this.lockingTimeout;
- } //-- int getLockingTimeout()
-
- /**
- * Get skipping the locking mechanism.
- *
- * @return boolean
- */
- public boolean isSkipLocking()
- {
- return this.skipLocking;
- } //-- boolean isSkipLocking()
-
- /**
- * Set maximum time to wait to get the file lock (0 infinite).
- *
- * @param lockingTimeout
- */
- public void setLockingTimeout( int lockingTimeout )
- {
- this.lockingTimeout = lockingTimeout;
- } //-- void setLockingTimeout( int )
-
- /**
- * Set skipping the locking mechanism.
- *
- * @param skipLocking
- */
- public void setSkipLocking( boolean skipLocking )
- {
- this.skipLocking = skipLocking;
- } //-- void setSkipLocking( boolean )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The FileType object.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class FileType
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field id.
- */
- private String id;
-
- /**
- * Field patterns.
- */
- private java.util.List<String> patterns;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addPattern.
- *
- * @param string
- */
- public void addPattern( String string )
- {
- getPatterns().add( string );
- } //-- void addPattern( String )
-
- /**
- * Get the id field.
- *
- * @return String
- */
- public String getId()
- {
- return this.id;
- } //-- String getId()
-
- /**
- * Method getPatterns.
- *
- * @return List
- */
- public java.util.List<String> getPatterns()
- {
- if ( this.patterns == null )
- {
- this.patterns = new java.util.ArrayList<String>();
- }
-
- return this.patterns;
- } //-- java.util.List<String> getPatterns()
-
- /**
- * Method removePattern.
- *
- * @param string
- */
- public void removePattern( String string )
- {
- getPatterns().remove( string );
- } //-- void removePattern( String )
-
- /**
- * Set the id field.
- *
- * @param id
- */
- public void setId( String id )
- {
- this.id = id;
- } //-- void setId( String )
-
- /**
- * Set the patterns field.
- *
- * @param patterns
- */
- public void setPatterns( java.util.List<String> patterns )
- {
- this.patterns = patterns;
- } //-- void setPatterns( java.util.List )
-
-
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
- if ( o == null || getClass() != o.getClass() )
- {
- return false;
- }
-
- FileType fileType = (FileType) o;
-
- if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- return id != null ? 37 + id.hashCode() : 0;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.common.FileTypeUtils;
-import org.apache.archiva.configuration.functors.FiletypeSelectionPredicate;
-import org.apache.archiva.components.registry.Registry;
-import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.nio.file.FileSystems;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * FileTypes
- */
-@Service("fileTypes")
-public class FileTypes
- implements RegistryListener
-{
- public static final String ARTIFACTS = "artifacts";
-
- public static final String AUTO_REMOVE = "auto-remove";
-
- public static final String INDEXABLE_CONTENT = "indexable-content";
-
- public static final String IGNORED = "ignored";
-
- @Inject
- @Named(value = "archivaConfiguration#default")
- private ArchivaConfiguration archivaConfiguration;
-
-
- public FileTypes() {
-
- }
-
- /**
- * Map of default values for the file types.
- */
- private Map<String, List<String>> defaultTypeMap = new HashMap<>();
-
- private List<String> artifactPatterns;
-
- /**
- * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
- * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
- * artifacts and exclude later during scanning.
- *
- * @deprecated
- */
- public static final List<String> DEFAULT_EXCLUSIONS = FileTypeUtils.DEFAULT_EXCLUSIONS;
-
- public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
- {
- this.archivaConfiguration = archivaConfiguration;
- }
-
- /**
- * Get the list of patterns for a specified filetype.
- * You will always get a list. In this order.
- * <ul>
- * <li>The Configured List</li>
- * <li>The Default List</li>
- * <li>A single item list of <code>"**/*"</code></li>
- * </ul>
- *
- * @param id the id to lookup.
- * @return the list of patterns.
- */
- public List<String> getFileTypePatterns( String id )
- {
- Configuration config = archivaConfiguration.getConfiguration();
- Predicate selectedFiletype = new FiletypeSelectionPredicate( id );
- RepositoryScanningConfiguration repositoryScanningConfiguration = config.getRepositoryScanning();
- if ( repositoryScanningConfiguration != null )
- {
- FileType filetype =
- IterableUtils.find( config.getRepositoryScanning().getFileTypes(), selectedFiletype );
-
- if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) )
- {
- return filetype.getPatterns();
- }
- }
- List<String> defaultPatterns = defaultTypeMap.get( id );
-
- if ( CollectionUtils.isEmpty( defaultPatterns ) )
- {
- return Collections.singletonList( "**/*" );
- }
-
- return defaultPatterns;
- }
-
- public synchronized boolean matchesArtifactPattern( String relativePath )
- {
- // Correct the slash pattern.
- relativePath = relativePath.replace( '\\', '/' );
-
- if ( artifactPatterns == null )
- {
- artifactPatterns = getFileTypePatterns( ARTIFACTS );
- }
-
- for ( String pattern : artifactPatterns )
- {
- if ( FileSystems.getDefault().getPathMatcher( "glob:" + pattern).matches( Paths.get( relativePath ) ) )
- {
- // Found match
- return true;
- }
- }
-
- // No match.
- return false;
- }
-
- public boolean matchesDefaultExclusions( String relativePath )
- {
- // Correct the slash pattern.
- relativePath = relativePath.replace( '\\', '/' );
-
- for ( String pattern : DEFAULT_EXCLUSIONS )
- {
- if ( FileSystems.getDefault().getPathMatcher( "glob:" + pattern).matches( Paths.get( relativePath ) ) )
- {
- // Found match
- return true;
- }
- }
-
- // No match.
- return false;
- }
-
- @PostConstruct
- public void initialize()
- {
- initialiseTypeMap( this.archivaConfiguration.getConfiguration() );
-
- this.archivaConfiguration.addChangeListener( this );
- }
-
- private void initialiseTypeMap( Configuration configuration )
- {
- defaultTypeMap.clear();
-
- // Store the default file type declaration.
- List<FileType> filetypes = configuration.getRepositoryScanning().getFileTypes();
- for ( FileType filetype : filetypes )
- {
- List<String> patterns = defaultTypeMap.get( filetype.getId() );
- if ( patterns == null )
- {
- patterns = new ArrayList<>( filetype.getPatterns().size() );
- }
- patterns.addAll( filetype.getPatterns() );
-
- defaultTypeMap.put( filetype.getId(), patterns );
- }
- }
-
- @Override
- public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
- {
- if ( propertyName.contains( "fileType" ) )
- {
- artifactPatterns = null;
-
- initialiseTypeMap( archivaConfiguration.getConfiguration() );
- }
- }
-
- @Override
- public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
- {
- /* nothing to do */
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Occurs when the configuration is stored in two locations and the save location can not be determined.
- */
-public class IndeterminateConfigurationException
- extends Exception
-{
- public IndeterminateConfigurationException( String message )
- {
- super( message );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * An error in the configuration.
- */
-public class InvalidConfigurationException
- extends Exception
-{
- private final String name;
-
- public InvalidConfigurationException( String name, String message )
- {
- super( message );
- this.name = name;
- }
-
- public InvalidConfigurationException( String name, String message, Throwable cause )
- {
- super( message, cause );
-
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * The LDAP configuration.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class LdapConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * The LDAP host.
- */
- private String hostName;
-
- /**
- * The LDAP port.
- */
- private int port = 0;
-
- /**
- * ssl LDAP connection.
- */
- private boolean ssl = false;
-
- /**
- * The LDAP base dn.
- */
- private String baseDn;
-
- /**
- * The LDAP base dn for groups (if empty baseDn is used).
- */
- private String baseGroupsDn;
-
- /**
- * contextFactory to use.
- */
- private String contextFactory;
-
- /**
- * The LDAP bind dn.
- */
- private String bindDn;
-
- /**
- * The LDAP password.
- */
- private String password;
-
- /**
- * The LDAP authenticationMethod.
- */
- private String authenticationMethod;
-
- /**
- * The LDAP authenticator enabled.
- */
- private boolean bindAuthenticatorEnabled = false;
-
- /**
- * LDAP writable.
- */
- private boolean writable = false;
-
- /**
- * Will use role name as LDAP group.
- */
- private boolean useRoleNameAsGroup = false;
-
- /**
- * Field extraProperties.
- */
- private java.util.Map extraProperties;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addExtraProperty.
- *
- * @param key
- * @param value
- */
- public void addExtraProperty( Object key, String value )
- {
- getExtraProperties().put( key, value );
- } //-- void addExtraProperty( Object, String )
-
- /**
- * Get the LDAP authenticationMethod.
- *
- * @return String
- */
- public String getAuthenticationMethod()
- {
- return this.authenticationMethod;
- } //-- String getAuthenticationMethod()
-
- /**
- * Get the LDAP base dn.
- *
- * @return String
- */
- public String getBaseDn()
- {
- return this.baseDn;
- } //-- String getBaseDn()
-
- /**
- * Get the LDAP base dn for groups (if empty baseDn is used).
- *
- * @return String
- */
- public String getBaseGroupsDn()
- {
- return this.baseGroupsDn;
- } //-- String getBaseGroupsDn()
-
- /**
- * Get the LDAP bind dn.
- *
- * @return String
- */
- public String getBindDn()
- {
- return this.bindDn;
- } //-- String getBindDn()
-
- /**
- * Get contextFactory to use.
- *
- * @return String
- */
- public String getContextFactory()
- {
- return this.contextFactory;
- } //-- String getContextFactory()
-
- /**
- * Method getExtraProperties.
- *
- * @return Map
- */
- public java.util.Map getExtraProperties()
- {
- if ( this.extraProperties == null )
- {
- this.extraProperties = new java.util.HashMap();
- }
-
- return this.extraProperties;
- } //-- java.util.Map getExtraProperties()
-
- /**
- * Get the LDAP host.
- *
- * @return String
- */
- public String getHostName()
- {
- return this.hostName;
- } //-- String getHostName()
-
- /**
- * Get the LDAP password.
- *
- * @return String
- */
- public String getPassword()
- {
- return this.password;
- } //-- String getPassword()
-
- /**
- * Get the LDAP port.
- *
- * @return int
- */
- public int getPort()
- {
- return this.port;
- } //-- int getPort()
-
- /**
- * Get the LDAP authenticator enabled.
- *
- * @return boolean
- */
- public boolean isBindAuthenticatorEnabled()
- {
- return this.bindAuthenticatorEnabled;
- } //-- boolean isBindAuthenticatorEnabled()
-
- /**
- * Get ssl LDAP connection.
- *
- * @return boolean
- */
- public boolean isSsl()
- {
- return this.ssl;
- } //-- boolean isSsl()
-
- /**
- * Get will use role name as LDAP group.
- *
- * @return boolean
- */
- public boolean isUseRoleNameAsGroup()
- {
- return this.useRoleNameAsGroup;
- } //-- boolean isUseRoleNameAsGroup()
-
- /**
- * Get lDAP writable.
- *
- * @return boolean
- */
- public boolean isWritable()
- {
- return this.writable;
- } //-- boolean isWritable()
-
- /**
- * Set the LDAP authenticationMethod.
- *
- * @param authenticationMethod
- */
- public void setAuthenticationMethod( String authenticationMethod )
- {
- this.authenticationMethod = authenticationMethod;
- } //-- void setAuthenticationMethod( String )
-
- /**
- * Set the LDAP base dn.
- *
- * @param baseDn
- */
- public void setBaseDn( String baseDn )
- {
- this.baseDn = baseDn;
- } //-- void setBaseDn( String )
-
- /**
- * Set the LDAP base dn for groups (if empty baseDn is used).
- *
- * @param baseGroupsDn
- */
- public void setBaseGroupsDn( String baseGroupsDn )
- {
- this.baseGroupsDn = baseGroupsDn;
- } //-- void setBaseGroupsDn( String )
-
- /**
- * Set the LDAP authenticator enabled.
- *
- * @param bindAuthenticatorEnabled
- */
- public void setBindAuthenticatorEnabled( boolean bindAuthenticatorEnabled )
- {
- this.bindAuthenticatorEnabled = bindAuthenticatorEnabled;
- } //-- void setBindAuthenticatorEnabled( boolean )
-
- /**
- * Set the LDAP bind dn.
- *
- * @param bindDn
- */
- public void setBindDn( String bindDn )
- {
- this.bindDn = bindDn;
- } //-- void setBindDn( String )
-
- /**
- * Set contextFactory to use.
- *
- * @param contextFactory
- */
- public void setContextFactory( String contextFactory )
- {
- this.contextFactory = contextFactory;
- } //-- void setContextFactory( String )
-
- /**
- * Set additional properties to use for ldap connection.
- *
- * @param extraProperties
- */
- public void setExtraProperties( java.util.Map extraProperties )
- {
- this.extraProperties = extraProperties;
- } //-- void setExtraProperties( java.util.Map )
-
- /**
- * Set the LDAP host.
- *
- * @param hostName
- */
- public void setHostName( String hostName )
- {
- this.hostName = hostName;
- } //-- void setHostName( String )
-
- /**
- * Set the LDAP password.
- *
- * @param password
- */
- public void setPassword( String password )
- {
- this.password = password;
- } //-- void setPassword( String )
-
- /**
- * Set the LDAP port.
- *
- * @param port
- */
- public void setPort( int port )
- {
- this.port = port;
- } //-- void setPort( int )
-
- /**
- * Set ssl LDAP connection.
- *
- * @param ssl
- */
- public void setSsl( boolean ssl )
- {
- this.ssl = ssl;
- } //-- void setSsl( boolean )
-
- /**
- * Set will use role name as LDAP group.
- *
- * @param useRoleNameAsGroup
- */
- public void setUseRoleNameAsGroup( boolean useRoleNameAsGroup )
- {
- this.useRoleNameAsGroup = useRoleNameAsGroup;
- } //-- void setUseRoleNameAsGroup( boolean )
-
- /**
- * Set lDAP writable.
- *
- * @param writable
- */
- public void setWritable( boolean writable )
- {
- this.writable = writable;
- } //-- void setWritable( boolean )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * configuration of a LDAP group to Archiva roles.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class LdapGroupMapping
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * LDAP Group.
- */
- private String group;
-
- /**
- * Field roleNames.
- */
- private java.util.List<String> roleNames;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addRoleName.
- *
- * @param string
- */
- public void addRoleName( String string )
- {
- getRoleNames().add( string );
- } //-- void addRoleName( String )
-
- /**
- * Get lDAP Group.
- *
- * @return String
- */
- public String getGroup()
- {
- return this.group;
- } //-- String getGroup()
-
- /**
- * Method getRoleNames.
- *
- * @return List
- */
- public java.util.List<String> getRoleNames()
- {
- if ( this.roleNames == null )
- {
- this.roleNames = new java.util.ArrayList<String>();
- }
-
- return this.roleNames;
- } //-- java.util.List<String> getRoleNames()
-
- /**
- * Method removeRoleName.
- *
- * @param string
- */
- public void removeRoleName( String string )
- {
- getRoleNames().remove( string );
- } //-- void removeRoleName( String )
-
- /**
- * Set lDAP Group.
- *
- * @param group
- */
- public void setGroup( String group )
- {
- this.group = group;
- } //-- void setGroup( String )
-
- /**
- * Set archiva roles.
- *
- * @param roleNames
- */
- public void setRoleNames( java.util.List<String> roleNames )
- {
- this.roleNames = roleNames;
- } //-- void setRoleNames( java.util.List )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class LegacyArtifactPath.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class LegacyArtifactPath
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The legacy path.
- *
- */
- private String path;
-
- /**
- *
- * The artifact reference, as " [groupId] :
- * [artifactId] : [version] : [classifier] : [type] ".
- *
- */
- private String artifact;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the artifact reference, as " [groupId] : [artifactId] :
- * [version] : [classifier] : [type] ".
- *
- * @return String
- */
- public String getArtifact()
- {
- return this.artifact;
- } //-- String getArtifact()
-
- /**
- * Get the legacy path.
- *
- * @return String
- */
- public String getPath()
- {
- return this.path;
- } //-- String getPath()
-
- /**
- * Set the artifact reference, as " [groupId] : [artifactId] :
- * [version] : [classifier] : [type] ".
- *
- * @param artifact
- */
- public void setArtifact( String artifact )
- {
- this.artifact = artifact;
- } //-- void setArtifact( String )
-
- /**
- * Set the legacy path.
- *
- * @param path
- */
- public void setPath( String path )
- {
- this.path = path;
- } //-- void setPath( String )
-
-
- public boolean match( String path )
- {
- return path.equals( this.path );
- }
-
- public String getGroupId()
- {
- return artifact.split( ":" )[0];
- }
-
- public String getArtifactId()
- {
- return artifact.split( ":" )[1];
- }
-
- public String getVersion()
- {
- return artifact.split( ":" )[2];
- }
-
- public String getClassifier()
- {
- String classifier = artifact.split( ":" )[3];
- return classifier.length() > 0 ? classifier : null;
- }
-
- public String getType()
- {
- return artifact.split( ":" )[4];
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
- if ( o == null || getClass() != o.getClass() )
- {
- return false;
- }
-
- LegacyArtifactPath that = (LegacyArtifactPath) o;
-
- if ( path != null ? !path.equals( that.path ) : that.path != null )
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- return path != null ? 37 + path.hashCode() : 0;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class ManagedRepositoryConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class ManagedRepositoryConfiguration
- extends AbstractRepositoryConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The file system location for this repository.
- *
- */
- private String location;
-
- /**
- * True if this repository contains release versioned artifacts.
- */
- private boolean releases = true;
-
- /**
- * True if re-deployment of artifacts already in the repository
- * will be blocked.
- */
- private boolean blockRedeployments = false;
-
- /**
- * True if this repository contains snapshot versioned artifacts
- */
- private boolean snapshots = false;
-
- /**
- * True if this repository should be scanned and processed.
- */
- private boolean scanned = true;
-
- /**
- *
- * When to run the refresh task.
- * Default is every hour
- * .
- */
- private String refreshCronExpression = "0 0 * * * ?";
-
- /**
- *
- * The total count of the artifact to be retained
- * for each snapshot.
- *
- */
- private int retentionCount = 2;
-
- /**
- *
- * The number of days after which snapshots will be
- * removed.
- *
- */
- private int retentionPeriod = 100;
-
- /**
- *
- * True if the released snapshots are to be removed
- * from the repo during repository purge.
- *
- */
- private boolean deleteReleasedSnapshots = false;
-
- /**
- *
- * True to not generate packed index (note you
- * won't be able to export your index.
- *
- */
- private boolean skipPackedIndexCreation = false;
-
- /**
- *
- * Need a staging repository
- * .
- */
- private boolean stageRepoNeeded = false;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the file system location for this repository.
- *
- * @return String
- */
- public String getLocation()
- {
- return this.location;
- } //-- String getLocation()
-
- /**
- * Get when to run the refresh task.
- * Default is every hour.
- *
- * @return String
- */
- public String getRefreshCronExpression()
- {
- return this.refreshCronExpression;
- } //-- String getRefreshCronExpression()
-
- /**
- * Get the total count of the artifact to be retained for each
- * snapshot.
- *
- * @return int
- */
- public int getRetentionCount()
- {
- return this.retentionCount;
- } //-- int getRetentionCount()
-
- /**
- * Get the number of days after which snapshots will be
- * removed.
- *
- * @return int
- */
- public int getRetentionPeriod()
- {
- return this.retentionPeriod;
- } //-- int getRetentionPeriod()
-
- /**
- * Get true if re-deployment of artifacts already in the
- * repository will be blocked.
- *
- * @return boolean
- */
- public boolean isBlockRedeployments()
- {
- return this.blockRedeployments;
- } //-- boolean isBlockRedeployments()
-
- /**
- * Get true if the released snapshots are to be removed from
- * the repo during repository purge.
- *
- * @return boolean
- */
- public boolean isDeleteReleasedSnapshots()
- {
- return this.deleteReleasedSnapshots;
- } //-- boolean isDeleteReleasedSnapshots()
-
- /**
- * Get true if this repository contains release versioned
- * artifacts.
- *
- * @return boolean
- */
- public boolean isReleases()
- {
- return this.releases;
- } //-- boolean isReleases()
-
- /**
- * Get true if this repository should be scanned and processed.
- *
- * @return boolean
- */
- public boolean isScanned()
- {
- return this.scanned;
- } //-- boolean isScanned()
-
- /**
- * Get true to not generate packed index (note you won't be
- * able to export your index.
- *
- * @return boolean
- */
- public boolean isSkipPackedIndexCreation()
- {
- return this.skipPackedIndexCreation;
- } //-- boolean isSkipPackedIndexCreation()
-
- /**
- * Get true if this repository contains snapshot versioned
- * artifacts.
- *
- * @return boolean
- */
- public boolean isSnapshots()
- {
- return this.snapshots;
- } //-- boolean isSnapshots()
-
- /**
- * Get need a staging repository.
- *
- * @return boolean
- */
- public boolean isStageRepoNeeded()
- {
- return this.stageRepoNeeded;
- } //-- boolean isStageRepoNeeded()
-
- /**
- * Set true if re-deployment of artifacts already in the
- * repository will be blocked.
- *
- * @param blockRedeployments
- */
- public void setBlockRedeployments( boolean blockRedeployments )
- {
- this.blockRedeployments = blockRedeployments;
- } //-- void setBlockRedeployments( boolean )
-
- /**
- * Set true if the released snapshots are to be removed from
- * the repo during repository purge.
- *
- * @param deleteReleasedSnapshots
- */
- public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
- {
- this.deleteReleasedSnapshots = deleteReleasedSnapshots;
- } //-- void setDeleteReleasedSnapshots( boolean )
-
- /**
- * Set the file system location for this repository.
- *
- * @param location
- */
- public void setLocation( String location )
- {
- this.location = location;
- } //-- void setLocation( String )
-
- /**
- * Set when to run the refresh task.
- * Default is every hour.
- *
- * @param refreshCronExpression
- */
- public void setRefreshCronExpression( String refreshCronExpression )
- {
- this.refreshCronExpression = refreshCronExpression;
- } //-- void setRefreshCronExpression( String )
-
- /**
- * Set true if this repository contains release versioned
- * artifacts.
- *
- * @param releases
- */
- public void setReleases( boolean releases )
- {
- this.releases = releases;
- } //-- void setReleases( boolean )
-
- /**
- * Set the total count of the artifact to be retained for each
- * snapshot.
- *
- * @param retentionCount
- */
- public void setRetentionCount( int retentionCount )
- {
- this.retentionCount = retentionCount;
- } //-- void setRetentionCount( int )
-
- /**
- * Set the number of days after which snapshots will be
- * removed.
- *
- * @param retentionPeriod
- */
- public void setRetentionPeriod( int retentionPeriod )
- {
- this.retentionPeriod = retentionPeriod;
- } //-- void setRetentionPeriod( int )
-
- /**
- * Set true if this repository should be scanned and processed.
- *
- * @param scanned
- */
- public void setScanned( boolean scanned )
- {
- this.scanned = scanned;
- } //-- void setScanned( boolean )
-
- /**
- * Set true to not generate packed index (note you won't be
- * able to export your index.
- *
- * @param skipPackedIndexCreation
- */
- public void setSkipPackedIndexCreation( boolean skipPackedIndexCreation )
- {
- this.skipPackedIndexCreation = skipPackedIndexCreation;
- } //-- void setSkipPackedIndexCreation( boolean )
-
- /**
- * Set true if this repository contains snapshot versioned
- * artifacts.
- *
- * @param snapshots
- */
- public void setSnapshots( boolean snapshots )
- {
- this.snapshots = snapshots;
- } //-- void setSnapshots( boolean )
-
- /**
- * Set need a staging repository.
- *
- * @param stageRepoNeeded
- */
- public void setStageRepoNeeded( boolean stageRepoNeeded )
- {
- this.stageRepoNeeded = stageRepoNeeded;
- } //-- void setStageRepoNeeded( boolean )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.policies.ReleasesPolicy;
-import org.apache.archiva.policies.SnapshotsPolicy;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-/**
- */
-public class MavenProxyPropertyLoader
-{
- private static final String REPO_LOCAL_STORE = "repo.local.store";
-
- private static final String PROXY_LIST = "proxy.list";
-
- private static final String REPO_LIST = "repo.list";
-
- public void load( Properties props, Configuration configuration )
- throws InvalidConfigurationException
- {
- // set up the managed repository
- String localCachePath = getMandatoryProperty( props, REPO_LOCAL_STORE );
-
- ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration();
- config.setLocation( localCachePath );
- config.setName( "Imported Maven-Proxy Cache" );
- config.setId( "maven-proxy" );
- config.setScanned( false );
- config.setReleases( true );
- config.setSnapshots( false );
- configuration.addManagedRepository( config );
-
- // Add the network proxies.
- String propertyList = props.getProperty( PROXY_LIST );
- if ( propertyList != null )
- {
- StringTokenizer tok = new StringTokenizer( propertyList, "," );
- while ( tok.hasMoreTokens() )
- {
- String key = tok.nextToken();
- if ( StringUtils.isNotEmpty( key ) )
- {
- NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
- proxy.setHost( getMandatoryProperty( props, "proxy." + key + ".host" ) );
- proxy.setPort( Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) ) );
-
- // the username and password isn't required
- proxy.setUsername( props.getProperty( "proxy." + key + ".username" ) );
- proxy.setPassword( props.getProperty( "proxy." + key + ".password" ) );
-
- configuration.addNetworkProxy( proxy );
- }
- }
- }
-
- // Add the remote repository list
- String repoList = getMandatoryProperty( props, REPO_LIST );
-
- StringTokenizer tok = new StringTokenizer( repoList, "," );
- while ( tok.hasMoreTokens() )
- {
- String key = tok.nextToken();
-
- Properties repoProps = getSubset( props, "repo." + key + "." );
- String url = getMandatoryProperty( props, "repo." + key + ".url" );
- String proxyKey = repoProps.getProperty( "proxy" );
-
-// int cachePeriod = Integer.parseInt( repoProps.getProperty( "cache.period", "60" ) );
-
- RemoteRepositoryConfiguration repository = new RemoteRepositoryConfiguration();
- repository.setId( key );
- repository.setName( "Imported Maven-Proxy Remote Proxy" );
- repository.setUrl( url );
- repository.setLayout( "legacy" );
-
- configuration.addRemoteRepository( repository );
-
- ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration();
- proxyConnector.setSourceRepoId( "maven-proxy" );
- proxyConnector.setTargetRepoId( key );
- proxyConnector.setProxyId( proxyKey );
- // TODO: convert cachePeriod to closest "daily" or "hourly"
- proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, SnapshotsPolicy.DAILY.getId() );
- proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.ALWAYS.getId() );
-
- configuration.addProxyConnector( proxyConnector );
- }
- }
-
- @SuppressWarnings( "unchecked" )
- private Properties getSubset( Properties props, String prefix )
- {
- Enumeration keys = props.keys();
- Properties result = new Properties();
- while ( keys.hasMoreElements() )
- {
- String key = (String) keys.nextElement();
- String value = props.getProperty( key );
- if ( key.startsWith( prefix ) )
- {
- String newKey = key.substring( prefix.length() );
- result.setProperty( newKey, value );
- }
- }
- return result;
- }
-
- public void load( InputStream is, Configuration configuration )
- throws IOException, InvalidConfigurationException
- {
- Properties props = new Properties();
- props.load( is );
- load( props, configuration );
- }
-
- private String getMandatoryProperty( Properties props, String key )
- throws InvalidConfigurationException
- {
- String value = props.getProperty( key );
-
- if ( value == null )
- {
- throw new InvalidConfigurationException( key, "Missing required field: " + key );
- }
-
- return value;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * The network configuration for external http request to
- * repositories.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class NetworkConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * maximum total external http connections.
- */
- private int maxTotal = 30;
-
- /**
- * maximum total external http connections per host.
- */
- private int maxTotalPerHost = 30;
-
- /**
- * use or not http connection pooling default true.
- */
- private boolean usePooling = true;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get maximum total external http connections.
- *
- * @return int
- */
- public int getMaxTotal()
- {
- return this.maxTotal;
- } //-- int getMaxTotal()
-
- /**
- * Get maximum total external http connections per host.
- *
- * @return int
- */
- public int getMaxTotalPerHost()
- {
- return this.maxTotalPerHost;
- } //-- int getMaxTotalPerHost()
-
- /**
- * Get use or not http connection pooling default true.
- *
- * @return boolean
- */
- public boolean isUsePooling()
- {
- return this.usePooling;
- } //-- boolean isUsePooling()
-
- /**
- * Set maximum total external http connections.
- *
- * @param maxTotal
- */
- public void setMaxTotal( int maxTotal )
- {
- this.maxTotal = maxTotal;
- } //-- void setMaxTotal( int )
-
- /**
- * Set maximum total external http connections per host.
- *
- * @param maxTotalPerHost
- */
- public void setMaxTotalPerHost( int maxTotalPerHost )
- {
- this.maxTotalPerHost = maxTotalPerHost;
- } //-- void setMaxTotalPerHost( int )
-
- /**
- * Set use or not http connection pooling default true.
- *
- * @param usePooling
- */
- public void setUsePooling( boolean usePooling )
- {
- this.usePooling = usePooling;
- } //-- void setUsePooling( boolean )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class NetworkProxyConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class NetworkProxyConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The ID for this proxy.
- *
- */
- private String id;
-
- /**
- *
- * The network protocol to use with this proxy:
- * "http", "socks-4"
- * .
- */
- private String protocol = "http";
-
- /**
- *
- * The proxy host.
- *
- */
- private String host;
-
- /**
- *
- * The proxy port.
- *
- */
- private int port = 8080;
-
- /**
- *
- * The proxy user.
- *
- */
- private String username;
-
- /**
- *
- * The proxy password.
- *
- */
- private String password;
-
- /**
- *
- * Use ntlm authentification.
- *
- */
- private boolean useNtlm = false;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the proxy host.
- *
- * @return String
- */
- public String getHost()
- {
- return this.host;
- } //-- String getHost()
-
- /**
- * Get the ID for this proxy.
- *
- * @return String
- */
- public String getId()
- {
- return this.id;
- } //-- String getId()
-
- /**
- * Get the proxy password.
- *
- * @return String
- */
- public String getPassword()
- {
- return this.password;
- } //-- String getPassword()
-
- /**
- * Get the proxy port.
- *
- * @return int
- */
- public int getPort()
- {
- return this.port;
- } //-- int getPort()
-
- /**
- * Get the network protocol to use with this proxy: "http",
- * "socks-4".
- *
- * @return String
- */
- public String getProtocol()
- {
- return this.protocol;
- } //-- String getProtocol()
-
- /**
- * Get the proxy user.
- *
- * @return String
- */
- public String getUsername()
- {
- return this.username;
- } //-- String getUsername()
-
- /**
- * Get use ntlm authentification.
- *
- * @return boolean
- */
- public boolean isUseNtlm()
- {
- return this.useNtlm;
- } //-- boolean isUseNtlm()
-
- /**
- * Set the proxy host.
- *
- * @param host
- */
- public void setHost( String host )
- {
- this.host = host;
- } //-- void setHost( String )
-
- /**
- * Set the ID for this proxy.
- *
- * @param id
- */
- public void setId( String id )
- {
- this.id = id;
- } //-- void setId( String )
-
- /**
- * Set the proxy password.
- *
- * @param password
- */
- public void setPassword( String password )
- {
- this.password = password;
- } //-- void setPassword( String )
-
- /**
- * Set the proxy port.
- *
- * @param port
- */
- public void setPort( int port )
- {
- this.port = port;
- } //-- void setPort( int )
-
- /**
- * Set the network protocol to use with this proxy: "http",
- * "socks-4".
- *
- * @param protocol
- */
- public void setProtocol( String protocol )
- {
- this.protocol = protocol;
- } //-- void setProtocol( String )
-
- /**
- * Set use ntlm authentification.
- *
- * @param useNtlm
- */
- public void setUseNtlm( boolean useNtlm )
- {
- this.useNtlm = useNtlm;
- } //-- void setUseNtlm( boolean )
-
- /**
- * Set the proxy user.
- *
- * @param username
- */
- public void setUsername( String username )
- {
- this.username = username;
- } //-- void setUsername( String )
-
-
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + ( id != null ? id.hashCode() : 0 );
- return result;
- }
-
- public boolean equals( Object other )
- {
- if ( this == other )
- {
- return true;
- }
-
- if ( !( other instanceof NetworkProxyConfiguration ) )
- {
- return false;
- }
-
- NetworkProxyConfiguration that = (NetworkProxyConfiguration) other;
- boolean result = true;
- result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
- return result;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * The organisation information settings.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class OrganisationInformation
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * name of the organisation.
- */
- private String name;
-
- /**
- * name of the organisation.
- */
- private String url;
-
- /**
- * name of the organisation.
- */
- private String logoLocation;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get name of the organisation.
- *
- * @return String
- */
- public String getLogoLocation()
- {
- return this.logoLocation;
- } //-- String getLogoLocation()
-
- /**
- * Get name of the organisation.
- *
- * @return String
- */
- public String getName()
- {
- return this.name;
- } //-- String getName()
-
- /**
- * Get name of the organisation.
- *
- * @return String
- */
- public String getUrl()
- {
- return this.url;
- } //-- String getUrl()
-
- /**
- * Set name of the organisation.
- *
- * @param logoLocation
- */
- public void setLogoLocation( String logoLocation )
- {
- this.logoLocation = logoLocation;
- } //-- void setLogoLocation( String )
-
- /**
- * Set name of the organisation.
- *
- * @param name
- */
- public void setName( String name )
- {
- this.name = name;
- } //-- void setName( String )
-
- /**
- * Set name of the organisation.
- *
- * @param url
- */
- public void setUrl( String url )
- {
- this.url = url;
- } //-- void setUrl( String )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class ProxyConnectorConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class ProxyConnectorConfiguration
- extends AbstractRepositoryConnectorConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The order of the proxy connectors. (0 means no
- * order specified)
- * .
- */
- private int order = 0;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the order of the proxy connectors. (0 means no order
- * specified).
- *
- * @return int
- */
- public int getOrder()
- {
- return this.order;
- } //-- int getOrder()
-
- /**
- * Set the order of the proxy connectors. (0 means no order
- * specified).
- *
- * @param order
- */
- public void setOrder( int order )
- {
- this.order = order;
- } //-- void setOrder( int )
-
-
- /**
- * The order id for UNORDERED
- */
- public static final int UNORDERED = 0;
-
- /**
- * The policy key {@link #getPolicies()} for error handling.
- * See {@link org.apache.archiva.policies.DownloadErrorPolicy}
- * for details on potential values to this policy key.
- */
- public static final String POLICY_PROPAGATE_ERRORS = "propagate-errors";
-
- /**
- * The policy key {@link #getPolicies()} for error handling when an artifact is present.
- * See {@link org.apache.archiva.policies.DownloadErrorPolicy}
- * for details on potential values to this policy key.
- */
- public static final String POLICY_PROPAGATE_ERRORS_ON_UPDATE = "propagate-errors-on-update";
-
- /**
- * The policy key {@link #getPolicies()} for snapshot handling.
- * See {@link org.apache.archiva.policies.SnapshotsPolicy}
- * for details on potential values to this policy key.
- */
- public static final String POLICY_SNAPSHOTS = "snapshots";
-
- /**
- * The policy key {@link #getPolicies()} for releases handling.
- * See {@link org.apache.archiva.policies.ReleasesPolicy}
- * for details on potential values to this policy key.
- */
- public static final String POLICY_RELEASES = "releases";
-
- /**
- * The policy key {@link #getPolicies()} for checksum handling.
- * See {@link org.apache.archiva.policies.ChecksumPolicy}
- * for details on potential values to this policy key.
- */
- public static final String POLICY_CHECKSUM = "checksum";
-
- /**
- * The policy key {@link #getPolicies()} for cache-failures handling.
- * See {@link org.apache.archiva.policies.CachedFailuresPolicy}
- * for details on potential values to this policy key.
- */
- public static final String POLICY_CACHE_FAILURES = "cache-failures";
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class ProxyConnectorRuleConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class ProxyConnectorRuleConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The type if this rule: whiteList, blackList
- * etc..
- *
- */
- private String ruleType;
-
- /**
- *
- * The pattern for this rule: whiteList, blackList
- * etc..
- *
- */
- private String pattern;
-
- /**
- * Field proxyConnectors.
- */
- private java.util.List<ProxyConnectorConfiguration> proxyConnectors;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addProxyConnector.
- *
- * @param proxyConnectorConfiguration
- */
- public void addProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
- {
- getProxyConnectors().add( proxyConnectorConfiguration );
- } //-- void addProxyConnector( ProxyConnectorConfiguration )
-
- /**
- * Get the pattern for this rule: whiteList, blackList etc..
- *
- * @return String
- */
- public String getPattern()
- {
- return this.pattern;
- } //-- String getPattern()
-
- /**
- * Method getProxyConnectors.
- *
- * @return List
- */
- public java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
- {
- if ( this.proxyConnectors == null )
- {
- this.proxyConnectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
- }
-
- return this.proxyConnectors;
- } //-- java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
-
- /**
- * Get the type if this rule: whiteList, blackList etc..
- *
- * @return String
- */
- public String getRuleType()
- {
- return this.ruleType;
- } //-- String getRuleType()
-
- /**
- * Method removeProxyConnector.
- *
- * @param proxyConnectorConfiguration
- */
- public void removeProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
- {
- getProxyConnectors().remove( proxyConnectorConfiguration );
- } //-- void removeProxyConnector( ProxyConnectorConfiguration )
-
- /**
- * Set the pattern for this rule: whiteList, blackList etc..
- *
- * @param pattern
- */
- public void setPattern( String pattern )
- {
- this.pattern = pattern;
- } //-- void setPattern( String )
-
- /**
- * Set associated proxyConnectors configuration.
- *
- * @param proxyConnectors
- */
- public void setProxyConnectors( java.util.List<ProxyConnectorConfiguration> proxyConnectors )
- {
- this.proxyConnectors = proxyConnectors;
- } //-- void setProxyConnectors( java.util.List )
-
- /**
- * Set the type if this rule: whiteList, blackList etc..
- *
- * @param ruleType
- */
- public void setRuleType( String ruleType )
- {
- this.ruleType = ruleType;
- } //-- void setRuleType( String )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * The redback runtime configuration.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class RedbackRuntimeConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * flag to know if redback configuration has been
- * checked/migrated.
- */
- private boolean migratedFromRedbackConfiguration = false;
-
- /**
- * Field userManagerImpls.
- */
- private java.util.List<String> userManagerImpls;
-
- /**
- * Field rbacManagerImpls.
- */
- private java.util.List<String> rbacManagerImpls;
-
- /**
- * the ldap configuration.
- */
- private LdapConfiguration ldapConfiguration;
-
- /**
- * Field ldapGroupMappings.
- */
- private java.util.List<LdapGroupMapping> ldapGroupMappings;
-
- /**
- * Field configurationProperties.
- */
- private java.util.Map configurationProperties;
-
- /**
- * flag to know if redback will use a cache to prevent
- * searching users already found.
- */
- private boolean useUsersCache = true;
-
- /**
- * the users cache configuration.
- */
- private CacheConfiguration usersCacheConfiguration;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addConfigurationProperty.
- *
- * @param key
- * @param value
- */
- public void addConfigurationProperty( Object key, String value )
- {
- getConfigurationProperties().put( key, value );
- } //-- void addConfigurationProperty( Object, String )
-
- /**
- * Method addLdapGroupMapping.
- *
- * @param ldapGroupMapping
- */
- public void addLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
- {
- getLdapGroupMappings().add( ldapGroupMapping );
- } //-- void addLdapGroupMapping( LdapGroupMapping )
-
- /**
- * Method addRbacManagerImpl.
- *
- * @param string
- */
- public void addRbacManagerImpl( String string )
- {
- getRbacManagerImpls().add( string );
- } //-- void addRbacManagerImpl( String )
-
- /**
- * Method addUserManagerImpl.
- *
- * @param string
- */
- public void addUserManagerImpl( String string )
- {
- getUserManagerImpls().add( string );
- } //-- void addUserManagerImpl( String )
-
- /**
- * Method getConfigurationProperties.
- *
- * @return Map
- */
- public java.util.Map getConfigurationProperties()
- {
- if ( this.configurationProperties == null )
- {
- this.configurationProperties = new java.util.HashMap();
- }
-
- return this.configurationProperties;
- } //-- java.util.Map getConfigurationProperties()
-
- /**
- * Get the ldap configuration.
- *
- * @return LdapConfiguration
- */
- public LdapConfiguration getLdapConfiguration()
- {
- return this.ldapConfiguration;
- } //-- LdapConfiguration getLdapConfiguration()
-
- /**
- * Method getLdapGroupMappings.
- *
- * @return List
- */
- public java.util.List<LdapGroupMapping> getLdapGroupMappings()
- {
- if ( this.ldapGroupMappings == null )
- {
- this.ldapGroupMappings = new java.util.ArrayList<LdapGroupMapping>();
- }
-
- return this.ldapGroupMappings;
- } //-- java.util.List<LdapGroupMapping> getLdapGroupMappings()
-
- /**
- * Method getRbacManagerImpls.
- *
- * @return List
- */
- public java.util.List<String> getRbacManagerImpls()
- {
- if ( this.rbacManagerImpls == null )
- {
- this.rbacManagerImpls = new java.util.ArrayList<String>();
- }
-
- return this.rbacManagerImpls;
- } //-- java.util.List<String> getRbacManagerImpls()
-
- /**
- * Method getUserManagerImpls.
- *
- * @return List
- */
- public java.util.List<String> getUserManagerImpls()
- {
- if ( this.userManagerImpls == null )
- {
- this.userManagerImpls = new java.util.ArrayList<String>();
- }
-
- return this.userManagerImpls;
- } //-- java.util.List<String> getUserManagerImpls()
-
- /**
- * Get the users cache configuration.
- *
- * @return CacheConfiguration
- */
- public CacheConfiguration getUsersCacheConfiguration()
- {
- return this.usersCacheConfiguration;
- } //-- CacheConfiguration getUsersCacheConfiguration()
-
- /**
- * Get flag to know if redback configuration has been
- * checked/migrated.
- *
- * @return boolean
- */
- public boolean isMigratedFromRedbackConfiguration()
- {
- return this.migratedFromRedbackConfiguration;
- } //-- boolean isMigratedFromRedbackConfiguration()
-
- /**
- * Get flag to know if redback will use a cache to prevent
- * searching users already found.
- *
- * @return boolean
- */
- public boolean isUseUsersCache()
- {
- return this.useUsersCache;
- } //-- boolean isUseUsersCache()
-
- /**
- * Method removeLdapGroupMapping.
- *
- * @param ldapGroupMapping
- */
- public void removeLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
- {
- getLdapGroupMappings().remove( ldapGroupMapping );
- } //-- void removeLdapGroupMapping( LdapGroupMapping )
-
- /**
- * Method removeRbacManagerImpl.
- *
- * @param string
- */
- public void removeRbacManagerImpl( String string )
- {
- getRbacManagerImpls().remove( string );
- } //-- void removeRbacManagerImpl( String )
-
- /**
- * Method removeUserManagerImpl.
- *
- * @param string
- */
- public void removeUserManagerImpl( String string )
- {
- getUserManagerImpls().remove( string );
- } //-- void removeUserManagerImpl( String )
-
- /**
- * Set extra properties for redback configuration.
- * String/String.
- *
- * @param configurationProperties
- */
- public void setConfigurationProperties( java.util.Map configurationProperties )
- {
- this.configurationProperties = configurationProperties;
- } //-- void setConfigurationProperties( java.util.Map )
-
- /**
- * Set the ldap configuration.
- *
- * @param ldapConfiguration
- */
- public void setLdapConfiguration( LdapConfiguration ldapConfiguration )
- {
- this.ldapConfiguration = ldapConfiguration;
- } //-- void setLdapConfiguration( LdapConfiguration )
-
- /**
- * Set ldapGroupMappings.
- *
- * @param ldapGroupMappings
- */
- public void setLdapGroupMappings( java.util.List<LdapGroupMapping> ldapGroupMappings )
- {
- this.ldapGroupMappings = ldapGroupMappings;
- } //-- void setLdapGroupMappings( java.util.List )
-
- /**
- * Set flag to know if redback configuration has been
- * checked/migrated.
- *
- * @param migratedFromRedbackConfiguration
- */
- public void setMigratedFromRedbackConfiguration( boolean migratedFromRedbackConfiguration )
- {
- this.migratedFromRedbackConfiguration = migratedFromRedbackConfiguration;
- } //-- void setMigratedFromRedbackConfiguration( boolean )
-
- /**
- * Set the RBAC Manager impls to use.
- *
- * @param rbacManagerImpls
- */
- public void setRbacManagerImpls( java.util.List<String> rbacManagerImpls )
- {
- this.rbacManagerImpls = rbacManagerImpls;
- } //-- void setRbacManagerImpls( java.util.List )
-
- /**
- * Set flag to know if redback will use a cache to prevent
- * searching users already found.
- *
- * @param useUsersCache
- */
- public void setUseUsersCache( boolean useUsersCache )
- {
- this.useUsersCache = useUsersCache;
- } //-- void setUseUsersCache( boolean )
-
- /**
- * Set the user manager impls to use.
- *
- * @param userManagerImpls
- */
- public void setUserManagerImpls( java.util.List<String> userManagerImpls )
- {
- this.userManagerImpls = userManagerImpls;
- } //-- void setUserManagerImpls( java.util.List )
-
- /**
- * Set the users cache configuration.
- *
- * @param usersCacheConfiguration
- */
- public void setUsersCacheConfiguration( CacheConfiguration usersCacheConfiguration )
- {
- this.usersCacheConfiguration = usersCacheConfiguration;
- } //-- void setUsersCacheConfiguration( CacheConfiguration )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class RemoteRepositoryConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class RemoteRepositoryConfiguration
- extends AbstractRepositoryConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The URL for this repository.
- *
- */
- private String url;
-
- /**
- *
- * The Username for this repository.
- *
- */
- private String username;
-
- /**
- *
- * The Password for this repository.
- *
- */
- private String password;
-
- /**
- *
- * Timeout in seconds for connections to this
- * repository
- * .
- */
- private int timeout = 60;
-
- /**
- *
- * When to run the refresh task.
- * Default is every sunday at 8H00.
- *
- */
- private String refreshCronExpression = "0 0 08 ? * SUN";
-
- /**
- *
- * Activate download of remote index if
- * remoteIndexUrl is set too.
- *
- */
- private boolean downloadRemoteIndex = false;
-
- /**
- *
- * Remote Index Url : if not starting with http
- * will be relative to the remote repository url.
- *
- */
- private String remoteIndexUrl;
-
- /**
- *
- * Id of the networkProxy to use when downloading
- * remote index.
- *
- */
- private String remoteDownloadNetworkProxyId;
-
- /**
- *
- * Timeout in seconds for download remote index.
- * Default is more long than artifact download.
- *
- */
- private int remoteDownloadTimeout = 300;
-
- /**
- *
- * Schedule download of remote index when archiva
- * start
- * .
- */
- private boolean downloadRemoteIndexOnStartup = false;
-
- /**
- * Field extraParameters.
- */
- private java.util.Map extraParameters;
-
- /**
- * Field extraHeaders.
- */
- private java.util.Map extraHeaders;
-
- /**
- * The path to check the repository availability (relative to
- * the repository URL). Some repositories do not allow
- * browsing, so a certain artifact must be checked.
- */
- private String checkPath;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addExtraHeader.
- *
- * @param key
- * @param value
- */
- public void addExtraHeader( Object key, String value )
- {
- getExtraHeaders().put( key, value );
- } //-- void addExtraHeader( Object, String )
-
- /**
- * Method addExtraParameter.
- *
- * @param key
- * @param value
- */
- public void addExtraParameter( Object key, String value )
- {
- getExtraParameters().put( key, value );
- } //-- void addExtraParameter( Object, String )
-
- /**
- * Get the path to check the repository availability (relative
- * to the repository URL). Some repositories do not allow
- * browsing, so a certain artifact must be checked.
- *
- * @return String
- */
- public String getCheckPath()
- {
- return this.checkPath;
- } //-- String getCheckPath()
-
- /**
- * Method getExtraHeaders.
- *
- * @return Map
- */
- public java.util.Map getExtraHeaders()
- {
- if ( this.extraHeaders == null )
- {
- this.extraHeaders = new java.util.HashMap();
- }
-
- return this.extraHeaders;
- } //-- java.util.Map getExtraHeaders()
-
- /**
- * Method getExtraParameters.
- *
- * @return Map
- */
- public java.util.Map getExtraParameters()
- {
- if ( this.extraParameters == null )
- {
- this.extraParameters = new java.util.HashMap();
- }
-
- return this.extraParameters;
- } //-- java.util.Map getExtraParameters()
-
- /**
- * Get the Password for this repository.
- *
- * @return String
- */
- public String getPassword()
- {
- return this.password;
- } //-- String getPassword()
-
- /**
- * Get when to run the refresh task.
- * Default is every sunday at 8H00.
- *
- * @return String
- */
- public String getRefreshCronExpression()
- {
- return this.refreshCronExpression;
- } //-- String getRefreshCronExpression()
-
- /**
- * Get id of the networkProxy to use when downloading remote
- * index.
- *
- * @return String
- */
- public String getRemoteDownloadNetworkProxyId()
- {
- return this.remoteDownloadNetworkProxyId;
- } //-- String getRemoteDownloadNetworkProxyId()
-
- /**
- * Get timeout in seconds for download remote index. Default is
- * more long than artifact download.
- *
- * @return int
- */
- public int getRemoteDownloadTimeout()
- {
- return this.remoteDownloadTimeout;
- } //-- int getRemoteDownloadTimeout()
-
- /**
- * Get remote Index Url : if not starting with http will be
- * relative to the remote repository url.
- *
- * @return String
- */
- public String getRemoteIndexUrl()
- {
- return this.remoteIndexUrl;
- } //-- String getRemoteIndexUrl()
-
- /**
- * Get timeout in seconds for connections to this repository.
- *
- * @return int
- */
- public int getTimeout()
- {
- return this.timeout;
- } //-- int getTimeout()
-
- /**
- * Get the URL for this repository.
- *
- * @return String
- */
- public String getUrl()
- {
- return this.url;
- } //-- String getUrl()
-
- /**
- * Get the Username for this repository.
- *
- * @return String
- */
- public String getUsername()
- {
- return this.username;
- } //-- String getUsername()
-
- /**
- * Get activate download of remote index if remoteIndexUrl is
- * set too.
- *
- * @return boolean
- */
- public boolean isDownloadRemoteIndex()
- {
- return this.downloadRemoteIndex;
- } //-- boolean isDownloadRemoteIndex()
-
- /**
- * Get schedule download of remote index when archiva start.
- *
- * @return boolean
- */
- public boolean isDownloadRemoteIndexOnStartup()
- {
- return this.downloadRemoteIndexOnStartup;
- } //-- boolean isDownloadRemoteIndexOnStartup()
-
- /**
- * Set the path to check the repository availability (relative
- * to the repository URL). Some repositories do not allow
- * browsing, so a certain artifact must be checked.
- *
- * @param checkPath
- */
- public void setCheckPath( String checkPath )
- {
- this.checkPath = checkPath;
- } //-- void setCheckPath( String )
-
- /**
- * Set activate download of remote index if remoteIndexUrl is
- * set too.
- *
- * @param downloadRemoteIndex
- */
- public void setDownloadRemoteIndex( boolean downloadRemoteIndex )
- {
- this.downloadRemoteIndex = downloadRemoteIndex;
- } //-- void setDownloadRemoteIndex( boolean )
-
- /**
- * Set schedule download of remote index when archiva start.
- *
- * @param downloadRemoteIndexOnStartup
- */
- public void setDownloadRemoteIndexOnStartup( boolean downloadRemoteIndexOnStartup )
- {
- this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup;
- } //-- void setDownloadRemoteIndexOnStartup( boolean )
-
- /**
- * Set additional http headers to add to url when requesting
- * remote repositories.
- *
- * @param extraHeaders
- */
- public void setExtraHeaders( java.util.Map extraHeaders )
- {
- this.extraHeaders = extraHeaders;
- } //-- void setExtraHeaders( java.util.Map )
-
- /**
- * Set additionnal request parameters to add to url when
- * requesting remote repositories.
- *
- * @param extraParameters
- */
- public void setExtraParameters( java.util.Map extraParameters )
- {
- this.extraParameters = extraParameters;
- } //-- void setExtraParameters( java.util.Map )
-
- /**
- * Set the Password for this repository.
- *
- * @param password
- */
- public void setPassword( String password )
- {
- this.password = password;
- } //-- void setPassword( String )
-
- /**
- * Set when to run the refresh task.
- * Default is every sunday at 8H00.
- *
- * @param refreshCronExpression
- */
- public void setRefreshCronExpression( String refreshCronExpression )
- {
- this.refreshCronExpression = refreshCronExpression;
- } //-- void setRefreshCronExpression( String )
-
- /**
- * Set id of the networkProxy to use when downloading remote
- * index.
- *
- * @param remoteDownloadNetworkProxyId
- */
- public void setRemoteDownloadNetworkProxyId( String remoteDownloadNetworkProxyId )
- {
- this.remoteDownloadNetworkProxyId = remoteDownloadNetworkProxyId;
- } //-- void setRemoteDownloadNetworkProxyId( String )
-
- /**
- * Set timeout in seconds for download remote index. Default is
- * more long than artifact download.
- *
- * @param remoteDownloadTimeout
- */
- public void setRemoteDownloadTimeout( int remoteDownloadTimeout )
- {
- this.remoteDownloadTimeout = remoteDownloadTimeout;
- } //-- void setRemoteDownloadTimeout( int )
-
- /**
- * Set remote Index Url : if not starting with http will be
- * relative to the remote repository url.
- *
- * @param remoteIndexUrl
- */
- public void setRemoteIndexUrl( String remoteIndexUrl )
- {
- this.remoteIndexUrl = remoteIndexUrl;
- } //-- void setRemoteIndexUrl( String )
-
- /**
- * Set timeout in seconds for connections to this repository.
- *
- * @param timeout
- */
- public void setTimeout( int timeout )
- {
- this.timeout = timeout;
- } //-- void setTimeout( int )
-
- /**
- * Set the URL for this repository.
- *
- * @param url
- */
- public void setUrl( String url )
- {
- this.url = url;
- } //-- void setUrl( String )
-
- /**
- * Set the Username for this repository.
- *
- * @param username
- */
- public void setUsername( String username )
- {
- this.username = username;
- } //-- void setUsername( String )
-
-
- public String toString()
- {
- return "RemoteRepositoryConfiguration id:'" + getId() + "',name:'" + getName() +"'";
- }
-
-
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class RepositoryCheckPath.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class RepositoryCheckPath
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- *
- * The URL for which this path should be used
- * .
- */
- private String url;
-
- /**
- *
- * The path to use for checking the repository
- * connection.
- *
- */
- private String path;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the path to use for checking the repository connection.
- *
- * @return String
- */
- public String getPath()
- {
- return this.path;
- } //-- String getPath()
-
- /**
- * Get the URL for which this path should be used.
- *
- * @return String
- */
- public String getUrl()
- {
- return this.url;
- } //-- String getUrl()
-
- /**
- * Set the path to use for checking the repository connection.
- *
- * @param path
- */
- public void setPath( String path )
- {
- this.path = path;
- } //-- void setPath( String )
-
- /**
- * Set the URL for which this path should be used.
- *
- * @param url
- */
- public void setUrl( String url )
- {
- this.url = url;
- } //-- void setUrl( String )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Class RepositoryGroupConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class RepositoryGroupConfiguration extends AbstractRepositoryConfiguration
- implements Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * The id of the repository group.
- */
- private String id;
-
- /**
- * The name of the repository group
- */
- private String name;
-
- /**
- *
- * The repository type. Currently only MAVEN type
- * is known.
- *
- */
- private String type = "MAVEN";
-
-
- /**
- * The path of the merged index.
- */
- private String mergedIndexPath = ".indexer";
-
- /**
- * The time to live of the merged index of the repository group.
- */
- private int mergedIndexTtl = 30;
-
- /**
- *
- * When to run the index merging for this group.
- *
- */
- private String cronExpression = "";
-
- /**
- * Field repositories.
- */
- private List<String> repositories;
-
- /**
- * The path for local data
- */
- private String location;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
-
- /**
- * Return the local path for group data. If the merged index property is set to a non absolute path,
- * it is relative to this location.
- *
- * @return the path for group data storage
- */
- public String getLocation( )
- {
- return location;
- }
-
- /**
- * Set the local path for group data
- * @param location
- */
- public void setLocation( String location )
- {
- this.location = location;
- }
-
- /**
- * Method addRepository.
- *
- * @param string
- */
- public void addRepository( String string )
- {
- getRepositories().add( string );
- } //-- void addRepository( String )
-
- /**
- * Get when to run the index merging for this group.
- * No default value.
- *
- * @return String
- */
- public String getCronExpression()
- {
- return this.cronExpression;
- } //-- String getCronExpression()
-
- /**
- * Get the id of the repository group.
- *
- * @return String
- */
- public String getId()
- {
- return this.id;
- } //-- String getId()
-
- /**
- * Get the path of the merged index.
- *
- * @return String
- */
- public String getMergedIndexPath()
- {
- return this.mergedIndexPath;
- } //-- String getMergedIndexPath()
-
- /**
- * Get the time to live of the merged index of the repository
- * group.
- *
- * @return int
- */
- public int getMergedIndexTtl()
- {
- return this.mergedIndexTtl;
- } //-- int getMergedIndexTtl()
-
- /**
- * Method getRepositories.
- *
- * @return List
- */
- public List<String> getRepositories()
- {
- if ( this.repositories == null )
- {
- this.repositories = new ArrayList<String>();
- }
-
- return this.repositories;
- } //-- java.util.List<String> getRepositories()
-
- /**
- * Method removeRepository.
- *
- * @param string
- */
- public void removeRepository( String string )
- {
- getRepositories().remove( string );
- } //-- void removeRepository( String )
-
- /**
- * Set when to run the index merging for this group.
- * No default value.
- *
- * @param cronExpression
- */
- public void setCronExpression( String cronExpression )
- {
- this.cronExpression = cronExpression;
- } //-- void setCronExpression( String )
-
- /**
- * Set the id of the repository group.
- *
- * @param id
- */
- public void setId( String id )
- {
- this.id = id;
- } //-- void setId( String )
-
- /**
- * Set the path of the merged index.
- *
- * @param mergedIndexPath
- */
- public void setMergedIndexPath( String mergedIndexPath )
- {
- this.mergedIndexPath = mergedIndexPath;
- } //-- void setMergedIndexPath( String )
-
- /**
- * Set the time to live of the merged index of the repository
- * group.
- *
- * @param mergedIndexTtl
- */
- public void setMergedIndexTtl( int mergedIndexTtl )
- {
- this.mergedIndexTtl = mergedIndexTtl;
- } //-- void setMergedIndexTtl( int )
-
- /**
- * Set the list of repository ids under the group.
- *
- * @param repositories
- */
- public void setRepositories( List<String> repositories )
- {
- this.repositories = repositories;
- } //-- void setRepositories( java.util.List )
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class RepositoryScanningConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class RepositoryScanningConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field fileTypes.
- */
- private java.util.List<FileType> fileTypes;
-
- /**
- * Field knownContentConsumers.
- */
- private java.util.List<String> knownContentConsumers;
-
- /**
- * Field invalidContentConsumers.
- */
- private java.util.List<String> invalidContentConsumers;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addFileType.
- *
- * @param fileType
- */
- public void addFileType( FileType fileType )
- {
- getFileTypes().add( fileType );
- } //-- void addFileType( FileType )
-
- /**
- * Method addInvalidContentConsumer.
- *
- * @param string
- */
- public void addInvalidContentConsumer( String string )
- {
- getInvalidContentConsumers().add( string );
- } //-- void addInvalidContentConsumer( String )
-
- /**
- * Method addKnownContentConsumer.
- *
- * @param string
- */
- public void addKnownContentConsumer( String string )
- {
- getKnownContentConsumers().add( string );
- } //-- void addKnownContentConsumer( String )
-
- /**
- * Method getFileTypes.
- *
- * @return List
- */
- public java.util.List<FileType> getFileTypes()
- {
- if ( this.fileTypes == null )
- {
- this.fileTypes = new java.util.ArrayList<FileType>();
- }
-
- return this.fileTypes;
- } //-- java.util.List<FileType> getFileTypes()
-
- /**
- * Method getInvalidContentConsumers.
- *
- * @return List
- */
- public java.util.List<String> getInvalidContentConsumers()
- {
- if ( this.invalidContentConsumers == null )
- {
- this.invalidContentConsumers = new java.util.ArrayList<String>();
- }
-
- return this.invalidContentConsumers;
- } //-- java.util.List<String> getInvalidContentConsumers()
-
- /**
- * Method getKnownContentConsumers.
- *
- * @return List
- */
- public java.util.List<String> getKnownContentConsumers()
- {
- if ( this.knownContentConsumers == null )
- {
- this.knownContentConsumers = new java.util.ArrayList<String>();
- }
-
- return this.knownContentConsumers;
- } //-- java.util.List<String> getKnownContentConsumers()
-
- /**
- * Method removeFileType.
- *
- * @param fileType
- */
- public void removeFileType( FileType fileType )
- {
- getFileTypes().remove( fileType );
- } //-- void removeFileType( FileType )
-
- /**
- * Method removeInvalidContentConsumer.
- *
- * @param string
- */
- public void removeInvalidContentConsumer( String string )
- {
- getInvalidContentConsumers().remove( string );
- } //-- void removeInvalidContentConsumer( String )
-
- /**
- * Method removeKnownContentConsumer.
- *
- * @param string
- */
- public void removeKnownContentConsumer( String string )
- {
- getKnownContentConsumers().remove( string );
- } //-- void removeKnownContentConsumer( String )
-
- /**
- * Set the FileTypes for the repository scanning configuration.
- *
- * @param fileTypes
- */
- public void setFileTypes( java.util.List<FileType> fileTypes )
- {
- this.fileTypes = fileTypes;
- } //-- void setFileTypes( java.util.List )
-
- /**
- * Set the list of active consumer IDs for invalid content.
- *
- * @param invalidContentConsumers
- */
- public void setInvalidContentConsumers( java.util.List<String> invalidContentConsumers )
- {
- this.invalidContentConsumers = invalidContentConsumers;
- } //-- void setInvalidContentConsumers( java.util.List )
-
- /**
- * Set the list of active consumers IDs for known content.
- *
- * @param knownContentConsumers
- */
- public void setKnownContentConsumers( java.util.List<String> knownContentConsumers )
- {
- this.knownContentConsumers = knownContentConsumers;
- } //-- void setKnownContentConsumers( java.util.List )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class SyncConnectorConfiguration.
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class SyncConnectorConfiguration
- extends AbstractRepositoryConnectorConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * When to run the sync mechanism. Default is every hour on the
- * hour.
- */
- private String cronExpression = "0 0 * * * ?";
-
- /**
- * The type of synchronization to use.
- */
- private String method = "rsync";
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get when to run the sync mechanism. Default is every hour on
- * the hour.
- *
- * @return String
- */
- public String getCronExpression()
- {
- return this.cronExpression;
- } //-- String getCronExpression()
-
- /**
- * Get the type of synchronization to use.
- *
- * @return String
- */
- public String getMethod()
- {
- return this.method;
- } //-- String getMethod()
-
- /**
- * Set when to run the sync mechanism. Default is every hour on
- * the hour.
- *
- * @param cronExpression
- */
- public void setCronExpression( String cronExpression )
- {
- this.cronExpression = cronExpression;
- } //-- void setCronExpression( String )
-
- /**
- * Set the type of synchronization to use.
- *
- * @param method
- */
- public void setMethod( String method )
- {
- this.method = method;
- } //-- void setMethod( String )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * The user interface configuration settings.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class UserInterfaceOptions
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * true if find artifacts should be enabled.
- */
- private boolean showFindArtifacts = true;
-
- /**
- * true if applet behavior for find artifacts should be enabled.
- */
- private boolean appletFindEnabled = true;
-
- /**
- * Field disableEasterEggs.
- */
- private boolean disableEasterEggs = false;
-
- /**
- * Field applicationUrl.
- */
- private String applicationUrl;
-
- /**
- * Field disableRegistration.
- */
- private boolean disableRegistration = false;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get the applicationUrl field.
- *
- * @return String
- */
- public String getApplicationUrl()
- {
- return this.applicationUrl;
- } //-- String getApplicationUrl()
-
- /**
- * Get true if applet behavior for find artifacts should be
- * enabled.
- *
- * @return boolean
- */
- public boolean isAppletFindEnabled()
- {
- return this.appletFindEnabled;
- } //-- boolean isAppletFindEnabled()
-
- /**
- * Get the disableEasterEggs field.
- *
- * @return boolean
- */
- public boolean isDisableEasterEggs()
- {
- return this.disableEasterEggs;
- } //-- boolean isDisableEasterEggs()
-
- /**
- * Get the disableRegistration field.
- *
- * @return boolean
- */
- public boolean isDisableRegistration()
- {
- return this.disableRegistration;
- } //-- boolean isDisableRegistration()
-
- /**
- * Get true if find artifacts should be enabled.
- *
- * @return boolean
- */
- public boolean isShowFindArtifacts()
- {
- return this.showFindArtifacts;
- } //-- boolean isShowFindArtifacts()
-
- /**
- * Set true if applet behavior for find artifacts should be
- * enabled.
- *
- * @param appletFindEnabled
- */
- public void setAppletFindEnabled( boolean appletFindEnabled )
- {
- this.appletFindEnabled = appletFindEnabled;
- } //-- void setAppletFindEnabled( boolean )
-
- /**
- * Set the applicationUrl field.
- *
- * @param applicationUrl
- */
- public void setApplicationUrl( String applicationUrl )
- {
- this.applicationUrl = applicationUrl;
- } //-- void setApplicationUrl( String )
-
- /**
- * Set the disableEasterEggs field.
- *
- * @param disableEasterEggs
- */
- public void setDisableEasterEggs( boolean disableEasterEggs )
- {
- this.disableEasterEggs = disableEasterEggs;
- } //-- void setDisableEasterEggs( boolean )
-
- /**
- * Set the disableRegistration field.
- *
- * @param disableRegistration
- */
- public void setDisableRegistration( boolean disableRegistration )
- {
- this.disableRegistration = disableRegistration;
- } //-- void setDisableRegistration( boolean )
-
- /**
- * Set true if find artifacts should be enabled.
- *
- * @param showFindArtifacts
- */
- public void setShowFindArtifacts( boolean showFindArtifacts )
- {
- this.showFindArtifacts = showFindArtifacts;
- } //-- void setShowFindArtifacts( boolean )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * The webapp configuration settings.
- *
- *
- * @version $Revision$ $Date$
- */
-@SuppressWarnings( "all" )
-public class WebappConfiguration
- implements java.io.Serializable
-{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * options for altering the ui presentation.
- */
- private UserInterfaceOptions ui;
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Get options for altering the ui presentation.
- *
- * @return UserInterfaceOptions
- */
- public UserInterfaceOptions getUi()
- {
- return this.ui;
- } //-- UserInterfaceOptions getUi()
-
- /**
- * Set options for altering the ui presentation.
- *
- * @param ui
- */
- public void setUi( UserInterfaceOptions ui )
- {
- this.ui = ui;
- } //-- void setUi( UserInterfaceOptions )
-
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.FileType;
-import org.apache.commons.collections4.Predicate;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * FiletypeSelectionPredicate
- *
- *
- */
-public class FiletypeSelectionPredicate
- implements Predicate
-{
- private String filetypeId;
-
- public FiletypeSelectionPredicate( String id )
- {
- this.filetypeId = id;
- }
-
- @Override
- public boolean evaluate( Object object )
- {
- boolean satisfies = false;
-
- if ( object instanceof FileType )
- {
- FileType filetype = (FileType) object;
- return ( StringUtils.equals( filetypeId, filetype.getId() ) );
- }
-
- return satisfies;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.FileType;
-import org.apache.commons.collections4.Closure;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * FiletypeToMapClosure
- *
- *
- */
-public class FiletypeToMapClosure
- implements Closure
-{
- private Map<String, FileType> map = new HashMap<>();
-
- @Override
- public void execute( Object input )
- {
- if ( input instanceof FileType )
- {
- FileType filetype = (FileType) input;
- map.put( filetype.getId(), filetype );
- }
- }
-
- public Map<String, FileType> getMap()
- {
- return map;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.NetworkProxyConfiguration;
-
-import java.util.Comparator;
-
-/**
- * NetworkProxyComparator
- *
- *
- */
-public class NetworkProxyComparator
- implements Comparator<NetworkProxyConfiguration>
-{
- @Override
- public int compare( NetworkProxyConfiguration o1, NetworkProxyConfiguration o2 )
- {
- if ( o1 == null && o2 == null )
- {
- return 0;
- }
-
- if ( o1 == null && o2 != null )
- {
- return 1;
- }
-
- if ( o1 != null && o2 == null )
- {
- return -1;
- }
-
- String id1 = o1.getId();
- String id2 = o2.getId();
- return id1.compareToIgnoreCase( id2 );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.NetworkProxyConfiguration;
-import org.apache.commons.collections4.Predicate;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * NetworkProxySelectionPredicate
- *
- *
- */
-public class NetworkProxySelectionPredicate
- implements Predicate
-{
- private String proxyId;
-
- public NetworkProxySelectionPredicate( String id )
- {
- this.proxyId = id;
- }
-
- @Override
- public boolean evaluate( Object object )
- {
- boolean satisfies = false;
-
- if ( object instanceof NetworkProxyConfiguration )
- {
- NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object;
- return ( StringUtils.equals( proxyId, proxy.getId() ) );
- }
-
- return satisfies;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-
-import java.util.Comparator;
-
-/**
- *
- * Was marked as deprecated before, but is still used.
- *
- */
-public class ProxyConnectorConfigurationOrderComparator
- implements Comparator<ProxyConnectorConfiguration>
-{
- private static ProxyConnectorConfigurationOrderComparator INSTANCE =
- new ProxyConnectorConfigurationOrderComparator();
-
- @Override
- public int compare( ProxyConnectorConfiguration o1, ProxyConnectorConfiguration o2 )
- {
- if ( o1 == null && o2 == null )
- {
- return 0;
- }
-
- // Ensure null goes to end of list.
- if ( o1 == null && o2 != null )
- {
- return 1;
- }
-
- if ( o1 != null && o2 == null )
- {
- return -1;
- }
-
- // Ensure 0 (unordered) goes to end of list.
- if ( o1.getOrder() == 0 && o2.getOrder() != 0 )
- {
- return 1;
- }
-
- if ( o1.getOrder() != 0 && o2.getOrder() == 0 )
- {
- return -1;
- }
-
- return o1.getOrder() - o2.getOrder();
- }
-
- public static ProxyConnectorConfigurationOrderComparator getInstance()
- {
- return INSTANCE;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.commons.collections4.Predicate;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * ProxyConnectorPredicate
- *
- *
- */
-public class ProxyConnectorSelectionPredicate
- implements Predicate<ProxyConnectorConfiguration>
-{
- private String sourceId;
-
- private String targetId;
-
- public ProxyConnectorSelectionPredicate( String sourceId, String targetId )
- {
- this.sourceId = sourceId;
- this.targetId = targetId;
- }
-
- @Override
- public boolean evaluate( ProxyConnectorConfiguration object )
- {
- boolean satisfies = false;
-
- if ( object != null )
- {
- ProxyConnectorConfiguration connector = object;
- return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils.equals( targetId,
- connector.getTargetRepoId() ) );
- }
-
- return satisfies;
- }
-
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-
-import java.util.Comparator;
-
-/**
- * RepositoryConfigurationComparator
- *
- *
- */
-public class RepositoryConfigurationComparator
- implements Comparator<AbstractRepositoryConfiguration>
-{
- @Override
- public int compare( AbstractRepositoryConfiguration o1, AbstractRepositoryConfiguration o2 )
- {
- if ( o1 == null && o2 == null )
- {
- return 0;
- }
-
- if ( o1 == null )
- {
- return -1;
- }
-
- if ( o2 == null )
- {
- return 1;
- }
-
- return o1.getId().compareToIgnoreCase( o2.getId() );
- }
-}
+++ /dev/null
-
-package org.apache.archiva.configuration.io.registry;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.*;
-import org.apache.archiva.components.registry.Registry;
-
-import java.util.Iterator;
-import java.util.List;
-
-// Util imports
-// Model class imports
-
-
-/**
- * Generate Redback Registry input mechanism for model 'Configuration'.
- */
-public class ConfigurationRegistryReader {
- public Configuration read(Registry registry) {
- return readConfiguration("", registry);
- }
-
- private Configuration readConfiguration(String prefix, Registry registry) {
- Configuration value = new Configuration();
-
- //String version = registry.getString( prefix + "version", value.getVersion() );
-
- List<String> versionList = registry.getList(prefix + "version");
- String version = value.getVersion();
- if (versionList != null && !versionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = versionList.size(); i < size; i++) {
- sb.append(versionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- version = sb.toString();
- }
-
- value.setVersion(version);
- //String metadataStore = registry.getString( prefix + "metadataStore", value.getMetadataStore() );
-
- List<String> metadataStoreList = registry.getList(prefix + "metadataStore");
- String metadataStore = value.getMetadataStore();
- if (metadataStoreList != null && !metadataStoreList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = metadataStoreList.size(); i < size; i++) {
- sb.append(metadataStoreList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- metadataStore = sb.toString();
- }
-
- value.setMetadataStore(metadataStore);
- java.util.List repositoryGroups = new java.util.ArrayList/*<RepositoryGroupConfiguration>*/();
- List repositoryGroupsSubsets = registry.getSubsetList(prefix + "repositoryGroups.repositoryGroup");
- for (Iterator i = repositoryGroupsSubsets.iterator(); i.hasNext(); ) {
- RepositoryGroupConfiguration v = readRepositoryGroupConfiguration("", (Registry) i.next());
- repositoryGroups.add(v);
- }
- value.setRepositoryGroups(repositoryGroups);
- java.util.List managedRepositories = new java.util.ArrayList/*<ManagedRepositoryConfiguration>*/();
- List managedRepositoriesSubsets = registry.getSubsetList(prefix + "managedRepositories.managedRepository");
- for (Iterator i = managedRepositoriesSubsets.iterator(); i.hasNext(); ) {
- ManagedRepositoryConfiguration v = readManagedRepositoryConfiguration("", (Registry) i.next());
- managedRepositories.add(v);
- }
- value.setManagedRepositories(managedRepositories);
- java.util.List remoteRepositories = new java.util.ArrayList/*<RemoteRepositoryConfiguration>*/();
- List remoteRepositoriesSubsets = registry.getSubsetList(prefix + "remoteRepositories.remoteRepository");
- for (Iterator i = remoteRepositoriesSubsets.iterator(); i.hasNext(); ) {
- RemoteRepositoryConfiguration v = readRemoteRepositoryConfiguration("", (Registry) i.next());
- remoteRepositories.add(v);
- }
- value.setRemoteRepositories(remoteRepositories);
- java.util.List proxyConnectors = new java.util.ArrayList/*<ProxyConnectorConfiguration>*/();
- List proxyConnectorsSubsets = registry.getSubsetList(prefix + "proxyConnectors.proxyConnector");
- for (Iterator i = proxyConnectorsSubsets.iterator(); i.hasNext(); ) {
- ProxyConnectorConfiguration v = readProxyConnectorConfiguration("", (Registry) i.next());
- proxyConnectors.add(v);
- }
- value.setProxyConnectors(proxyConnectors);
- java.util.List networkProxies = new java.util.ArrayList/*<NetworkProxyConfiguration>*/();
- List networkProxiesSubsets = registry.getSubsetList(prefix + "networkProxies.networkProxy");
- for (Iterator i = networkProxiesSubsets.iterator(); i.hasNext(); ) {
- NetworkProxyConfiguration v = readNetworkProxyConfiguration("", (Registry) i.next());
- networkProxies.add(v);
- }
- value.setNetworkProxies(networkProxies);
- java.util.List legacyArtifactPaths = new java.util.ArrayList/*<LegacyArtifactPath>*/();
- List legacyArtifactPathsSubsets = registry.getSubsetList(prefix + "legacyArtifactPaths.legacyArtifactPath");
- for (Iterator i = legacyArtifactPathsSubsets.iterator(); i.hasNext(); ) {
- LegacyArtifactPath v = readLegacyArtifactPath("", (Registry) i.next());
- legacyArtifactPaths.add(v);
- }
- value.setLegacyArtifactPaths(legacyArtifactPaths);
- RepositoryScanningConfiguration repositoryScanning = readRepositoryScanningConfiguration(prefix + "repositoryScanning.", registry);
- value.setRepositoryScanning(repositoryScanning);
- WebappConfiguration webapp = readWebappConfiguration(prefix + "webapp.", registry);
- value.setWebapp(webapp);
- OrganisationInformation organisationInfo = readOrganisationInformation(prefix + "organisationInfo.", registry);
- value.setOrganisationInfo(organisationInfo);
- NetworkConfiguration networkConfiguration = readNetworkConfiguration(prefix + "networkConfiguration.", registry);
- value.setNetworkConfiguration(networkConfiguration);
- RedbackRuntimeConfiguration redbackRuntimeConfiguration = readRedbackRuntimeConfiguration(prefix + "redbackRuntimeConfiguration.", registry);
- value.setRedbackRuntimeConfiguration(redbackRuntimeConfiguration);
- ArchivaRuntimeConfiguration archivaRuntimeConfiguration = readArchivaRuntimeConfiguration(prefix + "archivaRuntimeConfiguration.", registry);
- value.setArchivaRuntimeConfiguration(archivaRuntimeConfiguration);
- java.util.List proxyConnectorRuleConfigurations = new java.util.ArrayList/*<ProxyConnectorRuleConfiguration>*/();
- List proxyConnectorRuleConfigurationsSubsets = registry.getSubsetList(prefix + "proxyConnectorRuleConfigurations.proxyConnectorRuleConfiguration");
- for (Iterator i = proxyConnectorRuleConfigurationsSubsets.iterator(); i.hasNext(); ) {
- ProxyConnectorRuleConfiguration v = readProxyConnectorRuleConfiguration("", (Registry) i.next());
- proxyConnectorRuleConfigurations.add(v);
- }
- value.setProxyConnectorRuleConfigurations(proxyConnectorRuleConfigurations);
- ArchivaDefaultConfiguration archivaDefaultConfiguration = readArchivaDefaultConfiguration(prefix + "archivaDefaultConfiguration.", registry);
- value.setArchivaDefaultConfiguration(archivaDefaultConfiguration);
-
- return value;
- }
-
- private AbstractRepositoryConfiguration readAbstractRepositoryConfiguration(String prefix, Registry registry) {
- AbstractRepositoryConfiguration value = new AbstractRepositoryConfiguration();
-
- //String id = registry.getString( prefix + "id", value.getId() );
-
- List<String> idList = registry.getList(prefix + "id");
- String id = value.getId();
- if (idList != null && !idList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = idList.size(); i < size; i++) {
- sb.append(idList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- id = sb.toString();
- }
-
- value.setId(id);
- //String type = registry.getString( prefix + "type", value.getType() );
-
- List<String> typeList = registry.getList(prefix + "type");
- String type = value.getType();
- if (typeList != null && !typeList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = typeList.size(); i < size; i++) {
- sb.append(typeList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- type = sb.toString();
- }
-
- value.setType(type);
- //String name = registry.getString( prefix + "name", value.getName() );
-
- List<String> nameList = registry.getList(prefix + "name");
- String name = value.getName();
- if (nameList != null && !nameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = nameList.size(); i < size; i++) {
- sb.append(nameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- name = sb.toString();
- }
-
- value.setName(name);
- //String layout = registry.getString( prefix + "layout", value.getLayout() );
-
- List<String> layoutList = registry.getList(prefix + "layout");
- String layout = value.getLayout();
- if (layoutList != null && !layoutList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = layoutList.size(); i < size; i++) {
- sb.append(layoutList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- layout = sb.toString();
- }
-
- value.setLayout(layout);
- //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
-
- List<String> indexDirList = registry.getList(prefix + "indexDir");
- String indexDir = value.getIndexDir();
- if (indexDirList != null && !indexDirList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = indexDirList.size(); i < size; i++) {
- sb.append(indexDirList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- indexDir = sb.toString();
- }
-
- value.setIndexDir(indexDir);
- //String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
-
- List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
- String packedIndexDir = value.getPackedIndexDir();
- if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
- sb.append(packedIndexDirList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- packedIndexDir = sb.toString();
- }
-
- value.setPackedIndexDir(packedIndexDir);
- //String description = registry.getString( prefix + "description", value.getDescription() );
-
- List<String> descriptionList = registry.getList(prefix + "description");
- String description = value.getDescription();
- if (descriptionList != null && !descriptionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = descriptionList.size(); i < size; i++) {
- sb.append(descriptionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- description = sb.toString();
- }
-
- value.setDescription(description);
-
- return value;
- }
-
- private RemoteRepositoryConfiguration readRemoteRepositoryConfiguration(String prefix, Registry registry) {
- RemoteRepositoryConfiguration value = new RemoteRepositoryConfiguration();
-
- //String url = registry.getString( prefix + "url", value.getUrl() );
-
- List<String> urlList = registry.getList(prefix + "url");
- String url = value.getUrl();
- if (urlList != null && !urlList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = urlList.size(); i < size; i++) {
- sb.append(urlList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- url = sb.toString();
- }
-
- value.setUrl(url);
- //String username = registry.getString( prefix + "username", value.getUsername() );
-
- List<String> usernameList = registry.getList(prefix + "username");
- String username = value.getUsername();
- if (usernameList != null && !usernameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = usernameList.size(); i < size; i++) {
- sb.append(usernameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- username = sb.toString();
- }
-
- value.setUsername(username);
- //String password = registry.getString( prefix + "password", value.getPassword() );
-
- List<String> passwordList = registry.getList(prefix + "password");
- String password = value.getPassword();
- if (passwordList != null && !passwordList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = passwordList.size(); i < size; i++) {
- sb.append(passwordList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- password = sb.toString();
- }
-
- value.setPassword(password);
- int timeout = registry.getInt(prefix + "timeout", value.getTimeout());
- value.setTimeout(timeout);
- //String refreshCronExpression = registry.getString( prefix + "refreshCronExpression", value.getRefreshCronExpression() );
-
- List<String> refreshCronExpressionList = registry.getList(prefix + "refreshCronExpression");
- String refreshCronExpression = value.getRefreshCronExpression();
- if (refreshCronExpressionList != null && !refreshCronExpressionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = refreshCronExpressionList.size(); i < size; i++) {
- sb.append(refreshCronExpressionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- refreshCronExpression = sb.toString();
- }
-
- value.setRefreshCronExpression(refreshCronExpression);
- boolean downloadRemoteIndex = registry.getBoolean(prefix + "downloadRemoteIndex", value.isDownloadRemoteIndex());
- value.setDownloadRemoteIndex(downloadRemoteIndex);
- //String remoteIndexUrl = registry.getString( prefix + "remoteIndexUrl", value.getRemoteIndexUrl() );
-
- List<String> remoteIndexUrlList = registry.getList(prefix + "remoteIndexUrl");
- String remoteIndexUrl = value.getRemoteIndexUrl();
- if (remoteIndexUrlList != null && !remoteIndexUrlList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = remoteIndexUrlList.size(); i < size; i++) {
- sb.append(remoteIndexUrlList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- remoteIndexUrl = sb.toString();
- }
-
- value.setRemoteIndexUrl(remoteIndexUrl);
- //String remoteDownloadNetworkProxyId = registry.getString( prefix + "remoteDownloadNetworkProxyId", value.getRemoteDownloadNetworkProxyId() );
-
- List<String> remoteDownloadNetworkProxyIdList = registry.getList(prefix + "remoteDownloadNetworkProxyId");
- String remoteDownloadNetworkProxyId = value.getRemoteDownloadNetworkProxyId();
- if (remoteDownloadNetworkProxyIdList != null && !remoteDownloadNetworkProxyIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = remoteDownloadNetworkProxyIdList.size(); i < size; i++) {
- sb.append(remoteDownloadNetworkProxyIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- remoteDownloadNetworkProxyId = sb.toString();
- }
-
- value.setRemoteDownloadNetworkProxyId(remoteDownloadNetworkProxyId);
- int remoteDownloadTimeout = registry.getInt(prefix + "remoteDownloadTimeout", value.getRemoteDownloadTimeout());
- value.setRemoteDownloadTimeout(remoteDownloadTimeout);
- boolean downloadRemoteIndexOnStartup = registry.getBoolean(prefix + "downloadRemoteIndexOnStartup", value.isDownloadRemoteIndexOnStartup());
- value.setDownloadRemoteIndexOnStartup(downloadRemoteIndexOnStartup);
- java.util.Map extraParameters = registry.getProperties(prefix + "extraParameters");
- value.setExtraParameters(extraParameters);
- java.util.Map extraHeaders = registry.getProperties(prefix + "extraHeaders");
- value.setExtraHeaders(extraHeaders);
- //String checkPath = registry.getString( prefix + "checkPath", value.getCheckPath() );
-
- List<String> checkPathList = registry.getList(prefix + "checkPath");
- String checkPath = value.getCheckPath();
- if (checkPathList != null && !checkPathList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = checkPathList.size(); i < size; i++) {
- sb.append(checkPathList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- checkPath = sb.toString();
- }
-
- value.setCheckPath(checkPath);
- //String id = registry.getString( prefix + "id", value.getId() );
-
- List<String> idList = registry.getList(prefix + "id");
- String id = value.getId();
- if (idList != null && !idList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = idList.size(); i < size; i++) {
- sb.append(idList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- id = sb.toString();
- }
-
- value.setId(id);
- //String type = registry.getString( prefix + "type", value.getType() );
-
- List<String> typeList = registry.getList(prefix + "type");
- String type = value.getType();
- if (typeList != null && !typeList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = typeList.size(); i < size; i++) {
- sb.append(typeList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- type = sb.toString();
- }
-
- value.setType(type);
- //String name = registry.getString( prefix + "name", value.getName() );
-
- List<String> nameList = registry.getList(prefix + "name");
- String name = value.getName();
- if (nameList != null && !nameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = nameList.size(); i < size; i++) {
- sb.append(nameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- name = sb.toString();
- }
-
- value.setName(name);
- //String layout = registry.getString( prefix + "layout", value.getLayout() );
-
- List<String> layoutList = registry.getList(prefix + "layout");
- String layout = value.getLayout();
- if (layoutList != null && !layoutList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = layoutList.size(); i < size; i++) {
- sb.append(layoutList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- layout = sb.toString();
- }
-
- value.setLayout(layout);
- //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
-
- List<String> indexDirList = registry.getList(prefix + "indexDir");
- String indexDir = value.getIndexDir();
- if (indexDirList != null && !indexDirList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = indexDirList.size(); i < size; i++) {
- sb.append(indexDirList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- indexDir = sb.toString();
- }
-
- value.setIndexDir(indexDir);
- //String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
-
- List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
- String packedIndexDir = value.getPackedIndexDir();
- if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
- sb.append(packedIndexDirList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- packedIndexDir = sb.toString();
- }
-
- value.setPackedIndexDir(packedIndexDir);
- //String description = registry.getString( prefix + "description", value.getDescription() );
-
- List<String> descriptionList = registry.getList(prefix + "description");
- String description = value.getDescription();
- if (descriptionList != null && !descriptionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = descriptionList.size(); i < size; i++) {
- sb.append(descriptionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- description = sb.toString();
- }
-
- value.setDescription(description);
-
- return value;
- }
-
- private ManagedRepositoryConfiguration readManagedRepositoryConfiguration(String prefix, Registry registry) {
- ManagedRepositoryConfiguration value = new ManagedRepositoryConfiguration();
-
- //String location = registry.getString( prefix + "location", value.getLocation() );
-
- List<String> locationList = registry.getList(prefix + "location");
- String location = value.getLocation();
- if (locationList != null && !locationList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = locationList.size(); i < size; i++) {
- sb.append(locationList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- location = sb.toString();
- }
-
- value.setLocation(location);
- boolean releases = registry.getBoolean(prefix + "releases", value.isReleases());
- value.setReleases(releases);
- boolean blockRedeployments = registry.getBoolean(prefix + "blockRedeployments", value.isBlockRedeployments());
- value.setBlockRedeployments(blockRedeployments);
- boolean snapshots = registry.getBoolean(prefix + "snapshots", value.isSnapshots());
- value.setSnapshots(snapshots);
- boolean scanned = registry.getBoolean(prefix + "scanned", value.isScanned());
- value.setScanned(scanned);
- //String refreshCronExpression = registry.getString( prefix + "refreshCronExpression", value.getRefreshCronExpression() );
-
- List<String> refreshCronExpressionList = registry.getList(prefix + "refreshCronExpression");
- String refreshCronExpression = value.getRefreshCronExpression();
- if (refreshCronExpressionList != null && !refreshCronExpressionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = refreshCronExpressionList.size(); i < size; i++) {
- sb.append(refreshCronExpressionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- refreshCronExpression = sb.toString();
- }
-
- value.setRefreshCronExpression(refreshCronExpression);
- int retentionCount = registry.getInt(prefix + "retentionCount", value.getRetentionCount());
- value.setRetentionCount(retentionCount);
- int retentionPeriod = registry.getInt(prefix + "retentionPeriod", value.getRetentionPeriod());
- value.setRetentionPeriod(retentionPeriod);
- boolean deleteReleasedSnapshots = registry.getBoolean(prefix + "deleteReleasedSnapshots", value.isDeleteReleasedSnapshots());
- value.setDeleteReleasedSnapshots(deleteReleasedSnapshots);
- boolean skipPackedIndexCreation = registry.getBoolean(prefix + "skipPackedIndexCreation", value.isSkipPackedIndexCreation());
- value.setSkipPackedIndexCreation(skipPackedIndexCreation);
- boolean stageRepoNeeded = registry.getBoolean(prefix + "stageRepoNeeded", value.isStageRepoNeeded());
- value.setStageRepoNeeded(stageRepoNeeded);
- //String id = registry.getString( prefix + "id", value.getId() );
-
- List<String> idList = registry.getList(prefix + "id");
- String id = value.getId();
- if (idList != null && !idList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = idList.size(); i < size; i++) {
- sb.append(idList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- id = sb.toString();
- }
-
- value.setId(id);
- //String type = registry.getString( prefix + "type", value.getType() );
-
- List<String> typeList = registry.getList(prefix + "type");
- String type = value.getType();
- if (typeList != null && !typeList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = typeList.size(); i < size; i++) {
- sb.append(typeList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- type = sb.toString();
- }
-
- value.setType(type);
- //String name = registry.getString( prefix + "name", value.getName() );
-
- List<String> nameList = registry.getList(prefix + "name");
- String name = value.getName();
- if (nameList != null && !nameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = nameList.size(); i < size; i++) {
- sb.append(nameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- name = sb.toString();
- }
-
- value.setName(name);
- //String layout = registry.getString( prefix + "layout", value.getLayout() );
-
- List<String> layoutList = registry.getList(prefix + "layout");
- String layout = value.getLayout();
- if (layoutList != null && !layoutList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = layoutList.size(); i < size; i++) {
- sb.append(layoutList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- layout = sb.toString();
- }
-
- value.setLayout(layout);
- //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
-
- List<String> indexDirList = registry.getList(prefix + "indexDir");
- String indexDir = value.getIndexDir();
- if (indexDirList != null && !indexDirList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = indexDirList.size(); i < size; i++) {
- sb.append(indexDirList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- indexDir = sb.toString();
- }
-
- value.setIndexDir(indexDir);
- //String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
-
- List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
- String packedIndexDir = value.getPackedIndexDir();
- if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
- sb.append(packedIndexDirList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- packedIndexDir = sb.toString();
- }
-
- value.setPackedIndexDir(packedIndexDir);
- //String description = registry.getString( prefix + "description", value.getDescription() );
-
- List<String> descriptionList = registry.getList(prefix + "description");
- String description = value.getDescription();
- if (descriptionList != null && !descriptionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = descriptionList.size(); i < size; i++) {
- sb.append(descriptionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- description = sb.toString();
- }
-
- value.setDescription(description);
-
- return value;
- }
-
- private LegacyArtifactPath readLegacyArtifactPath(String prefix, Registry registry) {
- LegacyArtifactPath value = new LegacyArtifactPath();
-
- //String path = registry.getString( prefix + "path", value.getPath() );
-
- List<String> pathList = registry.getList(prefix + "path");
- String path = value.getPath();
- if (pathList != null && !pathList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = pathList.size(); i < size; i++) {
- sb.append(pathList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- path = sb.toString();
- }
-
- value.setPath(path);
- //String artifact = registry.getString( prefix + "artifact", value.getArtifact() );
-
- List<String> artifactList = registry.getList(prefix + "artifact");
- String artifact = value.getArtifact();
- if (artifactList != null && !artifactList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = artifactList.size(); i < size; i++) {
- sb.append(artifactList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- artifact = sb.toString();
- }
-
- value.setArtifact(artifact);
-
- return value;
- }
-
- private RepositoryGroupConfiguration readRepositoryGroupConfiguration(String prefix, Registry registry) {
- RepositoryGroupConfiguration value = new RepositoryGroupConfiguration();
-
- //String id = registry.getString( prefix + "id", value.getId() );
-
- List<String> idList = registry.getList(prefix + "id");
- String id = value.getId();
- if (idList != null && !idList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = idList.size(); i < size; i++) {
- sb.append(idList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- id = sb.toString();
- }
-
- value.setId(id);
-
- value.setName(registry.getString(prefix + "name"));
- value.setType(registry.getString(prefix + "type"));
-
- //String mergedIndexPath = registry.getString( prefix + "mergedIndexPath", value.getMergedIndexPath() );
-
- List<String> mergedIndexPathList = registry.getList(prefix + "mergedIndexPath");
- String mergedIndexPath = value.getMergedIndexPath();
- if (mergedIndexPathList != null && !mergedIndexPathList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = mergedIndexPathList.size(); i < size; i++) {
- sb.append(mergedIndexPathList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- mergedIndexPath = sb.toString();
- }
-
- value.setMergedIndexPath(mergedIndexPath);
- int mergedIndexTtl = registry.getInt(prefix + "mergedIndexTtl", value.getMergedIndexTtl());
- value.setMergedIndexTtl(mergedIndexTtl);
- //String cronExpression = registry.getString( prefix + "cronExpression", value.getCronExpression() );
-
- value.setLocation( registry.getString( prefix + "location" ) );
-
- List<String> cronExpressionList = registry.getList(prefix + "cronExpression");
- String cronExpression = value.getCronExpression();
- if (cronExpressionList != null && !cronExpressionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = cronExpressionList.size(); i < size; i++) {
- sb.append(cronExpressionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- cronExpression = sb.toString();
- }
-
- value.setCronExpression(cronExpression);
- java.util.List repositories = new java.util.ArrayList/*<String>*/();
- repositories.addAll(registry.getList(prefix + "repositories.repository"));
- value.setRepositories(repositories);
-
- return value;
- }
-
- private RepositoryCheckPath readRepositoryCheckPath(String prefix, Registry registry) {
- RepositoryCheckPath value = new RepositoryCheckPath();
-
- //String url = registry.getString( prefix + "url", value.getUrl() );
-
- List<String> urlList = registry.getList(prefix + "url");
- String url = value.getUrl();
- if (urlList != null && !urlList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = urlList.size(); i < size; i++) {
- sb.append(urlList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- url = sb.toString();
- }
-
- value.setUrl(url);
- //String path = registry.getString( prefix + "path", value.getPath() );
-
- List<String> pathList = registry.getList(prefix + "path");
- String path = value.getPath();
- if (pathList != null && !pathList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = pathList.size(); i < size; i++) {
- sb.append(pathList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- path = sb.toString();
- }
-
- value.setPath(path);
-
- return value;
- }
-
- private AbstractRepositoryConnectorConfiguration readAbstractRepositoryConnectorConfiguration(String prefix, Registry registry) {
- AbstractRepositoryConnectorConfiguration value = new AbstractRepositoryConnectorConfiguration();
-
- //String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
-
- List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
- String sourceRepoId = value.getSourceRepoId();
- if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
- sb.append(sourceRepoIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- sourceRepoId = sb.toString();
- }
-
- value.setSourceRepoId(sourceRepoId);
- //String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
-
- List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
- String targetRepoId = value.getTargetRepoId();
- if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
- sb.append(targetRepoIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- targetRepoId = sb.toString();
- }
-
- value.setTargetRepoId(targetRepoId);
- //String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
-
- List<String> proxyIdList = registry.getList(prefix + "proxyId");
- String proxyId = value.getProxyId();
- if (proxyIdList != null && !proxyIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = proxyIdList.size(); i < size; i++) {
- sb.append(proxyIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- proxyId = sb.toString();
- }
-
- value.setProxyId(proxyId);
- java.util.List blackListPatterns = new java.util.ArrayList/*<String>*/();
- blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
- value.setBlackListPatterns(blackListPatterns);
- java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/();
- whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
- value.setWhiteListPatterns(whiteListPatterns);
- java.util.Map policies = registry.getProperties(prefix + "policies");
- value.setPolicies(policies);
- java.util.Map properties = registry.getProperties(prefix + "properties");
- value.setProperties(properties);
- boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
- value.setDisabled(disabled);
-
- return value;
- }
-
- private ProxyConnectorRuleConfiguration readProxyConnectorRuleConfiguration(String prefix, Registry registry) {
- ProxyConnectorRuleConfiguration value = new ProxyConnectorRuleConfiguration();
-
- //String ruleType = registry.getString( prefix + "ruleType", value.getRuleType() );
-
- List<String> ruleTypeList = registry.getList(prefix + "ruleType");
- String ruleType = value.getRuleType();
- if (ruleTypeList != null && !ruleTypeList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = ruleTypeList.size(); i < size; i++) {
- sb.append(ruleTypeList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- ruleType = sb.toString();
- }
-
- value.setRuleType(ruleType);
- //String pattern = registry.getString( prefix + "pattern", value.getPattern() );
-
- List<String> patternList = registry.getList(prefix + "pattern");
- String pattern = value.getPattern();
- if (patternList != null && !patternList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = patternList.size(); i < size; i++) {
- sb.append(patternList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- pattern = sb.toString();
- }
-
- value.setPattern(pattern);
- java.util.List proxyConnectors = new java.util.ArrayList/*<ProxyConnectorConfiguration>*/();
- List proxyConnectorsSubsets = registry.getSubsetList(prefix + "proxyConnectors.proxyConnector");
- for (Iterator i = proxyConnectorsSubsets.iterator(); i.hasNext(); ) {
- ProxyConnectorConfiguration v = readProxyConnectorConfiguration("", (Registry) i.next());
- proxyConnectors.add(v);
- }
- value.setProxyConnectors(proxyConnectors);
-
- return value;
- }
-
- private ProxyConnectorConfiguration readProxyConnectorConfiguration(String prefix, Registry registry) {
- ProxyConnectorConfiguration value = new ProxyConnectorConfiguration();
-
- int order = registry.getInt(prefix + "order", value.getOrder());
- value.setOrder(order);
- //String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
-
- List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
- String sourceRepoId = value.getSourceRepoId();
- if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
- sb.append(sourceRepoIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- sourceRepoId = sb.toString();
- }
-
- value.setSourceRepoId(sourceRepoId);
- //String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
-
- List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
- String targetRepoId = value.getTargetRepoId();
- if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
- sb.append(targetRepoIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- targetRepoId = sb.toString();
- }
-
- value.setTargetRepoId(targetRepoId);
- //String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
-
- List<String> proxyIdList = registry.getList(prefix + "proxyId");
- String proxyId = value.getProxyId();
- if (proxyIdList != null && !proxyIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = proxyIdList.size(); i < size; i++) {
- sb.append(proxyIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- proxyId = sb.toString();
- }
-
- value.setProxyId(proxyId);
- java.util.List blackListPatterns = new java.util.ArrayList/*<String>*/();
- blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
- value.setBlackListPatterns(blackListPatterns);
- java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/();
- whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
- value.setWhiteListPatterns(whiteListPatterns);
- java.util.Map policies = registry.getProperties(prefix + "policies");
- value.setPolicies(policies);
- java.util.Map properties = registry.getProperties(prefix + "properties");
- value.setProperties(properties);
- boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
- value.setDisabled(disabled);
-
- return value;
- }
-
- private SyncConnectorConfiguration readSyncConnectorConfiguration(String prefix, Registry registry) {
- SyncConnectorConfiguration value = new SyncConnectorConfiguration();
-
- //String cronExpression = registry.getString( prefix + "cronExpression", value.getCronExpression() );
-
- List<String> cronExpressionList = registry.getList(prefix + "cronExpression");
- String cronExpression = value.getCronExpression();
- if (cronExpressionList != null && !cronExpressionList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = cronExpressionList.size(); i < size; i++) {
- sb.append(cronExpressionList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- cronExpression = sb.toString();
- }
-
- value.setCronExpression(cronExpression);
- //String method = registry.getString( prefix + "method", value.getMethod() );
-
- List<String> methodList = registry.getList(prefix + "method");
- String method = value.getMethod();
- if (methodList != null && !methodList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = methodList.size(); i < size; i++) {
- sb.append(methodList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- method = sb.toString();
- }
-
- value.setMethod(method);
- //String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
-
- List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
- String sourceRepoId = value.getSourceRepoId();
- if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
- sb.append(sourceRepoIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- sourceRepoId = sb.toString();
- }
-
- value.setSourceRepoId(sourceRepoId);
- //String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
-
- List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
- String targetRepoId = value.getTargetRepoId();
- if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
- sb.append(targetRepoIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- targetRepoId = sb.toString();
- }
-
- value.setTargetRepoId(targetRepoId);
- //String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
-
- List<String> proxyIdList = registry.getList(prefix + "proxyId");
- String proxyId = value.getProxyId();
- if (proxyIdList != null && !proxyIdList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = proxyIdList.size(); i < size; i++) {
- sb.append(proxyIdList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- proxyId = sb.toString();
- }
-
- value.setProxyId(proxyId);
- java.util.List blackListPatterns = new java.util.ArrayList/*<String>*/();
- blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
- value.setBlackListPatterns(blackListPatterns);
- java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/();
- whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
- value.setWhiteListPatterns(whiteListPatterns);
- java.util.Map policies = registry.getProperties(prefix + "policies");
- value.setPolicies(policies);
- java.util.Map properties = registry.getProperties(prefix + "properties");
- value.setProperties(properties);
- boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
- value.setDisabled(disabled);
-
- return value;
- }
-
- private NetworkProxyConfiguration readNetworkProxyConfiguration(String prefix, Registry registry) {
- NetworkProxyConfiguration value = new NetworkProxyConfiguration();
-
- //String id = registry.getString( prefix + "id", value.getId() );
-
- List<String> idList = registry.getList(prefix + "id");
- String id = value.getId();
- if (idList != null && !idList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = idList.size(); i < size; i++) {
- sb.append(idList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- id = sb.toString();
- }
-
- value.setId(id);
- //String protocol = registry.getString( prefix + "protocol", value.getProtocol() );
-
- List<String> protocolList = registry.getList(prefix + "protocol");
- String protocol = value.getProtocol();
- if (protocolList != null && !protocolList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = protocolList.size(); i < size; i++) {
- sb.append(protocolList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- protocol = sb.toString();
- }
-
- value.setProtocol(protocol);
- //String host = registry.getString( prefix + "host", value.getHost() );
-
- List<String> hostList = registry.getList(prefix + "host");
- String host = value.getHost();
- if (hostList != null && !hostList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = hostList.size(); i < size; i++) {
- sb.append(hostList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- host = sb.toString();
- }
-
- value.setHost(host);
- int port = registry.getInt(prefix + "port", value.getPort());
- value.setPort(port);
- //String username = registry.getString( prefix + "username", value.getUsername() );
-
- List<String> usernameList = registry.getList(prefix + "username");
- String username = value.getUsername();
- if (usernameList != null && !usernameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = usernameList.size(); i < size; i++) {
- sb.append(usernameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- username = sb.toString();
- }
-
- value.setUsername(username);
- //String password = registry.getString( prefix + "password", value.getPassword() );
-
- List<String> passwordList = registry.getList(prefix + "password");
- String password = value.getPassword();
- if (passwordList != null && !passwordList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = passwordList.size(); i < size; i++) {
- sb.append(passwordList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- password = sb.toString();
- }
-
- value.setPassword(password);
- boolean useNtlm = registry.getBoolean(prefix + "useNtlm", value.isUseNtlm());
- value.setUseNtlm(useNtlm);
-
- return value;
- }
-
- private RepositoryScanningConfiguration readRepositoryScanningConfiguration(String prefix, Registry registry) {
- RepositoryScanningConfiguration value = new RepositoryScanningConfiguration();
-
- java.util.List fileTypes = new java.util.ArrayList/*<FileType>*/();
- List fileTypesSubsets = registry.getSubsetList(prefix + "fileTypes.fileType");
- for (Iterator i = fileTypesSubsets.iterator(); i.hasNext(); ) {
- FileType v = readFileType("", (Registry) i.next());
- fileTypes.add(v);
- }
- value.setFileTypes(fileTypes);
- java.util.List knownContentConsumers = new java.util.ArrayList/*<String>*/();
- knownContentConsumers.addAll(registry.getList(prefix + "knownContentConsumers.knownContentConsumer"));
- value.setKnownContentConsumers(knownContentConsumers);
- java.util.List invalidContentConsumers = new java.util.ArrayList/*<String>*/();
- invalidContentConsumers.addAll(registry.getList(prefix + "invalidContentConsumers.invalidContentConsumer"));
- value.setInvalidContentConsumers(invalidContentConsumers);
-
- return value;
- }
-
- private FileType readFileType(String prefix, Registry registry) {
- FileType value = new FileType();
-
- //String id = registry.getString( prefix + "id", value.getId() );
-
- List<String> idList = registry.getList(prefix + "id");
- String id = value.getId();
- if (idList != null && !idList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = idList.size(); i < size; i++) {
- sb.append(idList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- id = sb.toString();
- }
-
- value.setId(id);
- java.util.List patterns = new java.util.ArrayList/*<String>*/();
- patterns.addAll(registry.getList(prefix + "patterns.pattern"));
- value.setPatterns(patterns);
-
- return value;
- }
-
- private OrganisationInformation readOrganisationInformation(String prefix, Registry registry) {
- OrganisationInformation value = new OrganisationInformation();
-
- //String name = registry.getString( prefix + "name", value.getName() );
-
- List<String> nameList = registry.getList(prefix + "name");
- String name = value.getName();
- if (nameList != null && !nameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = nameList.size(); i < size; i++) {
- sb.append(nameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- name = sb.toString();
- }
-
- value.setName(name);
- //String url = registry.getString( prefix + "url", value.getUrl() );
-
- List<String> urlList = registry.getList(prefix + "url");
- String url = value.getUrl();
- if (urlList != null && !urlList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = urlList.size(); i < size; i++) {
- sb.append(urlList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- url = sb.toString();
- }
-
- value.setUrl(url);
- //String logoLocation = registry.getString( prefix + "logoLocation", value.getLogoLocation() );
-
- List<String> logoLocationList = registry.getList(prefix + "logoLocation");
- String logoLocation = value.getLogoLocation();
- if (logoLocationList != null && !logoLocationList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = logoLocationList.size(); i < size; i++) {
- sb.append(logoLocationList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- logoLocation = sb.toString();
- }
-
- value.setLogoLocation(logoLocation);
-
- return value;
- }
-
- private WebappConfiguration readWebappConfiguration(String prefix, Registry registry) {
- WebappConfiguration value = new WebappConfiguration();
-
- UserInterfaceOptions ui = readUserInterfaceOptions(prefix + "ui.", registry);
- value.setUi(ui);
-
- return value;
- }
-
- private UserInterfaceOptions readUserInterfaceOptions(String prefix, Registry registry) {
- UserInterfaceOptions value = new UserInterfaceOptions();
-
- boolean showFindArtifacts = registry.getBoolean(prefix + "showFindArtifacts", value.isShowFindArtifacts());
- value.setShowFindArtifacts(showFindArtifacts);
- boolean appletFindEnabled = registry.getBoolean(prefix + "appletFindEnabled", value.isAppletFindEnabled());
- value.setAppletFindEnabled(appletFindEnabled);
- boolean disableEasterEggs = registry.getBoolean(prefix + "disableEasterEggs", value.isDisableEasterEggs());
- value.setDisableEasterEggs(disableEasterEggs);
- //String applicationUrl = registry.getString( prefix + "applicationUrl", value.getApplicationUrl() );
-
- List<String> applicationUrlList = registry.getList(prefix + "applicationUrl");
- String applicationUrl = value.getApplicationUrl();
- if (applicationUrlList != null && !applicationUrlList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = applicationUrlList.size(); i < size; i++) {
- sb.append(applicationUrlList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- applicationUrl = sb.toString();
- }
-
- value.setApplicationUrl(applicationUrl);
- boolean disableRegistration = registry.getBoolean(prefix + "disableRegistration", value.isDisableRegistration());
- value.setDisableRegistration(disableRegistration);
-
- return value;
- }
-
- private NetworkConfiguration readNetworkConfiguration(String prefix, Registry registry) {
- NetworkConfiguration value = new NetworkConfiguration();
-
- int maxTotal = registry.getInt(prefix + "maxTotal", value.getMaxTotal());
- value.setMaxTotal(maxTotal);
- int maxTotalPerHost = registry.getInt(prefix + "maxTotalPerHost", value.getMaxTotalPerHost());
- value.setMaxTotalPerHost(maxTotalPerHost);
- boolean usePooling = registry.getBoolean(prefix + "usePooling", value.isUsePooling());
- value.setUsePooling(usePooling);
-
- return value;
- }
-
- private ArchivaRuntimeConfiguration readArchivaRuntimeConfiguration(String prefix, Registry registry) {
- ArchivaRuntimeConfiguration value = new ArchivaRuntimeConfiguration();
-
- CacheConfiguration urlFailureCacheConfiguration = readCacheConfiguration(prefix + "urlFailureCacheConfiguration.", registry);
- value.setUrlFailureCacheConfiguration(urlFailureCacheConfiguration);
- FileLockConfiguration fileLockConfiguration = readFileLockConfiguration(prefix + "fileLockConfiguration.", registry);
- value.setFileLockConfiguration(fileLockConfiguration);
- //String dataDirectory = registry.getString( prefix + "dataDirectory", value.getDataDirectory() );
-
- List<String> dataDirectoryList = registry.getList(prefix + "dataDirectory");
- String dataDirectory = value.getDataDirectory();
- if (dataDirectoryList != null && !dataDirectoryList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = dataDirectoryList.size(); i < size; i++) {
- sb.append(dataDirectoryList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- dataDirectory = sb.toString();
- }
-
- value.setDataDirectory(dataDirectory);
- //String repositoryBaseDirectory = registry.getString( prefix + "repositoryBaseDirectory", value.getRepositoryBaseDirectory() );
-
- List<String> repositoryBaseDirectoryList = registry.getList(prefix + "repositoryBaseDirectory");
- String repositoryBaseDirectory = value.getRepositoryBaseDirectory();
- if (repositoryBaseDirectoryList != null && !repositoryBaseDirectoryList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = repositoryBaseDirectoryList.size(); i < size; i++) {
- sb.append(repositoryBaseDirectoryList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- repositoryBaseDirectory = sb.toString();
- }
-
- value.setRepositoryBaseDirectory(repositoryBaseDirectory);
- //String remoteRepositoryBaseDirectory = registry.getString( prefix + "remoteRepositoryBaseDirectory", value.getRemoteRepositoryBaseDirectory() );
-
- List<String> remoteRepositoryBaseDirectoryList = registry.getList(prefix + "remoteRepositoryBaseDirectory");
- String remoteRepositoryBaseDirectory = value.getRemoteRepositoryBaseDirectory();
- if (remoteRepositoryBaseDirectoryList != null && !remoteRepositoryBaseDirectoryList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = remoteRepositoryBaseDirectoryList.size(); i < size; i++) {
- sb.append(remoteRepositoryBaseDirectoryList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- remoteRepositoryBaseDirectory = sb.toString();
- }
-
- value.setRemoteRepositoryBaseDirectory(remoteRepositoryBaseDirectory);
- //String defaultLanguage = registry.getString( prefix + "defaultLanguage", value.getDefaultLanguage() );
-
-
- List<String> repositoryGroupBaseDirectoryList = registry.getList(prefix + "repositoryGroupBaseDirectory");
- String repositoryGroupBaseDirectory = value.getRepositoryGroupBaseDirectory();
- if (repositoryGroupBaseDirectoryList != null && !repositoryGroupBaseDirectoryList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = repositoryGroupBaseDirectoryList.size(); i < size; i++) {
- sb.append(repositoryGroupBaseDirectoryList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- repositoryGroupBaseDirectory = sb.toString();
- }
-
- value.setRepositoryGroupBaseDirectory(repositoryGroupBaseDirectory);
-
- List<String> defaultLanguageList = registry.getList(prefix + "defaultLanguage");
- String defaultLanguage = value.getDefaultLanguage();
- if (defaultLanguageList != null && !defaultLanguageList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = defaultLanguageList.size(); i < size; i++) {
- sb.append(defaultLanguageList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- defaultLanguage = sb.toString();
- }
-
- value.setDefaultLanguage(defaultLanguage);
- //String languageRange = registry.getString( prefix + "languageRange", value.getLanguageRange() );
-
- List<String> languageRangeList = registry.getList(prefix + "languageRange");
- String languageRange = value.getLanguageRange();
- if (languageRangeList != null && !languageRangeList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = languageRangeList.size(); i < size; i++) {
- sb.append(languageRangeList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- languageRange = sb.toString();
- }
-
- value.setLanguageRange(languageRange);
-
- List<String> checksumTypeList = registry.getList(prefix + "checksumTypes.type");
- value.setChecksumTypes(checksumTypeList);
-
- return value;
- }
-
- private RedbackRuntimeConfiguration readRedbackRuntimeConfiguration(String prefix, Registry registry) {
- RedbackRuntimeConfiguration value = new RedbackRuntimeConfiguration();
-
- boolean migratedFromRedbackConfiguration = registry.getBoolean(prefix + "migratedFromRedbackConfiguration", value.isMigratedFromRedbackConfiguration());
- value.setMigratedFromRedbackConfiguration(migratedFromRedbackConfiguration);
- java.util.List userManagerImpls = new java.util.ArrayList/*<String>*/();
- userManagerImpls.addAll(registry.getList(prefix + "userManagerImpls.userManagerImpl"));
- value.setUserManagerImpls(userManagerImpls);
- java.util.List rbacManagerImpls = new java.util.ArrayList/*<String>*/();
- rbacManagerImpls.addAll(registry.getList(prefix + "rbacManagerImpls.rbacManagerImpl"));
- value.setRbacManagerImpls(rbacManagerImpls);
- LdapConfiguration ldapConfiguration = readLdapConfiguration(prefix + "ldapConfiguration.", registry);
- value.setLdapConfiguration(ldapConfiguration);
- java.util.List ldapGroupMappings = new java.util.ArrayList/*<LdapGroupMapping>*/();
- List ldapGroupMappingsSubsets = registry.getSubsetList(prefix + "ldapGroupMappings.ldapGroupMapping");
- for (Iterator i = ldapGroupMappingsSubsets.iterator(); i.hasNext(); ) {
- LdapGroupMapping v = readLdapGroupMapping("", (Registry) i.next());
- ldapGroupMappings.add(v);
- }
- value.setLdapGroupMappings(ldapGroupMappings);
- java.util.Map configurationProperties = registry.getProperties(prefix + "configurationProperties");
- value.setConfigurationProperties(configurationProperties);
- boolean useUsersCache = registry.getBoolean(prefix + "useUsersCache", value.isUseUsersCache());
- value.setUseUsersCache(useUsersCache);
- CacheConfiguration usersCacheConfiguration = readCacheConfiguration(prefix + "usersCacheConfiguration.", registry);
- value.setUsersCacheConfiguration(usersCacheConfiguration);
-
- return value;
- }
-
- private ArchivaDefaultConfiguration readArchivaDefaultConfiguration(String prefix, Registry registry) {
- ArchivaDefaultConfiguration value = new ArchivaDefaultConfiguration();
-
- java.util.List defaultCheckPaths = new java.util.ArrayList/*<RepositoryCheckPath>*/();
- List defaultCheckPathsSubsets = registry.getSubsetList(prefix + "defaultCheckPaths.defaultCheckPath");
- for (Iterator i = defaultCheckPathsSubsets.iterator(); i.hasNext(); ) {
- RepositoryCheckPath v = readRepositoryCheckPath("", (Registry) i.next());
- defaultCheckPaths.add(v);
- }
- value.setDefaultCheckPaths(defaultCheckPaths);
-
- return value;
- }
-
- private LdapConfiguration readLdapConfiguration(String prefix, Registry registry) {
- LdapConfiguration value = new LdapConfiguration();
-
- //String hostName = registry.getString( prefix + "hostName", value.getHostName() );
-
- List<String> hostNameList = registry.getList(prefix + "hostName");
- String hostName = value.getHostName();
- if (hostNameList != null && !hostNameList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = hostNameList.size(); i < size; i++) {
- sb.append(hostNameList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- hostName = sb.toString();
- }
-
- value.setHostName(hostName);
- int port = registry.getInt(prefix + "port", value.getPort());
- value.setPort(port);
- boolean ssl = registry.getBoolean(prefix + "ssl", value.isSsl());
- value.setSsl(ssl);
- //String baseDn = registry.getString( prefix + "baseDn", value.getBaseDn() );
-
- List<String> baseDnList = registry.getList(prefix + "baseDn");
- String baseDn = value.getBaseDn();
- if (baseDnList != null && !baseDnList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = baseDnList.size(); i < size; i++) {
- sb.append(baseDnList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- baseDn = sb.toString();
- }
-
- value.setBaseDn(baseDn);
- //String baseGroupsDn = registry.getString( prefix + "baseGroupsDn", value.getBaseGroupsDn() );
-
- List<String> baseGroupsDnList = registry.getList(prefix + "baseGroupsDn");
- String baseGroupsDn = value.getBaseGroupsDn();
- if (baseGroupsDnList != null && !baseGroupsDnList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = baseGroupsDnList.size(); i < size; i++) {
- sb.append(baseGroupsDnList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- baseGroupsDn = sb.toString();
- }
-
- value.setBaseGroupsDn(baseGroupsDn);
- //String contextFactory = registry.getString( prefix + "contextFactory", value.getContextFactory() );
-
- List<String> contextFactoryList = registry.getList(prefix + "contextFactory");
- String contextFactory = value.getContextFactory();
- if (contextFactoryList != null && !contextFactoryList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = contextFactoryList.size(); i < size; i++) {
- sb.append(contextFactoryList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- contextFactory = sb.toString();
- }
-
- value.setContextFactory(contextFactory);
- //String bindDn = registry.getString( prefix + "bindDn", value.getBindDn() );
-
- List<String> bindDnList = registry.getList(prefix + "bindDn");
- String bindDn = value.getBindDn();
- if (bindDnList != null && !bindDnList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = bindDnList.size(); i < size; i++) {
- sb.append(bindDnList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- bindDn = sb.toString();
- }
-
- value.setBindDn(bindDn);
- //String password = registry.getString( prefix + "password", value.getPassword() );
-
- List<String> passwordList = registry.getList(prefix + "password");
- String password = value.getPassword();
- if (passwordList != null && !passwordList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = passwordList.size(); i < size; i++) {
- sb.append(passwordList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- password = sb.toString();
- }
-
- value.setPassword(password);
- //String authenticationMethod = registry.getString( prefix + "authenticationMethod", value.getAuthenticationMethod() );
-
- List<String> authenticationMethodList = registry.getList(prefix + "authenticationMethod");
- String authenticationMethod = value.getAuthenticationMethod();
- if (authenticationMethodList != null && !authenticationMethodList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = authenticationMethodList.size(); i < size; i++) {
- sb.append(authenticationMethodList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- authenticationMethod = sb.toString();
- }
-
- value.setAuthenticationMethod(authenticationMethod);
- boolean bindAuthenticatorEnabled = registry.getBoolean(prefix + "bindAuthenticatorEnabled", value.isBindAuthenticatorEnabled());
- value.setBindAuthenticatorEnabled(bindAuthenticatorEnabled);
- boolean writable = registry.getBoolean(prefix + "writable", value.isWritable());
- value.setWritable(writable);
- boolean useRoleNameAsGroup = registry.getBoolean(prefix + "useRoleNameAsGroup", value.isUseRoleNameAsGroup());
- value.setUseRoleNameAsGroup(useRoleNameAsGroup);
- java.util.Map extraProperties = registry.getProperties(prefix + "extraProperties");
- value.setExtraProperties(extraProperties);
-
- return value;
- }
-
- private FileLockConfiguration readFileLockConfiguration(String prefix, Registry registry) {
- FileLockConfiguration value = new FileLockConfiguration();
-
- boolean skipLocking = registry.getBoolean(prefix + "skipLocking", value.isSkipLocking());
- value.setSkipLocking(skipLocking);
- int lockingTimeout = registry.getInt(prefix + "lockingTimeout", value.getLockingTimeout());
- value.setLockingTimeout(lockingTimeout);
-
- return value;
- }
-
- private CacheConfiguration readCacheConfiguration(String prefix, Registry registry) {
- CacheConfiguration value = new CacheConfiguration();
-
- int timeToIdleSeconds = registry.getInt(prefix + "timeToIdleSeconds", value.getTimeToIdleSeconds());
- value.setTimeToIdleSeconds(timeToIdleSeconds);
- int timeToLiveSeconds = registry.getInt(prefix + "timeToLiveSeconds", value.getTimeToLiveSeconds());
- value.setTimeToLiveSeconds(timeToLiveSeconds);
- int maxElementsInMemory = registry.getInt(prefix + "maxElementsInMemory", value.getMaxElementsInMemory());
- value.setMaxElementsInMemory(maxElementsInMemory);
- int maxElementsOnDisk = registry.getInt(prefix + "maxElementsOnDisk", value.getMaxElementsOnDisk());
- value.setMaxElementsOnDisk(maxElementsOnDisk);
-
- return value;
- }
-
- private LdapGroupMapping readLdapGroupMapping(String prefix, Registry registry) {
- LdapGroupMapping value = new LdapGroupMapping();
-
- //String group = registry.getString( prefix + "group", value.getGroup() );
-
- List<String> groupList = registry.getList(prefix + "group");
- String group = value.getGroup();
- if (groupList != null && !groupList.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0, size = groupList.size(); i < size; i++) {
- sb.append(groupList.get(i));
- if (i < size - 1) {
- sb.append(',');
- }
- }
- group = sb.toString();
- }
-
- value.setGroup(group);
- java.util.List roleNames = new java.util.ArrayList/*<String>*/();
- roleNames.addAll(registry.getList(prefix + "roleNames.roleName"));
- value.setRoleNames(roleNames);
-
- return value;
- }
-
-}
+++ /dev/null
-
-package org.apache.archiva.configuration.io.registry;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.*;
-import org.apache.archiva.components.registry.Registry;
-
-import java.util.Iterator;
-import java.util.List;
-
-// Util imports
-// Model class imports
-
-
-/**
- * Generate Plexus Registry output mechanism for model 'Configuration'.
- */
-public class ConfigurationRegistryWriter {
- public void write(Configuration model, Registry registry) {
- writeConfiguration("", model, registry);
- }
-
- private void writeList(Registry registry, List<String> subList, String subsetPath, String elementName) {
- if (subList != null && subList.size() > 0
- ) {
- registry.removeSubset(subsetPath);
-
- int count = 0;
- for (Iterator<String> iter = subList.iterator(); iter.hasNext(); count++) {
- String name = subsetPath + "." + elementName + "(" + count + ")";
- String value = iter.next();
- registry.setString(name, value);
- }
- }
- }
-
- private void writeConfiguration(String prefix, Configuration value, Registry registry) {
- if (value != null) {
- if (value.getVersion() != null
- ) {
- String version = "version";
- registry.setString(prefix + version, value.getVersion());
- }
- if (value.getMetadataStore() != null && !value.getMetadataStore().equals("jcr")
- ) {
- String metadataStore = "metadataStore";
- registry.setString(prefix + metadataStore, value.getMetadataStore());
- }
- if (value.getRepositoryGroups() != null && value.getRepositoryGroups().size() > 0
- ) {
- registry.removeSubset(prefix + "repositoryGroups");
-
- int count = 0;
- for (Iterator iter = value.getRepositoryGroups().iterator(); iter.hasNext(); count++) {
- String name = "repositoryGroups.repositoryGroup(" + count + ")";
- RepositoryGroupConfiguration o = (RepositoryGroupConfiguration) iter.next();
- writeRepositoryGroupConfiguration(prefix + name + ".", o, registry);
- }
- }
- if (value.getManagedRepositories() != null && value.getManagedRepositories().size() > 0
- ) {
- registry.removeSubset(prefix + "managedRepositories");
-
- int count = 0;
- for (Iterator iter = value.getManagedRepositories().iterator(); iter.hasNext(); count++) {
- String name = "managedRepositories.managedRepository(" + count + ")";
- ManagedRepositoryConfiguration o = (ManagedRepositoryConfiguration) iter.next();
- writeManagedRepositoryConfiguration(prefix + name + ".", o, registry);
- }
- }
- if (value.getRemoteRepositories() != null && value.getRemoteRepositories().size() > 0
- ) {
- registry.removeSubset(prefix + "remoteRepositories");
-
- int count = 0;
- for (Iterator iter = value.getRemoteRepositories().iterator(); iter.hasNext(); count++) {
- String name = "remoteRepositories.remoteRepository(" + count + ")";
- RemoteRepositoryConfiguration o = (RemoteRepositoryConfiguration) iter.next();
- writeRemoteRepositoryConfiguration(prefix + name + ".", o, registry);
- }
- }
- if (value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
- ) {
- registry.removeSubset(prefix + "proxyConnectors");
-
- int count = 0;
- for (Iterator iter = value.getProxyConnectors().iterator(); iter.hasNext(); count++) {
- String name = "proxyConnectors.proxyConnector(" + count + ")";
- ProxyConnectorConfiguration o = (ProxyConnectorConfiguration) iter.next();
- writeProxyConnectorConfiguration(prefix + name + ".", o, registry);
- }
- }
- if (value.getNetworkProxies() != null && value.getNetworkProxies().size() > 0
- ) {
- registry.removeSubset(prefix + "networkProxies");
-
- int count = 0;
- for (Iterator iter = value.getNetworkProxies().iterator(); iter.hasNext(); count++) {
- String name = "networkProxies.networkProxy(" + count + ")";
- NetworkProxyConfiguration o = (NetworkProxyConfiguration) iter.next();
- writeNetworkProxyConfiguration(prefix + name + ".", o, registry);
- }
- }
- if (value.getLegacyArtifactPaths() != null && value.getLegacyArtifactPaths().size() > 0
- ) {
- registry.removeSubset(prefix + "legacyArtifactPaths");
-
- int count = 0;
- for (Iterator iter = value.getLegacyArtifactPaths().iterator(); iter.hasNext(); count++) {
- String name = "legacyArtifactPaths.legacyArtifactPath(" + count + ")";
- LegacyArtifactPath o = (LegacyArtifactPath) iter.next();
- writeLegacyArtifactPath(prefix + name + ".", o, registry);
- }
- }
- if (value.getRepositoryScanning() != null
- ) {
- writeRepositoryScanningConfiguration(prefix + "repositoryScanning.", value.getRepositoryScanning(), registry);
- }
- if (value.getWebapp() != null
- ) {
- writeWebappConfiguration(prefix + "webapp.", value.getWebapp(), registry);
- }
- if (value.getOrganisationInfo() != null
- ) {
- writeOrganisationInformation(prefix + "organisationInfo.", value.getOrganisationInfo(), registry);
- }
- if (value.getNetworkConfiguration() != null
- ) {
- writeNetworkConfiguration(prefix + "networkConfiguration.", value.getNetworkConfiguration(), registry);
- }
- if (value.getRedbackRuntimeConfiguration() != null
- ) {
- writeRedbackRuntimeConfiguration(prefix + "redbackRuntimeConfiguration.", value.getRedbackRuntimeConfiguration(), registry);
- }
- if (value.getArchivaRuntimeConfiguration() != null
- ) {
- writeArchivaRuntimeConfiguration(prefix + "archivaRuntimeConfiguration.", value.getArchivaRuntimeConfiguration(), registry);
- }
- if (value.getProxyConnectorRuleConfigurations() != null && value.getProxyConnectorRuleConfigurations().size() > 0
- ) {
- registry.removeSubset(prefix + "proxyConnectorRuleConfigurations");
-
- int count = 0;
- for (Iterator iter = value.getProxyConnectorRuleConfigurations().iterator(); iter.hasNext(); count++) {
- String name = "proxyConnectorRuleConfigurations.proxyConnectorRuleConfiguration(" + count + ")";
- ProxyConnectorRuleConfiguration o = (ProxyConnectorRuleConfiguration) iter.next();
- writeProxyConnectorRuleConfiguration(prefix + name + ".", o, registry);
- }
- }
- if (value.getArchivaDefaultConfiguration() != null
- ) {
- writeArchivaDefaultConfiguration(prefix + "archivaDefaultConfiguration.", value.getArchivaDefaultConfiguration(), registry);
- }
- }
- }
-
- private void writeAbstractRepositoryConfiguration(String prefix, AbstractRepositoryConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getId() != null
- ) {
- String id = "id";
- registry.setString(prefix + id, value.getId());
- }
- if (value.getType() != null && !value.getType().equals("MAVEN")
- ) {
- String type = "type";
- registry.setString(prefix + type, value.getType());
- }
- if (value.getName() != null
- ) {
- String name = "name";
- registry.setString(prefix + name, value.getName());
- }
- if (value.getLayout() != null && !value.getLayout().equals("default")
- ) {
- String layout = "layout";
- registry.setString(prefix + layout, value.getLayout());
- }
- if (value.getIndexDir() != null && !value.getIndexDir().equals("")
- ) {
- String indexDir = "indexDir";
- registry.setString(prefix + indexDir, value.getIndexDir());
- }
- if (value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals("")
- ) {
- String packedIndexDir = "packedIndexDir";
- registry.setString(prefix + packedIndexDir, value.getPackedIndexDir());
- }
- if (value.getDescription() != null && !value.getDescription().equals("")
- ) {
- String description = "description";
- registry.setString(prefix + description, value.getDescription());
- }
- }
- }
-
- private void writeRemoteRepositoryConfiguration(String prefix, RemoteRepositoryConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getUrl() != null
- ) {
- String url = "url";
- registry.setString(prefix + url, value.getUrl());
- }
- if (value.getUsername() != null
- ) {
- String username = "username";
- registry.setString(prefix + username, value.getUsername());
- }
- if (value.getPassword() != null
- ) {
- String password = "password";
- registry.setString(prefix + password, value.getPassword());
- }
- if (value.getTimeout() != 60
- ) {
- String timeout = "timeout";
- registry.setInt(prefix + timeout, value.getTimeout());
- }
- if (value.getRefreshCronExpression() != null && !value.getRefreshCronExpression().equals("0 0 08 ? * SUN")
- ) {
- String refreshCronExpression = "refreshCronExpression";
- registry.setString(prefix + refreshCronExpression, value.getRefreshCronExpression());
- }
- String downloadRemoteIndex = "downloadRemoteIndex";
- registry.setBoolean(prefix + downloadRemoteIndex, value.isDownloadRemoteIndex());
- if (value.getRemoteIndexUrl() != null
- ) {
- String remoteIndexUrl = "remoteIndexUrl";
- registry.setString(prefix + remoteIndexUrl, value.getRemoteIndexUrl());
- }
- if (value.getRemoteDownloadNetworkProxyId() != null
- ) {
- String remoteDownloadNetworkProxyId = "remoteDownloadNetworkProxyId";
- registry.setString(prefix + remoteDownloadNetworkProxyId, value.getRemoteDownloadNetworkProxyId());
- }
- if (value.getRemoteDownloadTimeout() != 300
- ) {
- String remoteDownloadTimeout = "remoteDownloadTimeout";
- registry.setInt(prefix + remoteDownloadTimeout, value.getRemoteDownloadTimeout());
- }
- String downloadRemoteIndexOnStartup = "downloadRemoteIndexOnStartup";
- registry.setBoolean(prefix + downloadRemoteIndexOnStartup, value.isDownloadRemoteIndexOnStartup());
- if (value.getExtraParameters() != null && value.getExtraParameters().size() > 0
- ) {
- registry.removeSubset(prefix + "extraParameters");
-
- for (Iterator iter = value.getExtraParameters().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getExtraParameters().get(key);
-
- registry.setString(prefix + "extraParameters." + key, v);
- }
- }
- if (value.getExtraHeaders() != null && value.getExtraHeaders().size() > 0
- ) {
- registry.removeSubset(prefix + "extraHeaders");
-
- for (Iterator iter = value.getExtraHeaders().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getExtraHeaders().get(key);
-
- registry.setString(prefix + "extraHeaders." + key, v);
- }
- }
- if (value.getCheckPath() != null
- ) {
- String checkPath = "checkPath";
- registry.setString(prefix + checkPath, value.getCheckPath());
- }
- if (value.getId() != null
- ) {
- String id = "id";
- registry.setString(prefix + id, value.getId());
- }
- if (value.getType() != null && !value.getType().equals("MAVEN")
- ) {
- String type = "type";
- registry.setString(prefix + type, value.getType());
- }
- if (value.getName() != null
- ) {
- String name = "name";
- registry.setString(prefix + name, value.getName());
- }
- if (value.getLayout() != null && !value.getLayout().equals("default")
- ) {
- String layout = "layout";
- registry.setString(prefix + layout, value.getLayout());
- }
- if (value.getIndexDir() != null && !value.getIndexDir().equals("")
- ) {
- String indexDir = "indexDir";
- registry.setString(prefix + indexDir, value.getIndexDir());
- }
- if (value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals("")
- ) {
- String packedIndexDir = "packedIndexDir";
- registry.setString(prefix + packedIndexDir, value.getPackedIndexDir());
- }
- if (value.getDescription() != null && !value.getDescription().equals("")
- ) {
- String description = "description";
- registry.setString(prefix + description, value.getDescription());
- }
- }
- }
-
- private void writeManagedRepositoryConfiguration(String prefix, ManagedRepositoryConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getLocation() != null
- ) {
- String location = "location";
- registry.setString(prefix + location, value.getLocation());
- }
- String releases = "releases";
- registry.setBoolean(prefix + releases, value.isReleases());
- String blockRedeployments = "blockRedeployments";
- registry.setBoolean(prefix + blockRedeployments, value.isBlockRedeployments());
- String snapshots = "snapshots";
- registry.setBoolean(prefix + snapshots, value.isSnapshots());
- String scanned = "scanned";
- registry.setBoolean(prefix + scanned, value.isScanned());
- if (value.getRefreshCronExpression() != null && !value.getRefreshCronExpression().equals("0 0 * * * ?")
- ) {
- String refreshCronExpression = "refreshCronExpression";
- registry.setString(prefix + refreshCronExpression, value.getRefreshCronExpression());
- }
- if (value.getRetentionCount() != 2
- ) {
- String retentionCount = "retentionCount";
- registry.setInt(prefix + retentionCount, value.getRetentionCount());
- }
- if (value.getRetentionPeriod() != 100
- ) {
- String retentionPeriod = "retentionPeriod";
- registry.setInt(prefix + retentionPeriod, value.getRetentionPeriod());
- }
- String deleteReleasedSnapshots = "deleteReleasedSnapshots";
- registry.setBoolean(prefix + deleteReleasedSnapshots, value.isDeleteReleasedSnapshots());
- String skipPackedIndexCreation = "skipPackedIndexCreation";
- registry.setBoolean(prefix + skipPackedIndexCreation, value.isSkipPackedIndexCreation());
- String stageRepoNeeded = "stageRepoNeeded";
- registry.setBoolean(prefix + stageRepoNeeded, value.isStageRepoNeeded());
- if (value.getId() != null
- ) {
- String id = "id";
- registry.setString(prefix + id, value.getId());
- }
- if (value.getType() != null && !value.getType().equals("MAVEN")
- ) {
- String type = "type";
- registry.setString(prefix + type, value.getType());
- }
- if (value.getName() != null
- ) {
- String name = "name";
- registry.setString(prefix + name, value.getName());
- }
- if (value.getLayout() != null && !value.getLayout().equals("default")
- ) {
- String layout = "layout";
- registry.setString(prefix + layout, value.getLayout());
- }
- if (value.getIndexDir() != null && !value.getIndexDir().equals("")
- ) {
- String indexDir = "indexDir";
- registry.setString(prefix + indexDir, value.getIndexDir());
- }
- if (value.getPackedIndexDir() != null && !value.getPackedIndexDir().equals("")
- ) {
- String packedIndexDir = "packedIndexDir";
- registry.setString(prefix + packedIndexDir, value.getPackedIndexDir());
- }
- if (value.getDescription() != null && !value.getDescription().equals("")
- ) {
- String description = "description";
- registry.setString(prefix + description, value.getDescription());
- }
- }
- }
-
- private void writeLegacyArtifactPath(String prefix, LegacyArtifactPath value, Registry registry) {
- if (value != null) {
- if (value.getPath() != null
- ) {
- String path = "path";
- registry.setString(prefix + path, value.getPath());
- }
- if (value.getArtifact() != null
- ) {
- String artifact = "artifact";
- registry.setString(prefix + artifact, value.getArtifact());
- }
- }
- }
-
- private void writeRepositoryGroupConfiguration(String prefix, RepositoryGroupConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getId() != null
- ) {
- String id = "id";
- registry.setString(prefix + id, value.getId());
- }
- if (value.getName() != null) {
- registry.setString(prefix + "name", value.getName());
- }
- if (value.getType() != null) {
- registry.setString(prefix + "type", value.getType());
- }
- if (value.getLocation()!=null) {
- registry.setString( prefix+"location", value.getType( ) );
- }
- if (value.getMergedIndexPath() != null && !value.getMergedIndexPath().equals(".indexer")
- ) {
- String mergedIndexPath = "mergedIndexPath";
- registry.setString(prefix + mergedIndexPath, value.getMergedIndexPath());
- }
- if (value.getMergedIndexTtl() != 30
- ) {
- String mergedIndexTtl = "mergedIndexTtl";
- registry.setInt(prefix + mergedIndexTtl, value.getMergedIndexTtl());
- }
- if (value.getCronExpression() != null && !value.getCronExpression().equals("")
- ) {
- String cronExpression = "cronExpression";
- registry.setString(prefix + cronExpression, value.getCronExpression());
- }
- if (value.getRepositories() != null && value.getRepositories().size() > 0
- ) {
- registry.removeSubset(prefix + "repositories");
-
- int count = 0;
- for (Iterator iter = value.getRepositories().iterator(); iter.hasNext(); count++) {
- String name = "repositories.repository(" + count + ")";
- String repository = (String) iter.next();
- registry.setString(prefix + name, repository);
- }
- }
- }
- }
-
- private void writeRepositoryCheckPath(String prefix, RepositoryCheckPath value, Registry registry) {
- if (value != null) {
- if (value.getUrl() != null
- ) {
- String url = "url";
- registry.setString(prefix + url, value.getUrl());
- }
- if (value.getPath() != null
- ) {
- String path = "path";
- registry.setString(prefix + path, value.getPath());
- }
- }
- }
-
- private void writeAbstractRepositoryConnectorConfiguration(String prefix, AbstractRepositoryConnectorConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getSourceRepoId() != null
- ) {
- String sourceRepoId = "sourceRepoId";
- registry.setString(prefix + sourceRepoId, value.getSourceRepoId());
- }
- if (value.getTargetRepoId() != null
- ) {
- String targetRepoId = "targetRepoId";
- registry.setString(prefix + targetRepoId, value.getTargetRepoId());
- }
- if (value.getProxyId() != null
- ) {
- String proxyId = "proxyId";
- registry.setString(prefix + proxyId, value.getProxyId());
- }
- if (value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "blackListPatterns");
-
- int count = 0;
- for (Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++) {
- String name = "blackListPatterns.blackListPattern(" + count + ")";
- String blackListPattern = (String) iter.next();
- registry.setString(prefix + name, blackListPattern);
- }
- }
- if (value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "whiteListPatterns");
-
- int count = 0;
- for (Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++) {
- String name = "whiteListPatterns.whiteListPattern(" + count + ")";
- String whiteListPattern = (String) iter.next();
- registry.setString(prefix + name, whiteListPattern);
- }
- }
- if (value.getPolicies() != null && value.getPolicies().size() > 0
- ) {
- registry.removeSubset(prefix + "policies");
-
- for (Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getPolicies().get(key);
-
- registry.setString(prefix + "policies." + key, v);
- }
- }
- if (value.getProperties() != null && value.getProperties().size() > 0
- ) {
- registry.removeSubset(prefix + "properties");
-
- for (Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getProperties().get(key);
-
- registry.setString(prefix + "properties." + key, v);
- }
- }
- String disabled = "disabled";
- registry.setBoolean(prefix + disabled, value.isDisabled());
- }
- }
-
- private void writeProxyConnectorRuleConfiguration(String prefix, ProxyConnectorRuleConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getRuleType() != null
- ) {
- String ruleType = "ruleType";
- registry.setString(prefix + ruleType, value.getRuleType());
- }
- if (value.getPattern() != null
- ) {
- String pattern = "pattern";
- registry.setString(prefix + pattern, value.getPattern());
- }
- if (value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
- ) {
- registry.removeSubset(prefix + "proxyConnectors");
-
- int count = 0;
- for (Iterator iter = value.getProxyConnectors().iterator(); iter.hasNext(); count++) {
- String name = "proxyConnectors.proxyConnector(" + count + ")";
- ProxyConnectorConfiguration o = (ProxyConnectorConfiguration) iter.next();
- writeProxyConnectorConfiguration(prefix + name + ".", o, registry);
- }
- }
- }
- }
-
- private void writeProxyConnectorConfiguration(String prefix, ProxyConnectorConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getOrder() != 0
- ) {
- String order = "order";
- registry.setInt(prefix + order, value.getOrder());
- }
- if (value.getSourceRepoId() != null
- ) {
- String sourceRepoId = "sourceRepoId";
- registry.setString(prefix + sourceRepoId, value.getSourceRepoId());
- }
- if (value.getTargetRepoId() != null
- ) {
- String targetRepoId = "targetRepoId";
- registry.setString(prefix + targetRepoId, value.getTargetRepoId());
- }
- if (value.getProxyId() != null
- ) {
- String proxyId = "proxyId";
- registry.setString(prefix + proxyId, value.getProxyId());
- }
- if (value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "blackListPatterns");
-
- int count = 0;
- for (Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++) {
- String name = "blackListPatterns.blackListPattern(" + count + ")";
- String blackListPattern = (String) iter.next();
- registry.setString(prefix + name, blackListPattern);
- }
- }
- if (value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "whiteListPatterns");
-
- int count = 0;
- for (Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++) {
- String name = "whiteListPatterns.whiteListPattern(" + count + ")";
- String whiteListPattern = (String) iter.next();
- registry.setString(prefix + name, whiteListPattern);
- }
- }
- if (value.getPolicies() != null && value.getPolicies().size() > 0
- ) {
- registry.removeSubset(prefix + "policies");
-
- for (Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getPolicies().get(key);
-
- registry.setString(prefix + "policies." + key, v);
- }
- }
- if (value.getProperties() != null && value.getProperties().size() > 0
- ) {
- registry.removeSubset(prefix + "properties");
-
- for (Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getProperties().get(key);
-
- registry.setString(prefix + "properties." + key, v);
- }
- }
- String disabled = "disabled";
- registry.setBoolean(prefix + disabled, value.isDisabled());
- }
- }
-
- private void writeSyncConnectorConfiguration(String prefix, SyncConnectorConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getCronExpression() != null && !value.getCronExpression().equals("0 0 * * * ?")
- ) {
- String cronExpression = "cronExpression";
- registry.setString(prefix + cronExpression, value.getCronExpression());
- }
- if (value.getMethod() != null && !value.getMethod().equals("rsync")
- ) {
- String method = "method";
- registry.setString(prefix + method, value.getMethod());
- }
- if (value.getSourceRepoId() != null
- ) {
- String sourceRepoId = "sourceRepoId";
- registry.setString(prefix + sourceRepoId, value.getSourceRepoId());
- }
- if (value.getTargetRepoId() != null
- ) {
- String targetRepoId = "targetRepoId";
- registry.setString(prefix + targetRepoId, value.getTargetRepoId());
- }
- if (value.getProxyId() != null
- ) {
- String proxyId = "proxyId";
- registry.setString(prefix + proxyId, value.getProxyId());
- }
- if (value.getBlackListPatterns() != null && value.getBlackListPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "blackListPatterns");
-
- int count = 0;
- for (Iterator iter = value.getBlackListPatterns().iterator(); iter.hasNext(); count++) {
- String name = "blackListPatterns.blackListPattern(" + count + ")";
- String blackListPattern = (String) iter.next();
- registry.setString(prefix + name, blackListPattern);
- }
- }
- if (value.getWhiteListPatterns() != null && value.getWhiteListPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "whiteListPatterns");
-
- int count = 0;
- for (Iterator iter = value.getWhiteListPatterns().iterator(); iter.hasNext(); count++) {
- String name = "whiteListPatterns.whiteListPattern(" + count + ")";
- String whiteListPattern = (String) iter.next();
- registry.setString(prefix + name, whiteListPattern);
- }
- }
- if (value.getPolicies() != null && value.getPolicies().size() > 0
- ) {
- registry.removeSubset(prefix + "policies");
-
- for (Iterator iter = value.getPolicies().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getPolicies().get(key);
-
- registry.setString(prefix + "policies." + key, v);
- }
- }
- if (value.getProperties() != null && value.getProperties().size() > 0
- ) {
- registry.removeSubset(prefix + "properties");
-
- for (Iterator iter = value.getProperties().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getProperties().get(key);
-
- registry.setString(prefix + "properties." + key, v);
- }
- }
- String disabled = "disabled";
- registry.setBoolean(prefix + disabled, value.isDisabled());
- }
- }
-
- private void writeNetworkProxyConfiguration(String prefix, NetworkProxyConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getId() != null
- ) {
- String id = "id";
- registry.setString(prefix + id, value.getId());
- }
- if (value.getProtocol() != null && !value.getProtocol().equals("http")
- ) {
- String protocol = "protocol";
- registry.setString(prefix + protocol, value.getProtocol());
- }
- if (value.getHost() != null
- ) {
- String host = "host";
- registry.setString(prefix + host, value.getHost());
- }
- if (value.getPort() != 8080
- ) {
- String port = "port";
- registry.setInt(prefix + port, value.getPort());
- }
- if (value.getUsername() != null
- ) {
- String username = "username";
- registry.setString(prefix + username, value.getUsername());
- }
- if (value.getPassword() != null
- ) {
- String password = "password";
- registry.setString(prefix + password, value.getPassword());
- }
- String useNtlm = "useNtlm";
- registry.setBoolean(prefix + useNtlm, value.isUseNtlm());
- }
- }
-
- private void writeRepositoryScanningConfiguration(String prefix, RepositoryScanningConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getFileTypes() != null && value.getFileTypes().size() > 0
- ) {
- registry.removeSubset(prefix + "fileTypes");
-
- int count = 0;
- for (Iterator iter = value.getFileTypes().iterator(); iter.hasNext(); count++) {
- String name = "fileTypes.fileType(" + count + ")";
- FileType o = (FileType) iter.next();
- writeFileType(prefix + name + ".", o, registry);
- }
- }
- if (value.getKnownContentConsumers() != null && value.getKnownContentConsumers().size() > 0
- ) {
- registry.removeSubset(prefix + "knownContentConsumers");
-
- int count = 0;
- for (Iterator iter = value.getKnownContentConsumers().iterator(); iter.hasNext(); count++) {
- String name = "knownContentConsumers.knownContentConsumer(" + count + ")";
- String knownContentConsumer = (String) iter.next();
- registry.setString(prefix + name, knownContentConsumer);
- }
- }
- if (value.getInvalidContentConsumers() != null && value.getInvalidContentConsumers().size() > 0
- ) {
- registry.removeSubset(prefix + "invalidContentConsumers");
-
- int count = 0;
- for (Iterator iter = value.getInvalidContentConsumers().iterator(); iter.hasNext(); count++) {
- String name = "invalidContentConsumers.invalidContentConsumer(" + count + ")";
- String invalidContentConsumer = (String) iter.next();
- registry.setString(prefix + name, invalidContentConsumer);
- }
- }
- }
- }
-
- private void writeFileType(String prefix, FileType value, Registry registry) {
- if (value != null) {
- if (value.getId() != null
- ) {
- String id = "id";
- registry.setString(prefix + id, value.getId());
- }
- if (value.getPatterns() != null && value.getPatterns().size() > 0
- ) {
- registry.removeSubset(prefix + "patterns");
-
- int count = 0;
- for (Iterator iter = value.getPatterns().iterator(); iter.hasNext(); count++) {
- String name = "patterns.pattern(" + count + ")";
- String pattern = (String) iter.next();
- registry.setString(prefix + name, pattern);
- }
- }
- }
- }
-
- private void writeOrganisationInformation(String prefix, OrganisationInformation value, Registry registry) {
- if (value != null) {
- if (value.getName() != null
- ) {
- String name = "name";
- registry.setString(prefix + name, value.getName());
- }
- if (value.getUrl() != null
- ) {
- String url = "url";
- registry.setString(prefix + url, value.getUrl());
- }
- if (value.getLogoLocation() != null
- ) {
- String logoLocation = "logoLocation";
- registry.setString(prefix + logoLocation, value.getLogoLocation());
- }
- }
- }
-
- private void writeWebappConfiguration(String prefix, WebappConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getUi() != null
- ) {
- writeUserInterfaceOptions(prefix + "ui.", value.getUi(), registry);
- }
- }
- }
-
- private void writeUserInterfaceOptions(String prefix, UserInterfaceOptions value, Registry registry) {
- if (value != null) {
- String showFindArtifacts = "showFindArtifacts";
- registry.setBoolean(prefix + showFindArtifacts, value.isShowFindArtifacts());
- String appletFindEnabled = "appletFindEnabled";
- registry.setBoolean(prefix + appletFindEnabled, value.isAppletFindEnabled());
- String disableEasterEggs = "disableEasterEggs";
- registry.setBoolean(prefix + disableEasterEggs, value.isDisableEasterEggs());
- if (value.getApplicationUrl() != null
- ) {
- String applicationUrl = "applicationUrl";
- registry.setString(prefix + applicationUrl, value.getApplicationUrl());
- }
- String disableRegistration = "disableRegistration";
- registry.setBoolean(prefix + disableRegistration, value.isDisableRegistration());
- }
- }
-
- private void writeNetworkConfiguration(String prefix, NetworkConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getMaxTotal() != 30
- ) {
- String maxTotal = "maxTotal";
- registry.setInt(prefix + maxTotal, value.getMaxTotal());
- }
- if (value.getMaxTotalPerHost() != 30
- ) {
- String maxTotalPerHost = "maxTotalPerHost";
- registry.setInt(prefix + maxTotalPerHost, value.getMaxTotalPerHost());
- }
- String usePooling = "usePooling";
- registry.setBoolean(prefix + usePooling, value.isUsePooling());
- }
- }
-
- private void writeArchivaRuntimeConfiguration(String prefix, ArchivaRuntimeConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getUrlFailureCacheConfiguration() != null
- ) {
- writeCacheConfiguration(prefix + "urlFailureCacheConfiguration.", value.getUrlFailureCacheConfiguration(), registry);
- }
- if (value.getFileLockConfiguration() != null
- ) {
- writeFileLockConfiguration(prefix + "fileLockConfiguration.", value.getFileLockConfiguration(), registry);
- }
- if (value.getDataDirectory() != null
- ) {
- String dataDirectory = "dataDirectory";
- registry.setString(prefix + dataDirectory, value.getDataDirectory());
- }
- if (value.getRepositoryBaseDirectory() != null
- ) {
- String repositoryBaseDirectory = "repositoryBaseDirectory";
- registry.setString(prefix + repositoryBaseDirectory, value.getRepositoryBaseDirectory());
- }
- if (value.getRemoteRepositoryBaseDirectory() != null
- ) {
- String remoteRepositoryBaseDirectory = "remoteRepositoryBaseDirectory";
- registry.setString(prefix + remoteRepositoryBaseDirectory, value.getRemoteRepositoryBaseDirectory());
- }
- if (value.getRepositoryGroupBaseDirectory() != null
- ) {
- String repositoryGroupBaseDirectory = "repositoryGroupBaseDirectory";
- registry.setString(prefix + repositoryGroupBaseDirectory, value.getRepositoryGroupBaseDirectory());
- }
-
- if (value.getDefaultLanguage() != null && !value.getDefaultLanguage().equals("en-US")
- ) {
- String defaultLanguage = "defaultLanguage";
- registry.setString(prefix + defaultLanguage, value.getDefaultLanguage());
- }
- if (value.getLanguageRange() != null && !value.getLanguageRange().equals("en,fr,de")
- ) {
- String languageRange = "languageRange";
- registry.setString(prefix + languageRange, value.getLanguageRange());
- }
- writeList(registry, value.getChecksumTypes(), prefix+"checksumTypes", "type");
- }
- }
-
- private void writeRedbackRuntimeConfiguration(String prefix, RedbackRuntimeConfiguration value, Registry registry) {
- if (value != null) {
- String migratedFromRedbackConfiguration = "migratedFromRedbackConfiguration";
- registry.setBoolean(prefix + migratedFromRedbackConfiguration, value.isMigratedFromRedbackConfiguration());
- if (value.getUserManagerImpls() != null && value.getUserManagerImpls().size() > 0
- ) {
- registry.removeSubset(prefix + "userManagerImpls");
-
- int count = 0;
- for (Iterator iter = value.getUserManagerImpls().iterator(); iter.hasNext(); count++) {
- String name = "userManagerImpls.userManagerImpl(" + count + ")";
- String userManagerImpl = (String) iter.next();
- registry.setString(prefix + name, userManagerImpl);
- }
- }
- if (value.getRbacManagerImpls() != null && value.getRbacManagerImpls().size() > 0
- ) {
- registry.removeSubset(prefix + "rbacManagerImpls");
-
- int count = 0;
- for (Iterator iter = value.getRbacManagerImpls().iterator(); iter.hasNext(); count++) {
- String name = "rbacManagerImpls.rbacManagerImpl(" + count + ")";
- String rbacManagerImpl = (String) iter.next();
- registry.setString(prefix + name, rbacManagerImpl);
- }
- }
- if (value.getLdapConfiguration() != null
- ) {
- writeLdapConfiguration(prefix + "ldapConfiguration.", value.getLdapConfiguration(), registry);
- }
- if (value.getLdapGroupMappings() != null && value.getLdapGroupMappings().size() > 0
- ) {
- registry.removeSubset(prefix + "ldapGroupMappings");
-
- int count = 0;
- for (Iterator iter = value.getLdapGroupMappings().iterator(); iter.hasNext(); count++) {
- String name = "ldapGroupMappings.ldapGroupMapping(" + count + ")";
- LdapGroupMapping o = (LdapGroupMapping) iter.next();
- writeLdapGroupMapping(prefix + name + ".", o, registry);
- }
- }
- if (value.getConfigurationProperties() != null && value.getConfigurationProperties().size() > 0
- ) {
- registry.removeSubset(prefix + "configurationProperties");
-
- for (Iterator iter = value.getConfigurationProperties().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getConfigurationProperties().get(key);
-
- registry.setString(prefix + "configurationProperties." + key, v);
- }
- }
- String useUsersCache = "useUsersCache";
- registry.setBoolean(prefix + useUsersCache, value.isUseUsersCache());
- if (value.getUsersCacheConfiguration() != null
- ) {
- writeCacheConfiguration(prefix + "usersCacheConfiguration.", value.getUsersCacheConfiguration(), registry);
- }
- }
- }
-
- private void writeArchivaDefaultConfiguration(String prefix, ArchivaDefaultConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getDefaultCheckPaths() != null && value.getDefaultCheckPaths().size() > 0
- ) {
- registry.removeSubset(prefix + "defaultCheckPaths");
-
- int count = 0;
- for (Iterator iter = value.getDefaultCheckPaths().iterator(); iter.hasNext(); count++) {
- String name = "defaultCheckPaths.defaultCheckPath(" + count + ")";
- RepositoryCheckPath o = (RepositoryCheckPath) iter.next();
- writeRepositoryCheckPath(prefix + name + ".", o, registry);
- }
- }
- }
- }
-
- private void writeLdapConfiguration(String prefix, LdapConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getHostName() != null
- ) {
- String hostName = "hostName";
- registry.setString(prefix + hostName, value.getHostName());
- }
- if (value.getPort() != 0
- ) {
- String port = "port";
- registry.setInt(prefix + port, value.getPort());
- }
- String ssl = "ssl";
- registry.setBoolean(prefix + ssl, value.isSsl());
- if (value.getBaseDn() != null
- ) {
- String baseDn = "baseDn";
- registry.setString(prefix + baseDn, value.getBaseDn());
- }
- if (value.getBaseGroupsDn() != null
- ) {
- String baseGroupsDn = "baseGroupsDn";
- registry.setString(prefix + baseGroupsDn, value.getBaseGroupsDn());
- }
- if (value.getContextFactory() != null
- ) {
- String contextFactory = "contextFactory";
- registry.setString(prefix + contextFactory, value.getContextFactory());
- }
- if (value.getBindDn() != null
- ) {
- String bindDn = "bindDn";
- registry.setString(prefix + bindDn, value.getBindDn());
- }
- if (value.getPassword() != null
- ) {
- String password = "password";
- registry.setString(prefix + password, value.getPassword());
- }
- if (value.getAuthenticationMethod() != null
- ) {
- String authenticationMethod = "authenticationMethod";
- registry.setString(prefix + authenticationMethod, value.getAuthenticationMethod());
- }
- String bindAuthenticatorEnabled = "bindAuthenticatorEnabled";
- registry.setBoolean(prefix + bindAuthenticatorEnabled, value.isBindAuthenticatorEnabled());
- String writable = "writable";
- registry.setBoolean(prefix + writable, value.isWritable());
- String useRoleNameAsGroup = "useRoleNameAsGroup";
- registry.setBoolean(prefix + useRoleNameAsGroup, value.isUseRoleNameAsGroup());
- if (value.getExtraProperties() != null && value.getExtraProperties().size() > 0
- ) {
- registry.removeSubset(prefix + "extraProperties");
-
- for (Iterator iter = value.getExtraProperties().keySet().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String v = (String) value.getExtraProperties().get(key);
-
- registry.setString(prefix + "extraProperties." + key, v);
- }
- }
- }
- }
-
- private void writeFileLockConfiguration(String prefix, FileLockConfiguration value, Registry registry) {
- if (value != null) {
- String skipLocking = "skipLocking";
- registry.setBoolean(prefix + skipLocking, value.isSkipLocking());
- if (value.getLockingTimeout() != 0
- ) {
- String lockingTimeout = "lockingTimeout";
- registry.setInt(prefix + lockingTimeout, value.getLockingTimeout());
- }
- }
- }
-
- private void writeCacheConfiguration(String prefix, CacheConfiguration value, Registry registry) {
- if (value != null) {
- if (value.getTimeToIdleSeconds() != -1
- ) {
- String timeToIdleSeconds = "timeToIdleSeconds";
- registry.setInt(prefix + timeToIdleSeconds, value.getTimeToIdleSeconds());
- }
- if (value.getTimeToLiveSeconds() != -1
- ) {
- String timeToLiveSeconds = "timeToLiveSeconds";
- registry.setInt(prefix + timeToLiveSeconds, value.getTimeToLiveSeconds());
- }
- if (value.getMaxElementsInMemory() != -1
- ) {
- String maxElementsInMemory = "maxElementsInMemory";
- registry.setInt(prefix + maxElementsInMemory, value.getMaxElementsInMemory());
- }
- if (value.getMaxElementsOnDisk() != -1
- ) {
- String maxElementsOnDisk = "maxElementsOnDisk";
- registry.setInt(prefix + maxElementsOnDisk, value.getMaxElementsOnDisk());
- }
- }
- }
-
- private void writeLdapGroupMapping(String prefix, LdapGroupMapping value, Registry registry) {
- if (value != null) {
- if (value.getGroup() != null
- ) {
- String group = "group";
- registry.setString(prefix + group, value.getGroup());
- }
- if (value.getRoleNames() != null && value.getRoleNames().size() > 0
- ) {
- registry.removeSubset(prefix + "roleNames");
-
- int count = 0;
- for (Iterator iter = value.getRoleNames().iterator(); iter.hasNext(); count++) {
- String name = "roleNames.roleName(" + count + ")";
- String roleName = (String) iter.next();
- registry.setString(prefix + name, roleName);
- }
- }
- }
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package org.apache.archiva.configuration.util;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * Helper class that can be used for mapping configuration keys (e.g. user configuration keys) to
- * archiva configuration objects.
- *
- * @param <T> The class used to retrieve the attribute data
- * @param <K> The class used to retrieve the data that is for prefix matching
- * @author Martin Stockhammer <martin_s@apache.org>
- * @since 3.0
- */
-public class ConfigMapper<T, K>
-{
- private final Map<String, Function<T, String>> stringFunctionMap = new HashMap<>( );
- private final Map<String, Function<T, Integer>> intFunctionMap = new HashMap<>( );
- private final Map<String, Function<T, Boolean>> booleanFunctionMap = new HashMap<>( );
- private final Map<String, BiFunction<String, K, String>> prefixStringFunctionMap = new HashMap<>( );
-
- public void addStringMapping( String attributeName, Function<T, String> mapping) {
- this.stringFunctionMap.put( attributeName, mapping );
- }
-
- public void addPrefixStringMapping(String prefix, BiFunction<String, K, String> mapping) {
- prefixStringFunctionMap.put( prefix, mapping );
- }
-
- public String getString( String attributeName, T instance) {
- return stringFunctionMap.get( attributeName ).apply( instance );
- }
-
- public String getPrefixString(String attributeName, K instance) {
- BiFunction<String, K, String> function = prefixStringFunctionMap.entrySet( ).stream( ).filter( entry -> attributeName.startsWith( entry.getKey( ) ) ).findFirst( )
- .map( entry -> entry.getValue( ) )
- .get( );
- return function.apply( attributeName, instance );
- }
-
- public boolean isStringMapping(String attributeName) {
- return stringFunctionMap.containsKey( attributeName );
- }
-
- public boolean isIntMapping(String attributeName) {
- return intFunctionMap.containsKey( attributeName );
- }
-
- public boolean isBooleanMapping(String attributeName) {
- return booleanFunctionMap.containsKey( attributeName );
- }
-
- public boolean isPrefixMapping(String attributeName) {
- return prefixStringFunctionMap.keySet( ).stream( ).anyMatch( prefix -> attributeName.startsWith( prefix ) );
- }
-
- public boolean isMapping(String attributeName) {
- return isStringMapping( attributeName ) || isIntMapping( attributeName ) || isBooleanMapping( attributeName );
- }
-
- public void addIntMapping( String attributeName, Function<T, Integer> mapping) {
- this.intFunctionMap.put( attributeName, mapping );
- }
-
- public int getInt( String attributeName, T instance) {
- return this.intFunctionMap.get( attributeName ).apply( instance );
- }
-
- public void addBooleanMapping( String attributeName, Function<T, Boolean> mapping) {
- this.booleanFunctionMap.put( attributeName, mapping );
- }
-
- public boolean getBoolean( String attributeName, T instance) {
- return this.booleanFunctionMap.get( attributeName ).apply( instance );
- }
-
- public List<String> getStringAttributes() {
- return new ArrayList<>( stringFunctionMap.keySet( ) );
- }
-
- public List<String> getIntAttributes() {
- return new ArrayList<>( intFunctionMap.keySet( ) );
- }
-
- public List<String> getBooleanAttributes() {
- return new ArrayList<>( booleanFunctionMap.keySet( ) );
- }
-
- public List<String> getAllAttributes() {
- return Arrays.asList( stringFunctionMap,intFunctionMap, booleanFunctionMap).stream()
- .flatMap( map->map.keySet().stream() ).collect( Collectors.toList());
- }
-
-}
connectors.add( proxyConfig );
java.util.Collections.sort( connectors,
- org.apache.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator.getInstance() );
+ org.apache.archiva.configuration.provider.functors.ProxyConnectorConfigurationOrderComparator.getInstance() );
}
}
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
-
- <context:annotation-config/>
- <context:component-scan base-package="org.apache.archiva.configuration"/>
- <!-- olamy could be removed as only here temporary for plexus-spring -->
- <alias name="archivaConfiguration#default" alias="archivaConfiguration"/>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
- <version>3.0.0</version>
- <managedRepositories>
- <managedRepository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <location>${appserver.base}/repositories/internal</location>
- <indexDir>${appserver.base}/repositories/internal/.indexer</indexDir>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <blockRedeployments>true</blockRedeployments>
- <scanned>true</scanned>
- <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
- <retentionPeriod>30</retentionPeriod>
- </managedRepository>
- <managedRepository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <location>${appserver.base}/repositories/snapshots</location>
- <indexDir>${appserver.base}/repositories/snapshots/.indexer</indexDir>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <blockRedeployments>false</blockRedeployments>
- <scanned>true</scanned>
- <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
- <retentionPeriod>30</retentionPeriod>
- </managedRepository>
- </managedRepositories>
- <remoteRepositories>
- <remoteRepository>
- <id>central</id>
- <name>Central Repository</name>
- <url>https://repo.maven.apache.org/maven2</url>
- <layout>default</layout>
- </remoteRepository>
- </remoteRepositories>
-
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <policies>
- <snapshots>disabled</snapshots>
- <releases>once</releases>
- <checksum>fix</checksum>
- <cache-failures>cached</cache-failures>
- </policies>
- <whiteListPatterns>
- <whiteListPattern>**/*</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <legacyArtifactPaths>
- <legacyArtifactPath>
- <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
- <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
- </legacyArtifactPath>
- </legacyArtifactPaths>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- <pattern>.index/**</pattern>
- <pattern>.indexer/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- <knownContentConsumer>metadata-updater</knownContentConsumer>
- <knownContentConsumer>create-archiva-metadata</knownContentConsumer>
- <knownContentConsumer>duplicate-artifacts</knownContentConsumer>
- <!--knownContentConsumer>repository-purge</knownContentConsumer-->
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>true</showFindArtifacts>
- <appletFindEnabled>true</appletFindEnabled>
- </ui>
- </webapp>
-
- <archivaRuntimeConfiguration>
- <checksumTypes>
- <type>MD5</type>
- <type>SHA1</type>
- <type>SHA256</type>
- </checksumTypes>
- </archivaRuntimeConfiguration>
-
- <redbackRuntimeConfiguration>
- <userManagerImpls>
- <userManagerImpl>jpa</userManagerImpl>
- </userManagerImpls>
- <rbacManagerImpls>
- <rbacManagerImpl>cached</rbacManagerImpl>
- </rbacManagerImpls>
- </redbackRuntimeConfiguration>
-
- <archivaDefaultConfiguration>
- <defaultCheckPaths>
- <defaultCheckPath>
- <url>http://download.oracle.com/maven</url>
- <path>com/sleepycat/je/license.txt</path>
- </defaultCheckPath>
- <defaultCheckPath>
- <url>https://download.oracle.com/maven</url>
- <path>com/sleepycat/je/license.txt</path>
- </defaultCheckPath>
- </defaultCheckPaths>
- </archivaDefaultConfiguration>
-
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<configuration>
- <repositories>
- <repository>
- <directory>managed-repository</directory>
- <id>local</id>
- <name>local</name>
- </repository>
- </repositories>
- <proxiedRepositories>
- <proxiedRepository>
- <url>http://www.ibiblio.org/maven2/</url>
- <managedRepository>local</managedRepository>
- <useNetworkProxy>true</useNetworkProxy>
- <id>ibiblio</id>
- <name>Ibiblio</name>
- </proxiedRepository>
- <proxiedRepository>
- <url>http://repository.codehaus.org/</url>
- <managedRepository>local</managedRepository>
- <id>codehaus</id>
- <name>Codehaus</name>
- </proxiedRepository>
- </proxiedRepositories>
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<configuration>
-<version>2</version>
-<repositoryScanning>
-<fileTypes>
-<fileType>
-<id>artifacts</id>
-<patterns>
-<pattern>**/*.pom</pattern>
-<pattern>**/*.jar</pattern>
-<pattern>**/*.ear</pattern>
-<pattern>**/*.war</pattern>
-<pattern>**/*.car</pattern>
-<pattern>**/*.sar</pattern>
-<pattern>**/*.mar</pattern>
-<pattern>**/*.rar</pattern>
-<pattern>**/*.dtd</pattern>
-<pattern>**/*.tld</pattern>
-<pattern>**/*.tar.gz</pattern>
-<pattern>**/*.tar.bz2</pattern>
-<pattern>**/*.zip</pattern>
-</patterns>
-</fileType>
-<fileType>
-<id>indexable-content</id>
-<patterns>
-<pattern>**/*.txt</pattern>
-<pattern>**/*.TXT</pattern>
-<pattern>**/*.block</pattern>
-<pattern>**/*.config</pattern>
-<pattern>**/*.pom</pattern>
-<pattern>**/*.xml</pattern>
-<pattern>**/*.xsd</pattern>
-<pattern>**/*.dtd</pattern>
-<pattern>**/*.tld</pattern>
-</patterns>
-</fileType>
-<fileType>
-<id>auto-remove</id>
-<patterns>
-<pattern>**/*.bak</pattern>
-<pattern>**/*~</pattern>
-<pattern>**/*-</pattern>
-</patterns>
-</fileType>
-<fileType>
-<id>ignored</id>
-<patterns>
-<pattern>**/.htaccess</pattern>
-<pattern>**/KEYS</pattern>
-<pattern>**/*.rb</pattern>
-<pattern>**/*.sh</pattern>
-<pattern>**/.svn/**</pattern>
-<pattern>**/.DAV/**</pattern>
-</patterns>
-</fileType>
-</fileTypes>
-<knownContentConsumers>
-<knownContentConsumer>update-db-artifact</knownContentConsumer>
-<knownContentConsumer>create-missing-checksums</knownContentConsumer>
-<knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
-<knownContentConsumer>validate-checksum</knownContentConsumer>
-<knownContentConsumer>validate-signature</knownContentConsumer>
-<knownContentConsumer>index-content</knownContentConsumer>
-<knownContentConsumer>auto-remove</knownContentConsumer>
-<knownContentConsumer>auto-rename</knownContentConsumer>
-<knownContentConsumer>metadata-updater</knownContentConsumer>
-</knownContentConsumers>
-<invalidContentConsumers>
-<invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
-</invalidContentConsumers>
-</repositoryScanning>
-<databaseScanning>
-<cronExpression>0 0 * * * ?</cronExpression>
-<unprocessedConsumers>
-<unprocessedConsumer>update-db-project</unprocessedConsumer>
-</unprocessedConsumers>
-<cleanupConsumers>
-<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
-<cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
-<cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
-</cleanupConsumers>
-</databaseScanning>
-<managedRepositories>
-<managedRepository>
-<location>${appserver.base}/data/repositories/internal</location>
-<blockRedeployments>true</blockRedeployments>
-<retentionPeriod>30</retentionPeriod>
-<id>internal</id>
-<name>Archiva Managed Internal Repository</name>
-</managedRepository>
-<managedRepository>
-<location>${appserver.base}/data/repositories/snapshots</location>
-<releases>false</releases>
-<snapshots>true</snapshots>
-<refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
-<retentionPeriod>30</retentionPeriod>
-<id>snapshots</id>
-<name>Archiva Managed Snapshot Repository</name>
-</managedRepository>
-</managedRepositories>
-<remoteRepositories>
-<remoteRepository>
-<url>http://repo1.maven.org/maven2</url>
-<id>central</id>
-<name>Central Repository</name>
-</remoteRepository>
-<remoteRepository>
-<url>http://download.java.net/maven/2/</url>
-<id>maven2-repository.dev.java.net</id>
-<name>Java.net Repository for Maven 2</name>
-</remoteRepository>
-</remoteRepositories>
-<proxyConnectors>
-<proxyConnector>
-<order>1</order>
-<sourceRepoId>internal</sourceRepoId>
-<targetRepoId>central</targetRepoId>
-<proxyId/>
-<whiteListPatterns>
-<whiteListPattern>**/*</whiteListPattern>
-</whiteListPatterns>
-<policies>
-<releases>once</releases>
-<checksum>fix</checksum>
-<snapshots>never</snapshots>
-<cache-failures>yes</cache-failures>
-</policies>
-</proxyConnector>
-<proxyConnector>
-<order>2</order>
-<sourceRepoId>internal</sourceRepoId>
-<targetRepoId>maven2-repository.dev.java.net</targetRepoId>
-<proxyId/>
-<whiteListPatterns>
-<whiteListPattern>javax/**</whiteListPattern>
-<whiteListPattern>org/jvnet/**</whiteListPattern>
-<whiteListPattern>com/sun/**</whiteListPattern>
-</whiteListPatterns>
-<policies>
-<releases>once</releases>
-<checksum>fix</checksum>
-<snapshots>never</snapshots>
-<cache-failures>yes</cache-failures>
-</policies>
-</proxyConnector>
-</proxyConnectors>
-<legacyArtifactPaths>
-<legacyArtifactPath>
-<path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
-<artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
-</legacyArtifactPath>
-</legacyArtifactPaths>
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<configuration>
- <repositories>
- <repository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <url>file://${appserver.base}/repositories/internal</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>true</indexed>
- <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
- </repository>
- <repository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <url>file://${appserver.base}/repositories/snapshots</url>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <indexed>false</indexed>
- <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
- </repository>
- <repository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>false</indexed>
- </repository>
- <repository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>https://maven2-repository.dev.java.net/nonav/repository</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>false</indexed>
- </repository>
- </repositories>
-
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- </proxyConnector>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <networkProxies>
- <networkProxy>
- <id>example</id>
- <protocol>http</protocol>
- <host>proxy.mycompany.com</host>
- <port>8080</port>
- <username>myself</username>
- <password>mypass</password>
- </networkProxy>
- </networkProxies>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- <knownContentConsumer>metadata-updater</knownContentConsumer>
- <!--knownContentConsumer>repository-purge</knownContentConsumer-->
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>true</showFindArtifacts>
- <appletFindEnabled>true</appletFindEnabled>
- </ui>
- </webapp>
-
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<configuration>
- <repositories>
- <repository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <url>file://${appserver.base}/repositories/internal</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>true</indexed>
- <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
- </repository>
- <repository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <url>file:${appserver.base}/repositories/snapshots</url>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <indexed>true</indexed>
- <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
- </repository>
- <repository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>false</indexed>
- </repository>
- <repository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>https://maven2-repository.dev.java.net/nonav/repository</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>false</indexed>
- </repository>
- </repositories>
-
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- </proxyConnector>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <networkProxies>
- <networkProxy>
- <id>example</id>
- <protocol>http</protocol>
- <host>proxy.mycompany.com</host>
- <port>8080</port>
- <username>myself</username>
- <password>mypass</password>
- </networkProxy>
- </networkProxies>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- <knownContentConsumer>metadata-updater</knownContentConsumer>
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>true</showFindArtifacts>
- <appletFindEnabled>true</appletFindEnabled>
- </ui>
- </webapp>
-
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<configuration>
- <version>2</version>
- <managedRepositories>
- <managedRepository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <location>${appserver.base}/repositories/internal</location>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
- </managedRepository>
- <managedRepository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <location>${appserver.base}/repositories/snapshots</location>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
- </managedRepository>
- </managedRepositories>
- <remoteRepositories>
- <remoteRepository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- </remoteRepository>
- <remoteRepository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>https://maven2-repository.dev.java.net/nonav/repository</url>
- <layout>default</layout>
- </remoteRepository>
- </remoteRepositories>
-
- <webapp>
- <ui>
- <showFindArtifacts>false</showFindArtifacts>
- </ui>
- </webapp>
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<configuration>
- <version>2</version>
- <repositoryGroups>
- <repositoryGroup>
- <id>default</id>
- <repositories>
- <repository>snapshots</repository>
- </repositories>
- </repositoryGroup>
- </repositoryGroups>
- <managedRepositories>
- <managedRepository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <location>${appserver.base}/repositories/snapshots</location>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
- </managedRepository>
- </managedRepositories>
- <remoteRepositories>
- <remoteRepository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- </remoteRepository>
- </remoteRepositories>
- <proxyConnectors>
- <proxyConnector>
- <order>2</order>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- </whiteListPatterns>
- <policies>
- <releases>once</releases>
- <checksum>fix</checksum>
- <snapshots>never</snapshots>
- <cache-failures>yes</cache-failures>
- </policies>
- </proxyConnector>
- </proxyConnectors>
- <networkProxies>
- <networkProxy>
- <id>proxy</id>
- <host>proxy</host>
- <port>8080</port>
- </networkProxy>
- </networkProxies>
- <legacyArtifactPaths>
- <legacyArtifactPath>
- <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
- <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
- </legacyArtifactPath>
- </legacyArtifactPaths>
- <repositoryScanning>
- <knownContentConsumers>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
- <databaseScanning>
- <unprocessedConsumers>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<configuration>
- <version>2</version>
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- </proxyConnector>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <webapp>
- <ui>
- <appletFindEnabled>false</appletFindEnabled>
- </ui>
- </webapp>
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<configuration>
- <version>2</version>
- <managedRepositories>
- <managedRepository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <location>file://${appserver.base}/repositories/internal</location>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
- </managedRepository>
- </managedRepositories>
- <databaseScanning>
- <cronExpression>0 0 0 * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>false</showFindArtifacts>
- </ui>
- </webapp>
-</configuration>
+++ /dev/null
-################ GLOBAL SETTINGS
-# This is where maven-proxy stores files it has downloaded
-repo.local.store=target
-
-#The port to listen on - not used if loaded as a webapp
-port=9999
-
-#This is the base area that all files are loaded from. While it is possible to leave this blank, this behaviour
-#is deprecated and will be disabled in version 2.0. There are too many namespace conflicts caused by not using
-#a prefix.
-#The repository will be shown at http://localhost:9999/repository/
-#for the .war loaded into a webapp server, the default prefix is "repository" (edit the web.xml to change)
-# As maven doesn't like a trailing slash, this address shouldn't have one either.
-prefix=repository
-
-#This is the simple date format used to display the last modified date while browsing the repository.
-lastModifiedDateFormat=yyyy/MM/dd HH:mm:ss
-
-################ SNAPSHOT HANDLING
-#If you want the proxy to look for newer snapshots, set to true
-snapshot.update=true
-
-################ M2 METADATA HANDLING
-#If you want the proxy to prevent looking for newer metadata, set to false (default is true)
-#metadata.update=false
-
-################ M2 POM HANDLING
-#If you want the proxy to look for newer POMs, set to true (default is false)
-pom.update=true
-
-################ PROMOTION HANDLING
-# ***** NOT CURRENTLY IMPLEMENTED *****
-#Promotion describes the process by which new artifacts are loaded to global maven-proxy repository. It
-# is designed to be used by "higher security installations" that do not want to acquire artifacts from
-# remote repositories without approval.
-#
-#If promotion handling is enabled, then the proxy will not download remote artifacts without permission
-# (local repositories with copy=false are considered to be local)
-#
-#Permission to download is granted via the Promotion menu which will be enabled
-# when promotion handling is enabled.
-#
-#If promotion is false, artifacts are sourced from any repository as per normal.
-#
-#Promotion and snapshots: If promotion is enabled, snapshots are not downloadable. The concept of using
-# a snapshot in a production build (which is primarily what promotion is for) is counterintuitive.
-##
-promotion=false
-
-################ WEB INTERFACE
-# This defines the absolute URL the server should use to identify itself.
-# This can often be determined automatically, but we recommend you specify
-# it explicitly to prevent problems during startup.
-# The prefix will be added to this for the actual repository
-# i.e. proxy available at http://localhost:9999/, repository at http://localhost:9999/repository
-serverName=http://localhost:9999
-
-#If true, the repository can be browsed
-browsable=true
-
-#If true, the repository can be searched
-searchable=true
-
-#Not currently implemented. Will allow webdav access to the repository at some point.
-webdav=true
-
-#Stylesheet - if configured, will override the default stylesheet shipped with maven-proxy - absolute URLs only
-#eg. /maven-proxy/style.css, http://www.example.com/style.css
-stylesheet=/maven-proxy/style.css
-
-#bgColor / bgColorHighlight are replaced in the built in stylesheet to produce a simple color scheme.
-#If a stylesheet is set, these are not used.
-bgColor=#14B
-bgColorHighlight=#94B
-
-#rowColor / rowColorHighlight are replaced in the built in stylesheet to produce a simple color scheme.
-#If a stylesheet is set, these are not used.
-rowColor=#CCF
-rowColorHighlight=#DDF
-
-
-################ PROXIES
-#This is just a hack, it should auto discover them
-proxy.list=one,two,three
-
-#Unauthenticated proxy
-proxy.one.host=proxy1.example.com
-proxy.one.port=3128
-
-#Authenticated proxy
-proxy.two.host=proxy2.example.org
-proxy.two.port=80
-proxy.two.username=username2
-proxy.two.password=password2
-
-#Authenticated proxy
-proxy.three.host=proxy3.example.net
-proxy.three.port=3129
-proxy.three.username=username3
-proxy.three.password=password3
-
-
-################# REPOSITORIES
-#This is not just a hack, it specifies the order repositories should be checked
-#Note that the proxy adds a "/" which is why the urls aren't suffixed with a "/"
-repo.list=local-repo,www-ibiblio-org,dist-codehaus-org,private-example-com
-
-#local-store
-# The local store represents a location that local jars you host can be located.
-# This could also be achieved by having a local http repository, but this is less cumbersome
-repo.local-repo.url=file://target
-repo.local-repo.description=Super Secret Custom Repository
-#If copy is true, jars are copied from the store to the proxy-repo. Only configurable for file:/// repos
-repo.local-repo.copy=false
-#If hardfail is true, any unexpected errors from the repository will cause
-#the client download to fail (typically with a 500 error)
-repo.local-repo.hardfail=true
-#Don't cache a file repository
-repo.local-repo.cache.period=0
-
-
-#www.ibiblio.org
-repo.www-ibiblio-org.url=http://www.ibiblio.org/maven2
-repo.www-ibiblio-org.description=www.ibiblio.org
-repo.www-ibiblio-org.proxy=one
-repo.www-ibiblio-org.hardfail=true
-#Cache this repository for 1 hour
-repo.www-ibiblio-org.cache.period=3600
-repo.www-ibiblio-org.cache.failures=true
-
-#dist.codehaus.org
-repo.dist-codehaus-org.url=http://dist.codehaus.org
-repo.dist-codehaus-org.proxy=two
-repo.dist-codehaus-org.hardfail=false
-repo.dist-codehaus-org.cache.period=3600
-repo.dist-codehaus-org.cache.failures=true
-
-#private.example.com
-repo.private-example-com.url=http://private.example.com/internal
-repo.private-example-com.description=Commercial In Confidence Repository
-repo.private-example-com.username=username1
-repo.private-example-com.password=password1
-repo.private-example-com.proxy=three
-repo.private-example-com.cache.period=3600
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<configuration>
- <version>2</version>
- <managedRepositories>
- <managedRepository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <location>${appserver.base}/repositories/internal</location>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
- </managedRepository>
- <managedRepository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <location>${appserver.base}/repositories/internal</location>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0,30 * * * ?</refreshCronExpression>
- </managedRepository>
- </managedRepositories>
- <remoteRepositories>
- <remoteRepository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- </remoteRepository>
- <remoteRepository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>https://maven2-repository.dev.java.net/nonav/repository</url>
- <layout>default</layout>
- <username></username>
- <password></password>
- </remoteRepository>
- </remoteRepositories>
-
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <policies>
- <releases>ignored</releases>
- <snapshots>disabled</snapshots>
- <cache-failures>cached</cache-failures>
- </policies>
- </proxyConnector>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <policies>
- <releases>ignored</releases>
- <snapshots>disabled</snapshots>
- <cache-failures>cached</cache-failures>
- </policies>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <networkProxies>
- <networkProxy>
- <id>example</id>
- <protocol>http</protocol>
- <host>proxy.mycompany.com</host>
- <port>8080</port>
- <username>myself</username>
- <password>mypass</password>
- </networkProxy>
- </networkProxies>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- <knownContentConsumer>metadata-updater</knownContentConsumer>
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>true</showFindArtifacts>
- <appletFindEnabled>true</appletFindEnabled>
- </ui>
- </webapp>
-
-</configuration>
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-/**
- * Test the configuration store.
- */
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
-public class ArchivaConfigurationMRM789Test
-{
-
- private static String FILE_ENCODING = "UTF-8";
-
- @Inject
- protected ApplicationContext applicationContext;
-
- @Inject
- FileTypes filetypes;
-
- public static Path getTestFile( String path )
- {
- return Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), path );
- }
-
- @SuppressWarnings( "unchecked" )
- protected <T> T lookup( Class<T> clazz, String hint )
- {
- return (T) applicationContext.getBean( "archivaConfiguration#" + hint, ArchivaConfiguration.class );
- }
-
- // test for [MRM-789]
- @Test
- public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting()
- throws Exception
- {
- Path repo = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-classes/existing_snapshots" );
- Files.createDirectories(repo);
-
- repo = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-classes/existing_internal" );
- Files.createDirectories(repo);
-
- String existingTestDefaultArchivaConfigFile = FileUtils.readFileToString(
- getTestFile( "target/test-classes/org/apache/archiva/configuration/test-default-archiva.xml" ).toFile(), FILE_ENCODING );
- existingTestDefaultArchivaConfigFile =
- StringUtils.replace( existingTestDefaultArchivaConfigFile, "${appserver.base}", org.apache.archiva.common.utils.FileUtils.getBasedir() );
-
- Path generatedTestDefaultArchivaConfigFile = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(),
- "target/test-classes/org/apache/archiva/configuration/default-archiva.xml" );
-
- FileUtils.writeStringToFile( generatedTestDefaultArchivaConfigFile.toFile(), existingTestDefaultArchivaConfigFile,
- Charset.forName(FILE_ENCODING) );
-
- ArchivaConfiguration archivaConfiguration =
- lookup( ArchivaConfiguration.class, "test-defaults-default-repo-location-exists" );
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertConfiguration( configuration, 2, 2, 2 );
-
- ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
- assertTrue( "check managed repositories", repository.getLocation().endsWith( "data/repositories/internal" ) );
-
- Files.deleteIfExists(generatedTestDefaultArchivaConfigFile);
- assertFalse( Files.exists(generatedTestDefaultArchivaConfigFile) );
- }
-
-
- /**
- * Ensures that the provided configuration matches the details present in the archiva-default.xml file.
- */
- private void assertConfiguration( Configuration configuration, int managedExpected, int remoteExpected,
- int proxyConnectorExpected )
- throws Exception
- {
-
- assertEquals( "check managed repositories: " + configuration.getManagedRepositories(), managedExpected,
- configuration.getManagedRepositories().size() );
- assertEquals( "check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected,
- configuration.getRemoteRepositories().size() );
- assertEquals( "check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected,
- configuration.getProxyConnectors().size() );
-
- RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
- assertNotNull( "check repository scanning", repoScanning );
- assertEquals( "check file types", 4, repoScanning.getFileTypes().size() );
- assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers().size() );
- assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() );
-
- List<String> patterns = filetypes.getFileTypePatterns( "artifacts" );
- assertNotNull( "check 'artifacts' file type", patterns );
- assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
-
- WebappConfiguration webapp = configuration.getWebapp();
- assertNotNull( "check webapp", webapp );
-
- UserInterfaceOptions ui = webapp.getUi();
- assertNotNull( "check webapp ui", ui );
- assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts() );
- assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled() );
- }
-
-
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-
-/**
- * Test the configuration store.
- */
-@RunWith(ArchivaSpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
-@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-public class ArchivaConfigurationTest
-{
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- @Inject
- protected ApplicationContext applicationContext;
-
- @Inject
- FileTypes filetypes;
-
- public static Path getTestFile( String path )
- {
- return Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), path );
- }
-
- @SuppressWarnings( "unchecked" )
- protected <T> T lookup( Class<T> clazz, String hint )
- {
- return (T) applicationContext.getBean( "archivaConfiguration#" + hint, ArchivaConfiguration.class );
- }
-
- @Test
- public void testGetConfigurationFromDefaults()
- throws Exception
- {
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-defaults" );
- Configuration configuration = archivaConfiguration.getConfiguration();
-
- assertConfiguration( configuration, 2, 1, 1 );
- assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
-
- ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
-
- assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
- repository.getLocation() );
- assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
- assertEquals( "check managed repositories", "internal", repository.getId() );
- assertEquals( "check managed repositories", "default", repository.getLayout() );
- assertTrue( "check managed repositories", repository.isScanned() );
- }
-
- @Test
- public void testGetConfigurationFromRegistryWithASingleNamedConfigurationResource()
- throws Exception
- {
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertConfiguration( configuration, 2, 2, 2 );
- assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() );
-
- ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
-
- assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
- repository.getLocation() );
- assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
- assertEquals( "check managed repositories", "internal", repository.getId() );
- assertEquals( "check managed repositories", "default", repository.getLayout() );
- assertTrue( "check managed repositories", repository.isScanned() );
- }
-
- /**
- * Ensures that the provided configuration matches the details present in the archiva-default.xml file.
- */
- private void assertConfiguration( Configuration configuration, int managedExpected, int remoteExpected,
- int proxyConnectorExpected )
- throws Exception
- {
-
- assertEquals( "check managed repositories: " + configuration.getManagedRepositories(), managedExpected,
- configuration.getManagedRepositories().size() );
- assertEquals( "check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected,
- configuration.getRemoteRepositories().size() );
- assertEquals( "check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected,
- configuration.getProxyConnectors().size() );
-
- RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
- assertNotNull( "check repository scanning", repoScanning );
- assertEquals( "check file types", 4, repoScanning.getFileTypes().size() );
- assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers().size() );
- assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() );
-
- List<String> patterns = filetypes.getFileTypePatterns( "artifacts" );
- assertNotNull( "check 'artifacts' file type", patterns );
- assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
-
- WebappConfiguration webapp = configuration.getWebapp();
- assertNotNull( "check webapp", webapp );
-
- UserInterfaceOptions ui = webapp.getUi();
- assertNotNull( "check webapp ui", ui );
- assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts() );
- assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled() );
- }
-
- @Test
- public void testGetConfigurationFromRegistryWithTwoConfigurationResources()
- throws Exception
- {
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration-both" );
-
- Configuration configuration = archivaConfiguration.getConfiguration();
-
- // from base
- assertEquals( "check repositories", 2, configuration.getManagedRepositories().size() );
- assertEquals( "check repositories", 2, configuration.getRemoteRepositories().size() );
- // from user
- assertEquals( "check proxy connectors", 2, configuration.getProxyConnectors().size() );
-
- WebappConfiguration webapp = configuration.getWebapp();
- assertNotNull( "check webapp", webapp );
-
- UserInterfaceOptions ui = webapp.getUi();
- assertNotNull( "check webapp ui", ui );
- // from base
- assertFalse( "check showFindArtifacts", ui.isShowFindArtifacts() );
- // from user
- assertFalse( "check appletFindEnabled", ui.isAppletFindEnabled() );
- }
-
- @Test
- public void testGetConfigurationSystemOverride()
- throws Exception
- {
-
- System.setProperty( "org.apache.archiva.webapp.ui.appletFindEnabled", "false" );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
-
- archivaConfiguration.reload();
-
- try
- {
- Configuration configuration = archivaConfiguration.getConfiguration();
-
- assertFalse( "check boolean", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
- finally
- {
- System.getProperties().remove( "org.apache.archiva.webapp.ui.appletFindEnabled" );
- archivaConfiguration.reload();
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertTrue( "check boolean", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
- }
-
- @Test
- public void testStoreConfiguration()
- throws Exception
- {
- Path file = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(file);
- assertFalse( Files.exists(file) );
-
- // TODO: remove with commons-configuration 1.4
- //file.getParentFile().mkdirs();
- //FileUtils.writeStringToFile( file, "<configuration/>", null );
-
- DefaultArchivaConfiguration archivaConfiguration =
- (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = new Configuration();
- configuration.setVersion( "1" );
- configuration.setWebapp( new WebappConfiguration() );
- configuration.getWebapp().setUi( new UserInterfaceOptions() );
- configuration.getWebapp().getUi().setAppletFindEnabled( false );
-
- // add a change listener
- ConfigurationListener listener = mock( ConfigurationListener.class );
- archivaConfiguration.addListener( listener );
-
- listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
-
- archivaConfiguration.save( configuration );
-
- assertTrue( "Check file exists", Files.exists(file) );
-
- // check it
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
-
- // read it back
- archivaConfiguration = (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-read-saved" );
-
- archivaConfiguration.reload();
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
-
- private static ConfigurationListener createConfigurationListenerMockControl()
- {
- return mock( ConfigurationListener.class );// MockControl.createControl( ConfigurationListener.class );
- }
-
- @Test
- public void testStoreConfigurationUser()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists( baseFile );
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists( userFile );
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories(userFile.getParent());
- FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
-
- Configuration configuration = new Configuration();
- configuration.setWebapp( new WebappConfiguration() );
- configuration.getWebapp().setUi( new UserInterfaceOptions() );
- configuration.getWebapp().getUi().setAppletFindEnabled( false );
-
- archivaConfiguration.save( configuration );
-
- assertTrue( "Check file exists", Files.exists(userFile) );
- assertFalse( "Check file not created", Files.exists(baseFile) );
-
- // check it
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
-
- @Test
- public void testStoreConfigurationLoadedFromDefaults()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.delete(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user-defaults" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = new Configuration();
- configuration.setWebapp( new WebappConfiguration() );
- configuration.getWebapp().setUi( new UserInterfaceOptions() );
- configuration.getWebapp().getUi().setAppletFindEnabled( false );
-
- // add a change listener
- ConfigurationListener listener = createConfigurationListenerMockControl();
- archivaConfiguration.addListener( listener );
-
- listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
-
- archivaConfiguration.save( configuration );
-
- assertTrue( "Check file exists", Files.exists(userFile) );
- assertFalse( "Check file not created", Files.exists(baseFile) );
-
- // check it
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
-
- @Test
- public void testDefaultUserConfigFilename()
- throws Exception
- {
- DefaultArchivaConfiguration archivaConfiguration =
- (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "default" );
- String expectedFile = System.getProperty( "user.home" ) + "/.m2/archiva.xml";
- String systemFile = System.getProperty(ArchivaConfiguration.USER_CONFIG_PROPERTY);
- if (StringUtils.isNotEmpty( systemFile )) {
- expectedFile = systemFile;
- } else
- {
- String envFile = System.getenv( ArchivaConfiguration.USER_CONFIG_ENVVAR );
- if ( StringUtils.isNotEmpty( envFile ) )
- expectedFile = envFile;
- }
-
- archivaConfiguration.reload();
-
- assertEquals( expectedFile,
- archivaConfiguration.getUserConfigFilename() );
- assertEquals( System.getProperty( "appserver.base", "${appserver.base}" ) + "/conf/archiva.xml",
- archivaConfiguration.getAltConfigFilename() );
- }
-
- @Test
- public void testStoreConfigurationFallback()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories( baseFile.getParent());
- FileUtils.writeStringToFile( baseFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- ArchivaConfiguration archivaConfiguration =
- (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user-fallback" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = new Configuration();
- configuration.setWebapp( new WebappConfiguration() );
- configuration.getWebapp().setUi( new UserInterfaceOptions() );
- configuration.getWebapp().getUi().setAppletFindEnabled( false );
-
- archivaConfiguration.save( configuration );
-
- assertTrue( "Check file exists", Files.exists(baseFile) );
- assertFalse( "Check file not created", Files.exists(userFile) );
-
- // check it
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
-
- @Test
- public void testStoreConfigurationFailsWhenReadFromBothLocationsNoLists()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories( baseFile.getParent() );
- FileUtils.writeStringToFile( baseFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- Files.createDirectories( userFile.getParent());
- FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
-
- configuration.getWebapp().getUi().setAppletFindEnabled( false );
-
- archivaConfiguration.save( configuration );
-
- assertTrue( "Check file exists", Files.exists(baseFile) );
- assertEquals( "Check base file is unchanged", "<configuration/>",
- FileUtils.readFileToString( baseFile.toFile(), Charset.forName( "UTF-8" ) ) );
- assertTrue( "Check file exists", Files.exists(userFile) );
- assertFalse( "Check base file is changed",
- "<configuration/>".equals( FileUtils.readFileToString( userFile.toFile(), Charset.forName( "UTF-8" ) ) ) );
-
- // check it
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
-
- @Test
- public void testStoreConfigurationFailsWhenReadFromBothLocationsUserHasLists()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories( userFile.getParent() );
- FileUtils.copyFile( getTestFile( "src/test/conf/conf-user.xml" ).toFile(), userFile.toFile() );
-
- Files.createDirectories(baseFile.getParent());
- FileUtils.writeStringToFile( baseFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertTrue( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() );
-
- configuration.getWebapp().getUi().setShowFindArtifacts( false );
-
- archivaConfiguration.save( configuration );
-
- assertTrue( "Check file exists", Files.exists(baseFile) );
- assertEquals( "Check base file is unchanged", "<configuration/>",
- FileUtils.readFileToString( baseFile.toFile(), Charset.forName( "UTF-8" ) ) );
- assertTrue( "Check file exists", Files.exists(userFile) );
- assertFalse( "Check base file is changed",
- "<configuration/>".equals( FileUtils.readFileToString( userFile.toFile(), Charset.forName( "UTF-8" ) ) ) );
-
- // check it
- configuration = archivaConfiguration.getConfiguration();
- assertFalse( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() );
- }
-
- @Test
- public void testStoreConfigurationFailsWhenReadFromBothLocationsAppserverHasLists()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories(baseFile.getParent());
- FileUtils.copyFile( getTestFile( "src/test/conf/conf-base.xml" ).toFile(), baseFile.toFile() );
-
- Files.createDirectories(userFile.getParent());
- FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
-
- configuration.getWebapp().getUi().setAppletFindEnabled( false );
-
- try
- {
- archivaConfiguration.save( configuration );
- fail( "Configuration saving should not succeed if it was loaded from two locations" );
- }
- catch ( IndeterminateConfigurationException e )
- {
- // check it was reverted
- configuration = archivaConfiguration.getConfiguration();
- assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
- }
- }
-
- @Test
- public void testLoadConfigurationFromInvalidBothLocationsOnDisk()
- throws Exception
- {
- String propFile = System.getProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY );
- System.setProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY, "/../../..//*intentionally:invalid*/.m2/archiva-user.xml" );
- ArchivaConfiguration archivaConfiguration =
- lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-both" );
- Configuration config = archivaConfiguration.getConfiguration();
-
- try
- {
- archivaConfiguration.save( config );
- fail( "Should have thrown a RegistryException because the configuration can't be saved." );
- }
- catch ( RegistryException e )
- {
- /* expected exception */
- }
- if (propFile!=null)
- {
- System.setProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY, propFile );
- }
- }
-
- @Test
- public void testLoadConfigurationFromInvalidUserLocationOnDisk()
- throws Exception
- {
- Path testConfDir = getTestFile( "target/test-appserver-base/conf/" );
- Files.createDirectories( testConfDir );
-
- ArchivaConfiguration archivaConfiguration =
- lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-user" );
- Configuration config = archivaConfiguration.getConfiguration();
- archivaConfiguration.save( config );
- // No Exception == test passes.
- // Expected Path is: Should not have thrown an exception.
- }
-
-
- @Test
- public void testConfigurationUpgradeFrom13()
- throws Exception
- {
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-upgrade-1.3" );
-
- // we just use the defaults when upgrading from 1.3 at this point.
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertConfiguration( configuration, 2, 2, 2 );
- assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
-
- ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
-
- assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal",
- repository.getLocation() );
- assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
- assertEquals( "check managed repositories", "internal", repository.getId() );
- assertEquals( "check managed repositories", "default", repository.getLayout() );
- assertTrue( "check managed repositories", repository.isScanned() );
-
- log.info( "knowContentConsumers {}", configuration.getRepositoryScanning().getKnownContentConsumers() );
-
- assertFalse(
- configuration.getRepositoryScanning().getKnownContentConsumers().contains( "update-db-artifact" ) );
- assertFalse( configuration.getRepositoryScanning().getKnownContentConsumers().contains(
- "update-db-repository-metadata" ) );
-
- assertTrue(
- configuration.getRepositoryScanning().getKnownContentConsumers().contains( "create-archiva-metadata" ) );
-
- assertTrue(
- configuration.getRepositoryScanning().getKnownContentConsumers().contains( "duplicate-artifacts" ) );
- }
-
-
- @Test
- public void testCronExpressionsWithComma()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories(baseFile.getParent());
- FileUtils.copyFile( getTestFile( "src/test/conf/escape-cron-expressions.xml" ).toFile(), baseFile.toFile() );
-
- Files.createDirectories(userFile.getParent());
- FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.defaultCharset() );
-
- final ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-cron-expressions" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = archivaConfiguration.getConfiguration();
-
- ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
-
- assertEquals( "check cron expression", "0 0,30 * * * ?", repository.getRefreshCronExpression().trim() );
-
- // add a test listener to confirm it doesn't see the escaped format. We don't need to test the number of calls,
- // etc. as it's done in other tests
- archivaConfiguration.addListener( new ConfigurationListener()
- {
- @Override
- public void configurationEvent( ConfigurationEvent event )
- {
- assertEquals( ConfigurationEvent.SAVED, event.getType() );
-
- }
- } );
-
- archivaConfiguration.save( configuration );
-
- configuration = archivaConfiguration.getConfiguration();
-
- // test for the escape character '\' showing up on repositories.jsp
- repository.setRefreshCronExpression( "0 0,20 0 * * ?" );
-
- archivaConfiguration.save( configuration );
-
- repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( "snapshots" );
-
- assertEquals( "check cron expression", "0 0,20 0 * * ?", repository.getRefreshCronExpression() );
- }
-
- @Test
- public void testRemoveLastElements()
- throws Exception
- {
- Path baseFile = getTestFile( "target/test/test-file.xml" );
- Files.deleteIfExists(baseFile);
- assertFalse( Files.exists(baseFile) );
-
- Path userFile = getTestFile( "target/test/test-file-user.xml" );
- Files.deleteIfExists(userFile);
- assertFalse( Files.exists(userFile) );
-
- Files.createDirectories( baseFile.getParent() );
- FileUtils.copyFile( getTestFile( "src/test/conf/conf-single-list-elements.xml" ).toFile(), baseFile.toFile() );
-
- Files.createDirectories( userFile.getParent());
- FileUtils.writeStringToFile( userFile.toFile(), "<configuration/>", Charset.forName( "UTF-8" ) );
-
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-remove-central" );
-
- archivaConfiguration.reload();
-
- Configuration configuration = archivaConfiguration.getConfiguration();
-
- RepositoryGroupConfiguration repositoryGroup = configuration.getRepositoryGroups().get( 0 );
- assertNotNull( repositoryGroup );
- configuration.removeRepositoryGroup( repositoryGroup );
- assertTrue( configuration.getRepositoryGroups().isEmpty() );
-
- RemoteRepositoryConfiguration repository = configuration.getRemoteRepositoriesAsMap().get( "central" );
- assertNotNull( repository );
- configuration.removeRemoteRepository( repository );
- assertTrue( configuration.getRemoteRepositories().isEmpty() );
-
- ManagedRepositoryConfiguration managedRepository =
- configuration.getManagedRepositoriesAsMap().get( "snapshots" );
- assertNotNull( managedRepository );
- configuration.removeManagedRepository( managedRepository );
- assertTrue( configuration.getManagedRepositories().isEmpty() );
-
- ProxyConnectorConfiguration proxyConnector = configuration.getProxyConnectors().get( 0 );
- assertNotNull( proxyConnector );
- configuration.removeProxyConnector( proxyConnector );
- assertTrue( configuration.getProxyConnectors().isEmpty() );
-
- NetworkProxyConfiguration networkProxy = configuration.getNetworkProxiesAsMap().get( "proxy" );
- assertNotNull( networkProxy );
- configuration.removeNetworkProxy( networkProxy );
- assertTrue( configuration.getNetworkProxies().isEmpty() );
-
- LegacyArtifactPath path = configuration.getLegacyArtifactPaths().get( 0 );
- assertNotNull( path );
- configuration.removeLegacyArtifactPath( path );
- assertTrue( configuration.getLegacyArtifactPaths().isEmpty() );
-
- RepositoryScanningConfiguration scanning = configuration.getRepositoryScanning();
- String consumer = scanning.getKnownContentConsumers().get( 0 );
- assertNotNull( consumer );
- scanning.removeKnownContentConsumer( consumer );
- // default values
- assertFalse( scanning.getKnownContentConsumers().isEmpty() );
- consumer = scanning.getInvalidContentConsumers().get( 0 );
- assertNotNull( consumer );
- scanning.removeInvalidContentConsumer( consumer );
- assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
-
- archivaConfiguration.save( configuration );
-
- archivaConfiguration = lookup( ArchivaConfiguration.class, "test-read-saved" );
- configuration = archivaConfiguration.getConfiguration();
- assertNull( configuration.getRemoteRepositoriesAsMap().get( "central" ) );
- assertTrue( configuration.getRepositoryGroups().isEmpty() );
- assertNull( configuration.getManagedRepositoriesAsMap().get( "snapshots" ) );
- assertTrue( configuration.getProxyConnectors().isEmpty() );
- assertNull( configuration.getNetworkProxiesAsMap().get( "proxy" ) );
- assertTrue( configuration.getLegacyArtifactPaths().isEmpty() );
- scanning = configuration.getRepositoryScanning();
- assertFalse( scanning.getKnownContentConsumers().isEmpty() );
- assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
- }
-
- /**
- * [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
- */
- @Test
- public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword()
- throws Exception
- {
- ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
-
- Configuration configuration = archivaConfiguration.getConfiguration();
- assertConfiguration( configuration, 2, 2, 2 );
- assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories().size() );
-
- RemoteRepositoryConfiguration repository =
- configuration.getRemoteRepositoriesAsMap().get( "maven2-repository.dev.java.net" );
-
- assertEquals( "remote repository.url", "https://maven2-repository.dev.java.net/nonav/repository",
- repository.getUrl() );
- assertEquals( "remote repository.name", "Java.net Repository for Maven 2", repository.getName() );
- assertEquals( "remote repository.id", "maven2-repository.dev.java.net", repository.getId() );
- assertEquals( "remote repository.layout", "default", repository.getLayout() );
- assertNull( "remote repository.username == null", repository.getUsername() );
- assertNull( "remote repository.password == null", repository.getPassword() );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Test the generated Configuration class from Modello. This is primarily to test the hand coded methods.
- */
-@RunWith( ArchivaBlockJUnit4ClassRunner.class )
-public class ConfigurationTest
-{
- private Configuration configuration = new Configuration();
-
- @Test
- public void testNetworkProxyRetrieval()
- {
- NetworkProxyConfiguration proxy1 = createNetworkProxy( "id1", "host1", 8080 );
- configuration.addNetworkProxy( proxy1 );
- NetworkProxyConfiguration proxy2 = createNetworkProxy( "id2", "host2", 9090 );
- configuration.addNetworkProxy( proxy2 );
-
- Map<String, NetworkProxyConfiguration> map = configuration.getNetworkProxiesAsMap();
- assertNotNull( map );
- assertEquals( 2, map.size() );
- assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() );
- assertEquals( new HashSet<NetworkProxyConfiguration>( Arrays.asList( proxy1, proxy2 ) ),
- new HashSet<NetworkProxyConfiguration>( map.values() ) );
- }
-
- private NetworkProxyConfiguration createNetworkProxy( String id, String host, int port )
- {
- NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
- proxy.setId( id );
- proxy.setHost( host );
- proxy.setPort( port );
- proxy.setProtocol( "http" );
- return proxy;
- }
-
- @Test
- public void testRemoteRepositoryRetrieval()
- {
- RemoteRepositoryConfiguration repo1 = createRemoteRepository( "id1", "name 1", "url 1" );
- configuration.addRemoteRepository( repo1 );
- RemoteRepositoryConfiguration repo2 = createRemoteRepository( "id2", "name 2", "url 2" );
- configuration.addRemoteRepository( repo2 );
-
- Map<String, RemoteRepositoryConfiguration> map = configuration.getRemoteRepositoriesAsMap();
- assertNotNull( map );
- assertEquals( 2, map.size() );
- assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() );
- assertEquals( new HashSet<RemoteRepositoryConfiguration>( Arrays.asList( repo1, repo2 ) ),
- new HashSet<RemoteRepositoryConfiguration>( map.values() ) );
-
- assertEquals( repo1, configuration.findRemoteRepositoryById( "id1" ) );
- assertEquals( repo2, configuration.findRemoteRepositoryById( "id2" ) );
- assertNull( configuration.findRemoteRepositoryById( "id3" ) );
- }
-
- private RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
- {
- RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
- repo.setId( id );
- repo.setName( name );
- repo.setLayout( "default" );
- repo.setUrl( url );
- return repo;
- }
-
- @Test
- public void testManagedRepositoryRetrieval()
- {
- ManagedRepositoryConfiguration repo1 = createManagedRepository( "id1", "name 1", "path 1", false );
- configuration.addManagedRepository( repo1 );
- ManagedRepositoryConfiguration repo2 = createManagedRepository( "id2", "name 2", "path 2", true );
- configuration.addManagedRepository( repo2 );
-
- Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap();
- assertNotNull( map );
- assertEquals( 2, map.size() );
- assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() );
- assertEquals( new HashSet<ManagedRepositoryConfiguration>( Arrays.asList( repo1, repo2 ) ),
- new HashSet<ManagedRepositoryConfiguration>( map.values() ) );
-
- assertEquals( repo1, configuration.findManagedRepositoryById( "id1" ) );
- assertEquals( repo2, configuration.findManagedRepositoryById( "id2" ) );
- assertNull( configuration.findManagedRepositoryById( "id3" ) );
- }
-
- private ManagedRepositoryConfiguration createManagedRepository( String id, String name, String location,
- boolean scanned )
- {
- ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
- repo.setId( id );
- repo.setName( name );
- repo.setLocation( location );
- repo.setScanned( scanned );
- return repo;
- }
-
- @Test
- public void testNetworkProxyRetrievalWhenEmpty()
- {
- Map<String, NetworkProxyConfiguration> map = configuration.getNetworkProxiesAsMap();
- assertNotNull( map );
- assertTrue( map.isEmpty() );
- }
-
- @Test
- public void testRemoteRepositoryRetrievalWhenEmpty()
- {
- Map<String, RemoteRepositoryConfiguration> map = configuration.getRemoteRepositoriesAsMap();
- assertNotNull( map );
- assertTrue( map.isEmpty() );
-
- assertNull( configuration.findRemoteRepositoryById( "id" ) );
- }
-
- @Test
- public void testManagedRepositoryRetrievalWhenEmpty()
- {
- Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap();
- assertNotNull( map );
- assertTrue( map.isEmpty() );
-
- assertNull( configuration.findManagedRepositoryById( "id" ) );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
-public class FileTypesTest
-{
- @Inject
- private FileTypes filetypes;
-
- @Test
- public void testIsArtifact()
- {
- assertTrue( filetypes.matchesArtifactPattern( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) );
- assertTrue( filetypes.matchesArtifactPattern(
- "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) );
- assertTrue( filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) );
-
- assertFalse(
- filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.sha1" ) );
- assertFalse(
- filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.md5" ) );
- assertFalse(
- filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.asc" ) );
- assertFalse(
- filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.pgp" ) );
- assertFalse( filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/maven-metadata.xml" ) );
- assertFalse( filetypes.matchesArtifactPattern( "org/apache/derby/derby/maven-metadata.xml" ) );
- }
-
- @Test
- public void testDefaultExclusions()
- {
- assertTrue( filetypes.matchesDefaultExclusions( "repository/test/.index/nexus-maven-repository-index.gz" ) );
- assertTrue( filetypes.matchesDefaultExclusions( "repository/test/.index/nexus-maven-repository-index.zip" ) );
- assertTrue( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.sha1" ) );
- assertTrue( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.md5" ) );
- assertTrue( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/maven-metadata.xml" ) );
- assertTrue( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/maven-metadata.xml.sha1" ) );
- assertTrue( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/maven-metadata.xml.md5" ) );
-
- assertFalse( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.zip" ) );
- assertFalse( filetypes.matchesDefaultExclusions(
- "repository/test/org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.
- *
- * @since 1.1
- */
-@RunWith( ArchivaBlockJUnit4ClassRunner.class )
-public class LegacyArtifactPathTest
-{
-
- private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();
-
- @Test
- public void testLegacyArtifactPathWithClassifierResolution()
- {
- legacyArtifactPath.setArtifact( "groupId:artifactId:version:classifier:type" );
-
- assertEquals( "groupId", legacyArtifactPath.getGroupId() );
- assertEquals( "artifactId", legacyArtifactPath.getArtifactId() );
- assertEquals( "version", legacyArtifactPath.getVersion() );
- assertEquals( "classifier", legacyArtifactPath.getClassifier() );
- assertEquals( "type", legacyArtifactPath.getType() );
- }
-
- @Test
- public void testLegacyArtifactPathWithoutClassifierResolution()
- {
- legacyArtifactPath.setArtifact( "groupId:artifactId:version::type" );
-
- assertEquals( "groupId", legacyArtifactPath.getGroupId() );
- assertEquals( "artifactId", legacyArtifactPath.getArtifactId() );
- assertEquals( "version", legacyArtifactPath.getVersion() );
- assertNull( legacyArtifactPath.getClassifier() );
- assertEquals( "type", legacyArtifactPath.getType() );
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- */
-@RunWith( ArchivaBlockJUnit4ClassRunner.class )
-public class MavenProxyPropertyLoaderTest
-{
- private MavenProxyPropertyLoader loader;
-
- @Test
- public void testLoadValidMavenProxyConfiguration()
- throws IOException, InvalidConfigurationException
- {
- Path confFile = ArchivaConfigurationTest.getTestFile( "src/test/conf/maven-proxy-complete.conf" );
-
- Configuration configuration = new Configuration();
- NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
- proxy.setHost( "original-host" );
- configuration.addNetworkProxy( proxy ); // overwritten
-
- loader.load( Files.newInputStream(confFile), configuration );
-
- Map<String, ManagedRepositoryConfiguration> repositoryIdMap = configuration.getManagedRepositoriesAsMap();
- assertEquals( "Count repositories", 1, repositoryIdMap.size() );
- assertRepositoryExists( "maven-proxy", "target", repositoryIdMap.get( "maven-proxy" ) );
-
- Map<String, RemoteRepositoryConfiguration> remoteRepositoryMap = configuration.getRemoteRepositoriesAsMap();
- assertEquals( "Count repositories", 4, remoteRepositoryMap.size() );
- assertRepositoryExists( "local-repo", "file://target", remoteRepositoryMap.get( "local-repo" ) );
- assertRepositoryExists( "www-ibiblio-org", "http://www.ibiblio.org/maven2",
- remoteRepositoryMap.get( "www-ibiblio-org" ) );
- assertRepositoryExists( "dist-codehaus-org", "http://dist.codehaus.org",
- remoteRepositoryMap.get( "dist-codehaus-org" ) );
- assertRepositoryExists( "private-example-com", "http://private.example.com/internal",
- remoteRepositoryMap.get( "private-example-com" ) );
- }
-
- private void assertRepositoryExists( String id, String expectedLocation, ManagedRepositoryConfiguration repo )
- {
- assertNotNull( "Repository id [" + id + "] should not be null", repo );
- assertEquals( "Repository id", id, repo.getId() );
- assertEquals( "Repository url", expectedLocation, repo.getLocation() );
- }
-
- private void assertRepositoryExists( String id, String expectedUrl, RemoteRepositoryConfiguration repo )
- {
- assertNotNull( "Repository id [" + id + "] should not be null", repo );
- assertEquals( "Repository id", id, repo.getId() );
- assertEquals( "Repository url", expectedUrl, repo.getUrl() );
- }
-
- @Test( expected=InvalidConfigurationException.class )
- public void testInvalidConfiguration()
- throws InvalidConfigurationException
- {
- Configuration configuration = new Configuration();
- loader.load( new Properties(), configuration );
- //fail( "Incomplete config should have failed" );
- }
-
- @Before
- public void setUp()
- throws Exception
- {
- loader = new MavenProxyPropertyLoader();
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * ProxyConnectorConfigurationOrderComparatorTest
- *
- *
- */
-@SuppressWarnings( "deprecation" )
-@RunWith( ArchivaBlockJUnit4ClassRunner.class )
-public class ProxyConnectorConfigurationOrderComparatorTest
-{
- @Test
- public void testSortOfAllZeros()
- {
- List<ProxyConnectorConfiguration> proxies = new ArrayList<>();
-
- proxies.add( createConnector( "corporate", 0 ) );
- proxies.add( createConnector( "snapshots", 0 ) );
- proxies.add( createConnector( "3rdparty", 0 ) );
- proxies.add( createConnector( "sandbox", 0 ) );
-
- Collections.sort( proxies, ProxyConnectorConfigurationOrderComparator.getInstance() );
-
- assertProxyOrder( new String[]{ "corporate", "snapshots", "3rdparty", "sandbox" }, proxies );
- }
-
- @Test
- public void testSortNormal()
- {
- List<ProxyConnectorConfiguration> proxies = new ArrayList<>();
-
- proxies.add( createConnector( "corporate", 3 ) );
- proxies.add( createConnector( "snapshots", 1 ) );
- proxies.add( createConnector( "3rdparty", 2 ) );
- proxies.add( createConnector( "sandbox", 4 ) );
-
- Collections.sort( proxies, new ProxyConnectorConfigurationOrderComparator() );
-
- assertProxyOrder( new String[]{ "snapshots", "3rdparty", "corporate", "sandbox" }, proxies );
- }
-
- @Test
- public void testSortPartial()
- {
- List<ProxyConnectorConfiguration> proxies = new ArrayList<>();
-
- proxies.add( createConnector( "corporate", 3 ) );
- proxies.add( createConnector( "snapshots", 0 ) );
- proxies.add( createConnector( "3rdparty", 2 ) );
- proxies.add( createConnector( "sandbox", 0 ) );
-
- Collections.sort( proxies, new ProxyConnectorConfigurationOrderComparator() );
-
- assertProxyOrder( new String[]{ "3rdparty", "corporate", "snapshots", "sandbox" }, proxies );
- }
-
- private void assertProxyOrder( String[] ids, List<ProxyConnectorConfiguration> proxies )
- {
- assertEquals( "Proxies.size() == ids.length", ids.length, proxies.size() );
-
- int orderFailedAt = -1;
-
- for ( int i = 0; i < ids.length; i++ )
- {
- if ( !StringUtils.equals( ids[i], proxies.get( i ).getProxyId() ) )
- {
- orderFailedAt = i;
- break;
- }
- }
-
- if ( orderFailedAt >= 0 )
- {
- StringBuilder msg = new StringBuilder();
-
- msg.append( "Failed expected order of the proxies <" );
- msg.append( StringUtils.join( ids, ", " ) );
- msg.append( ">, actual <" );
-
- boolean needsComma = false;
- for ( ProxyConnectorConfiguration proxy : proxies )
- {
- if ( needsComma )
- {
- msg.append( ", " );
- }
- msg.append( proxy.getProxyId() );
- needsComma = true;
- }
- msg.append( "> failure at index <" ).append( orderFailedAt ).append( ">." );
-
- fail( msg.toString() );
- }
- }
-
- private ProxyConnectorConfiguration createConnector( String id, int order )
- {
- ProxyConnectorConfiguration proxy = new ProxyConnectorConfiguration();
- proxy.setProxyId( id );
- proxy.setOrder( order );
- proxy.setSourceRepoId( id + "_m" );
- proxy.setTargetRepoId( id + "_r" );
-
- return proxy;
- }
-}
+++ /dev/null
-package org.apache.archiva.configuration.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.Comparator;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test the repositry comparator.
- */
-@RunWith( ArchivaBlockJUnit4ClassRunner.class )
-public class RepositoryConfigurationComparatorTest
-{
- @Test
- public void testComparator()
- {
- Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator();
-
- assertEquals( 0, comparator.compare( null, null ) );
- assertEquals( 1, comparator.compare( createRepository( "id" ), null ) );
- assertEquals( -1, comparator.compare( null, createRepository( "id" ) ) );
- assertEquals( 0, comparator.compare( createRepository( "id1" ), createRepository( "id1" ) ) );
- assertEquals( -1, comparator.compare( createRepository( "id1" ), createRepository( "id2" ) ) );
- assertEquals( 1, comparator.compare( createRepository( "id2" ), createRepository( "id1" ) ) );
- }
-
- private ManagedRepositoryConfiguration createRepository( String id )
- {
- ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
- repo.setId( id );
- return repo;
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<configuration>
- <Properties>
-
- </Properties>
- <appenders>
- <Console name="console" target="SYSTEM_OUT">
- <PatternLayout pattern="%d{ISO8601_PERIOD} [%L] [%t] %-5level %logger{3} - %msg%n"/>
- </Console>
- <!--
- <RandomAccessFile name="LogFile" fileName="target/test.log">
- <PatternLayout pattern="%d{ISO8601_PERIOD} [%L] [%t] %-5level %logger{3} - %msg%n"/>
- </RandomAccessFile>
- -->
- </appenders>
- <loggers>
- <logger name="org.apache.archiva" level="info"/>
- <logger name="org.apache.archiva.repository.scanner" level="info"/>
- <root level="error" includeLocation="true">
- <appender-ref ref="console"/>
- </root>
- </loggers>
-</configuration>
+++ /dev/null
-<configuration>
- <version>3.0.0</version>
- <managedRepositories>
- <managedRepository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <location>${appserver.base}/target/test-classes/existing_internal</location>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0 * * * ?</refreshCronExpression>
- <retentionPeriod>30</retentionPeriod>
- </managedRepository>
- <managedRepository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <location>${appserver.base}/target/test-classes/existing_snapshots</location>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <scanned>true</scanned>
- <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
- <retentionPeriod>30</retentionPeriod>
- </managedRepository>
- </managedRepositories>
- <remoteRepositories>
- <remoteRepository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- </remoteRepository>
- <remoteRepository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>http://download.java.net/maven/2/</url>
- <layout>default</layout>
- </remoteRepository>
- </remoteRepositories>
-
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <policies>
- <snapshots>disabled</snapshots>
- <releases>once</releases>
- <checksum>fix</checksum>
- <cache-failures>cached</cache-failures>
- </policies>
- <whiteListPatterns>
- <whiteListPattern>**/*</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <policies>
- <snapshots>disabled</snapshots>
- <releases>once</releases>
- <checksum>fix</checksum>
- <cache-failures>cached</cache-failures>
- </policies>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- <whiteListPattern>org/jvnet/**</whiteListPattern>
- <whiteListPattern>com/sun/**</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <legacyArtifactPaths>
- <legacyArtifactPath>
- <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
- <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
- </legacyArtifactPath>
- </legacyArtifactPaths>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- <knownContentConsumer>metadata-updater</knownContentConsumer>
- <!--knownContentConsumer>repository-purge</knownContentConsumer-->
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>true</showFindArtifacts>
- <appletFindEnabled>true</appletFindEnabled>
- </ui>
- </webapp>
-</configuration>
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
-
- <context:property-placeholder system-properties-mode="OVERRIDE"/>
-
- <bean name="archivaConfiguration#test-defaults-default-repo-location-exists" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#empty"/>
- </bean>
- <bean name="registry#empty" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"/>
-
- <bean name="archivaConfiguration#test-defaults" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#emptydef"/>
- </bean>
- <bean name="registry#emptydef" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"/>
-
- <bean name="archivaConfiguration#test-upgrade-09" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-upgrade-09"/>
- </bean>
-
-
-
- <bean name="registry#test-upgrade-09" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/src/test/conf/archiva-0.9.xml"
- config-name="org.apache.archiva" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-upgrade-1.3" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-upgrade-1.3"/>
- </bean>
-
- <bean name="registry#test-upgrade-1.3" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/src/test/conf/archiva-1.3.xml"
- config-name="org.apache.archiva" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-configuration" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#configured"/>
- </bean>
-
- <bean name="registry#configured" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <system/>
- <xml fileName="${basedir}/src/test/conf/repository-manager.xml"
- config-name="org.apache.archiva" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
-
- <bean name="archivaConfiguration#test-autodetect-v1" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-autodetect-v1"/>
- </bean>
-
- <bean name="registry#test-autodetect-v1" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <system/>
- <xml fileName="${basedir}/target/test-autodetect-v1/archiva-user.xml" config-optional="true"
- config-name="org.apache.archiva.user"
- config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-archiva-v1" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-archiva-v1"/>
- </bean>
-
- <bean name="registry#test-archiva-v1" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <system/>
- <xml fileName="${basedir}/src/test/conf/archiva-v1.xml"
- config-name="org.apache.archiva" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-save" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-save"/>
- </bean>
-
- <bean name="registry#test-save" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-save-user-defaults" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-save-user-defaults"/>
- </bean>
-
- <bean name="registry#test-save-user-defaults" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="false"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-save-user-fallback" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-save-user-fallback"/>
- </bean>
-
- <bean name="registry#test-save-user-fallback" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="false"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-save-user" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-save-user"/>
- </bean>
-
- <bean name="registry#test-save-user" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="false"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
-
- <bean name="archivaConfiguration#test-configuration-both" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-configuration-both"/>
- </bean>
-
- <bean name="registry#test-configuration-both" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/src/test/conf/conf-user.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- <xml fileName="${basedir}/src/test/conf/conf-base.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
-
- <bean name="archivaConfiguration#test-read-saved" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-read-saved"/>
- </bean>
-
- <bean name="registry#test-read-saved" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
-
- <bean name="archivaConfiguration#test-cron-expressions" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-cron-expressions"/>
- <property name="userConfigFilename" value="${basedir}/target/test/test-file.xml"/>
- </bean>
-
- <bean name="registry#test-cron-expressions" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
-
- <bean name="archivaConfiguration#test-remove-central" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-remove-central"/>
- </bean>
-
- <bean name="registry#test-remove-central" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true"
- config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
-
- <bean name="archivaConfiguration#test-not-allowed-to-write-to-both" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-not-allowed-to-write-to-both"/>
- <property name="userConfigFilename" value="/../../..//target/*intentionally:invalid*/.m2/archiva-user.xml"/>
- <property name="altConfigFilename" value="/../../..//target/*intentionally:invalid*/conf/archiva.xml"/>
- </bean>
-
- <bean name="registry#test-not-allowed-to-write-to-both" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="/../../..//*intentionally:invalid*/.m2/archiva-user.xml" config-optional="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- <xml fileName="/../../..//*intentionally:invalid*/conf/archiva.xml" config-optional="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="archivaConfiguration#test-not-allowed-to-write-to-user" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
- <property name="registry" ref="registry#test-not-allowed-to-write-to-user"/>
- <property name="userConfigFilename" value="${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml"/>
- <property name="altConfigFilename" value="${basedir}/target/test-appserver-base/conf/archiva.xml"/>
- </bean>
-
- <bean name="registry#test-not-allowed-to-write-to-user" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
- <property name="initialConfiguration">
- <value>
- <![CDATA[
- <configuration>
- <xml fileName="${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml" config-optional="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- <xml fileName="${basedir}/target/test-appserver-base/conf/archiva.xml" config-optional="true"
- config-name="org.apache.archiva.user" config-at="org.apache.archiva"/>
- </configuration>
- ]]>
- </value>
- </property>
- </bean>
-
- <bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache">
- <constructor-arg index="0" value="java.lang.String"/>
- <constructor-arg index="1" value="java.util.Date"/>
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="false"/>
- <property name="eternal" value="false"/>
- <property name="maxElementsInMemory" value="1000"/>
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="url-failures-cache"/>
- <property name="overflowToDisk" value="false"/>
- <property name="timeToIdleSeconds" value="2700"/>
- <property name="timeToLiveSeconds" value="1800"/>
- </bean>
-
-</beans>
\ No newline at end of file
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
<scope>test</scope>
</dependency>
<dependency>
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
* under the License.
*/
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.repository.base.managed.BasicManagedRepository;
import org.apache.archiva.repository.base.remote.BasicRemoteRepository;
<version>${archiva.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
<version>${archiva.version}</version>
</dependency>
<dependency>
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import org.apache.archiva.checksum.*;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
* under the License.
*/
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
*/
import org.apache.archiva.common.utils.BaseFile;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileType;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
import org.apache.archiva.repository.RepositoryRegistry;
* under the License.
*/
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.repository.base.managed.BasicManagedRepository;
import org.apache.archiva.repository.base.remote.BasicRemoteRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.MetadataFacet;
import org.apache.archiva.repository.base.ArchivaRepositoryRegistry;
*/
import org.apache.archiva.common.utils.BaseFile;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileType;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate;
import org.apache.archiva.metadata.model.ArtifactMetadata;
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
default-lazy-init="true">
- <bean name="archivaConfiguration#cleanup-released-snapshots" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#cleanup-released-snapshots" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#cleanup-released-snapshots"/>
</bean>
<alias name="archivaConfiguration#cleanup-released-snapshots" alias="archivaConfiguration"/>
<property name="filetypes" ref="filetypes#retention-count"/>
</bean>
- <bean name="archivaConfiguration#retention-count" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#retention-count" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#retention-count"/>
</bean>
</property>
</bean>
- <bean name="filetypes#retention-count" class="org.apache.archiva.configuration.FileTypes">
+ <bean name="filetypes#retention-count" class="org.apache.archiva.configuration.provider.FileTypes">
<property name="archivaConfiguration" ref="archivaConfiguration#retention-count"/>
</bean>
<property name="filetypes" ref="filetypes#days-old"/>
</bean>
- <bean name="archivaConfiguration#days-old" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#days-old" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#days-old"/>
</bean>
</property>
</bean>
- <bean name="filetypes#days-old" class="org.apache.archiva.configuration.FileTypes">
+ <bean name="filetypes#days-old" class="org.apache.archiva.configuration.provider.FileTypes">
<property name="archivaConfiguration" ref="archivaConfiguration#days-old"/>
</bean>
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import junit.framework.TestCase;
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.components.taskqueue.TaskQueueException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.base.ArchivaRepositoryRegistry;
import org.apache.archiva.repository.base.RepositoryHandlerDependencies;
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.NetworkProxyConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.policies.Policy;
import org.apache.archiva.policies.PolicyOption;
import org.apache.archiva.policies.PolicyUtil;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.components.taskqueue.TaskQueueException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration;
import org.apache.archiva.policies.DownloadErrorPolicy;
import org.apache.archiva.policies.DownloadPolicy;
import org.apache.archiva.policies.Policy;
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.RepositoryCommonValidator;
import org.apache.archiva.admin.model.beans.AbstractRepository;
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.admin.model.beans.AbstractRepository;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.scheduler.CronExpressionValidator;
import org.apache.commons.lang3.StringUtils;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.beans.*;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.UserInterfaceOptions;
-import org.apache.archiva.configuration.WebappConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.UserInterfaceOptions;
+import org.apache.archiva.configuration.model.WebappConfiguration;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
{
List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<>(
getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths().size() );
- for ( org.apache.archiva.configuration.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() )
+ for ( org.apache.archiva.configuration.model.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() )
{
legacyArtifactPaths.add(
getModelMapper().map( legacyArtifactPath, LegacyArtifactPath.class ) );
Configuration configuration = getArchivaConfiguration().getConfiguration();
configuration.addLegacyArtifactPath( getModelMapper().map( legacyArtifactPath,
- org.apache.archiva.configuration.LegacyArtifactPath.class ) );
+ org.apache.archiva.configuration.model.LegacyArtifactPath.class ) );
saveConfiguration( configuration );
triggerAuditEvent( "", "", AuditEvent.ADD_LEGACY_PATH, auditInformation );
throws RepositoryAdminException
{
Configuration configuration = getArchivaConfiguration().getConfiguration();
- org.apache.archiva.configuration.LegacyArtifactPath legacyArtifactPath =
- new org.apache.archiva.configuration.LegacyArtifactPath();
+ org.apache.archiva.configuration.model.LegacyArtifactPath legacyArtifactPath =
+ new org.apache.archiva.configuration.model.LegacyArtifactPath();
legacyArtifactPath.setPath( path );
configuration.removeLegacyArtifactPath( legacyArtifactPath );
{
Configuration configuration = getArchivaConfiguration().getConfiguration();
- org.apache.archiva.configuration.FileType fileType = getFileTypeById( fileTypeId, configuration );
+ org.apache.archiva.configuration.model.FileType fileType = getFileTypeById( fileTypeId, configuration );
if ( fileType == null )
{
return;
{
Configuration configuration = getArchivaConfiguration().getConfiguration();
- org.apache.archiva.configuration.FileType fileType = getFileTypeById( fileTypeId, configuration );
+ org.apache.archiva.configuration.model.FileType fileType = getFileTypeById( fileTypeId, configuration );
if ( fileType == null )
{
return;
public FileType getFileType( String fileTypeId )
throws RepositoryAdminException
{
- org.apache.archiva.configuration.FileType fileType =
+ org.apache.archiva.configuration.model.FileType fileType =
getFileTypeById( fileTypeId, getArchivaConfiguration().getConfiguration() );
if ( fileType == null )
{
}
configuration.getRepositoryScanning().addFileType(
- getModelMapper().map( fileType, org.apache.archiva.configuration.FileType.class ) );
+ getModelMapper().map( fileType, org.apache.archiva.configuration.model.FileType.class ) );
saveConfiguration( configuration );
}
throws RepositoryAdminException
{
Configuration configuration = getArchivaConfiguration().getConfiguration();
- org.apache.archiva.configuration.FileType fileType = new org.apache.archiva.configuration.FileType();
+ org.apache.archiva.configuration.model.FileType fileType = new org.apache.archiva.configuration.model.FileType();
fileType.setId( fileTypeId );
configuration.getRepositoryScanning().removeFileType( fileType );
saveConfiguration( configuration );
public List<FileType> getFileTypes()
throws RepositoryAdminException
{
- List<org.apache.archiva.configuration.FileType> configFileTypes =
+ List<org.apache.archiva.configuration.model.FileType> configFileTypes =
getArchivaConfiguration().getConfiguration().getRepositoryScanning().getFileTypes();
if ( configFileTypes == null || configFileTypes.isEmpty() )
{
return Collections.emptyList();
}
List<FileType> fileTypes = new ArrayList<>( configFileTypes.size() );
- for ( org.apache.archiva.configuration.FileType fileType : configFileTypes )
+ for ( org.apache.archiva.configuration.model.FileType fileType : configFileTypes )
{
fileTypes.add( getModelMapper().map( fileType, FileType.class ) );
}
public OrganisationInformation getOrganisationInformation()
throws RepositoryAdminException
{
- org.apache.archiva.configuration.OrganisationInformation organisationInformation =
+ org.apache.archiva.configuration.model.OrganisationInformation organisationInformation =
getArchivaConfiguration().getConfiguration().getOrganisationInfo();
if ( organisationInformation == null )
{
if ( organisationInformation != null )
{
organisationInformation.setName( convertName( organisationInformation.getName() ));
- org.apache.archiva.configuration.OrganisationInformation organisationInformationModel =
+ org.apache.archiva.configuration.model.OrganisationInformation organisationInformationModel =
getModelMapper( ).map( organisationInformation,
- org.apache.archiva.configuration.OrganisationInformation.class );
+ org.apache.archiva.configuration.model.OrganisationInformation.class );
configuration.setOrganisationInfo( organisationInformationModel );
}
else
public NetworkConfiguration getNetworkConfiguration()
throws RepositoryAdminException
{
- org.apache.archiva.configuration.NetworkConfiguration networkConfiguration =
+ org.apache.archiva.configuration.model.NetworkConfiguration networkConfiguration =
getArchivaConfiguration().getConfiguration().getNetworkConfiguration();
if ( networkConfiguration == null )
else
{
configuration.setNetworkConfiguration( getModelMapper().map( networkConfiguration,
- org.apache.archiva.configuration.NetworkConfiguration.class ) );
+ org.apache.archiva.configuration.model.NetworkConfiguration.class ) );
}
// setupWagon( networkConfiguration );
saveConfiguration( configuration );
//
//-------------------------
- private org.apache.archiva.configuration.FileType getFileTypeById( String id, Configuration configuration )
+ private org.apache.archiva.configuration.model.FileType getFileTypeById( String id, Configuration configuration )
{
- for ( org.apache.archiva.configuration.FileType fileType : configuration.getRepositoryScanning().getFileTypes() )
+ for ( org.apache.archiva.configuration.model.FileType fileType : configuration.getRepositoryScanning().getFileTypes() )
{
if ( StringUtils.equals( id, fileType.getId() ) )
{
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.Event;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.event.EventType;
import org.apache.archiva.metadata.model.facets.AuditEvent;
-import org.apache.archiva.indexer.merger.MergedRemoteIndexesScheduler;
import org.apache.archiva.repository.EditableRepositoryGroup;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryRegistry;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
import org.apache.archiva.components.cache.Cache;
import org.apache.archiva.components.taskqueue.TaskQueueException;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.IndexManagerFactory;
import org.apache.archiva.indexer.IndexUpdateFailedException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.archiva.admin.model.beans.NetworkProxy;
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorOrderComparator;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.functors.ProxyConnectorSelectionPredicate;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.functors.ProxyConnectorSelectionPredicate;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.commons.collections4.IterableUtils;
import org.apache.archiva.proxy.model.ProxyConnectorRuleType;
import org.apache.archiva.admin.model.proxyconnectorrule.ProxyConnectorRuleAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryCheckPath;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryCheckPath;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RepositoryCredentials;
import org.apache.archiva.admin.model.beans.FileLockConfiguration;
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
import org.apache.archiva.components.cache.Cache;
import org.apache.archiva.components.registry.RegistryException;
import org.springframework.stereotype.Service;
}
protected ArchivaRuntimeConfiguration build(
- org.apache.archiva.configuration.ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
+ org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
{
if ( archivaRuntimeConfiguration == null )
{
return res;
}
- protected org.apache.archiva.configuration.ArchivaRuntimeConfiguration build(
+ protected org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration build(
ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
{
if ( archivaRuntimeConfiguration == null )
{
- return new org.apache.archiva.configuration.ArchivaRuntimeConfiguration();
+ return new org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration();
}
- org.apache.archiva.configuration.ArchivaRuntimeConfiguration res =
+ org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration res =
getModelMapper().map( archivaRuntimeConfiguration,
- org.apache.archiva.configuration.ArchivaRuntimeConfiguration.class );
+ org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration.class );
if ( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration() != null )
{
res.setUrlFailureCacheConfiguration(
getModelMapper().map( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration(),
- org.apache.archiva.configuration.CacheConfiguration.class ) );
+ org.apache.archiva.configuration.model.CacheConfiguration.class ) );
}
{
res.setFileLockConfiguration(
getModelMapper().map( archivaRuntimeConfiguration.getFileLockConfiguration(),
- org.apache.archiva.configuration.FileLockConfiguration.class ) );
+ org.apache.archiva.configuration.model.FileLockConfiguration.class ) );
}
return res;
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
import org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
import org.apache.archiva.components.cache.Cache;
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.util.ConfigMapper;
+import org.apache.archiva.configuration.provider.util.ConfigMapper;
import org.apache.archiva.redback.configuration.UserConfiguration;
import org.apache.archiva.redback.configuration.UserConfigurationException;
-import org.apache.archiva.redback.configuration.UserConfigurationKeys;
import org.apache.archiva.redback.users.User;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
public void updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
throws RepositoryAdminException
{
- org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration =
+ org.apache.archiva.configuration.model.RedbackRuntimeConfiguration runtimeConfiguration =
build( redbackRuntimeConfiguration );
Configuration configuration = archivaConfiguration.getConfiguration();
configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
}
private RedbackRuntimeConfiguration build(
- org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
+ org.apache.archiva.configuration.model.RedbackRuntimeConfiguration runtimeConfiguration )
{
RedbackRuntimeConfiguration redbackRuntimeConfiguration =
getModelMapper().map( runtimeConfiguration, RedbackRuntimeConfiguration.class );
redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
}
- List<org.apache.archiva.configuration.LdapGroupMapping> mappings = runtimeConfiguration.getLdapGroupMappings();
+ List<org.apache.archiva.configuration.model.LdapGroupMapping> mappings = runtimeConfiguration.getLdapGroupMappings();
if ( mappings != null && mappings.size() > 0 )
{
List<LdapGroupMapping> ldapGroupMappings = new ArrayList<>( mappings.size() );
- for ( org.apache.archiva.configuration.LdapGroupMapping mapping : mappings )
+ for ( org.apache.archiva.configuration.model.LdapGroupMapping mapping : mappings )
{
ldapGroupMappings.add( new LdapGroupMapping( mapping.getGroup(), mapping.getRoleNames() ) );
}
LDAP_MAPPER.getAllAttributes( ).stream( ).forEach( att -> properties.remove( att ) );
}
- private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(
+ private org.apache.archiva.configuration.model.RedbackRuntimeConfiguration build(
RedbackRuntimeConfiguration redbackRuntimeConfiguration )
{
- org.apache.archiva.configuration.RedbackRuntimeConfiguration res =
+ org.apache.archiva.configuration.model.RedbackRuntimeConfiguration res =
getModelMapper().map( redbackRuntimeConfiguration,
- org.apache.archiva.configuration.RedbackRuntimeConfiguration.class );
+ org.apache.archiva.configuration.model.RedbackRuntimeConfiguration.class );
if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
{
redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
}
res.setLdapConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
- org.apache.archiva.configuration.LdapConfiguration.class ) );
+ org.apache.archiva.configuration.model.LdapConfiguration.class ) );
if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
{
}
res.setUsersCacheConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
- org.apache.archiva.configuration.CacheConfiguration.class ) );
+ org.apache.archiva.configuration.model.CacheConfiguration.class ) );
List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
if ( ldapGroupMappings != null && ldapGroupMappings.size() > 0 )
{
- List<org.apache.archiva.configuration.LdapGroupMapping> mappings =
+ List<org.apache.archiva.configuration.model.LdapGroupMapping> mappings =
new ArrayList<>( ldapGroupMappings.size() );
for ( LdapGroupMapping ldapGroupMapping : ldapGroupMappings )
{
- org.apache.archiva.configuration.LdapGroupMapping mapping =
- new org.apache.archiva.configuration.LdapGroupMapping();
+ org.apache.archiva.configuration.model.LdapGroupMapping mapping =
+ new org.apache.archiva.configuration.model.LdapGroupMapping();
mapping.setGroup( ldapGroupMapping.getGroup() );
mapping.setRoleNames( new ArrayList<>( ldapGroupMapping.getRoleNames() ) );
mappings.add( mapping );
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.IndexCreationFailedException;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.admin.model.proxyconnectorrule.ProxyConnectorRuleAdmin;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.redback.role.RoleManager;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.memory.SimpleUser;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.security.common.ArchivaRoleConstants;
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
* under the License.
*/
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
import org.apache.archiva.repository.validation.CheckedResult;
import org.apache.archiva.repository.validation.RepositoryChecker;
import org.apache.archiva.repository.validation.RepositoryValidator;
<D> CheckedResult<R, D>
putWithCheck( C repositoryConfiguration, RepositoryChecker<R, D> checker ) throws RepositoryException;
+ /**
+ * Adds or updates a repository from the given configuration data. The resulting repository is
+ * checked by the default repository checker of the handler instance and the result is returned.
+ * If the checker returns a valid result, the registry is updated and configuration is saved.
+ *
+ * @param repositoryConfiguration the repository configuration
+ * @return the repository and the check result as map of attributes -> list of validation errors
+ * @throws RepositoryException if the creation or update failed
+ */
+ CheckedResult<R, Map<String, List<ValidationError>>>
+ putWithCheck( C repositoryConfiguration ) throws RepositoryException;
+
+
/**
* Removes the given repository from the registry and updates references and saves the new configuration.
*
* under the License.
*/
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
import org.apache.archiva.event.Event;
import org.apache.archiva.event.EventHandler;
* under the License.
*/
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.repository.event.RepositoryEvent;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.EventSource;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.IndexUpdateFailedException;
*/
ManagedRepository putRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration, Configuration configuration ) throws RepositoryException;
+ /**
+ * Validates the given repository configuration and adds the repository persistent to the registry, if it is valid.
+ * If the validation was not successful, the repository will not be added or persistet, and it will return the list of validation errors.
+ *
+ * @param configuration the managed repository configuration
+ * @return the managed repository or a list of validation errors
+ * @throws RepositoryException if there are errors while adding the repository
+ */
+ CheckedResult<ManagedRepository, Map<String, List<ValidationError>>> putRepositoryAndValidate( ManagedRepositoryConfiguration configuration) throws RepositoryException;
+
/**
* Adds or updates the given repository group. If a repository group with the given id exists already, it is updated
* from the data of the given instance. Otherwise a new repository is created and updated by the data of the given instance.
*/
RemoteRepository putRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration ) throws RepositoryException;
+ /**
+ * Adds or updates the given remote repository. If a remote repository with the given id exists already, it is updated
+ * from the data of the given configuration. Otherwise a new repository is created and updated by the data of the given configuration.
+ *
+ * The remoteRepositoryConfiguration is validated before adding to the registry and persisting. If the validation fails,
+ * it is not registered or updated.
+ *
+ * @param remoteRepositoryConfiguration the remote repository configuration
+ * @return the repository instance, that was created or updated
+ * @throws RepositoryException if an error occurred while creating or updating the instance
+ */
+ CheckedResult<RemoteRepository, Map<String, List<ValidationError>>> putRepositoryAndValidate( RemoteRepositoryConfiguration remoteRepositoryConfiguration ) throws RepositoryException;
+
/**
* Adds or updates the given remote repository. If a remote repository with the given id exists already, it is updated
* from the data of the given configuration. Otherwise a new repository is created and updated by the data of the given configuration.
<artifactId>archiva-repository-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
import org.apache.archiva.event.Event;
import org.apache.archiva.event.EventManager;
import org.apache.archiva.event.EventType;
}
- protected abstract C findRepositoryConfiguration(Configuration configuration, String id);
+ @Override
+ public CheckedResult<R, Map<String, List<ValidationError>>> putWithCheck( C repositoryConfiguration ) throws RepositoryException
+ {
+ return putWithCheck( repositoryConfiguration, getValidator( ) );
+ }
+
+ protected abstract C findRepositoryConfiguration( Configuration configuration, String id);
protected abstract void removeRepositoryConfiguration(Configuration configuration, C repoConfiguration );
*/
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationEvent;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.ConfigurationEvent;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.Event;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.event.EventManager;
}
}
+ @Override
+ public CheckedResult<ManagedRepository, Map<String, List<ValidationError>>> putRepositoryAndValidate( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+ {
+ rwLock.writeLock().lock();
+ try {
+ return managedRepositoryHandler.putWithCheck( configuration );
+ } finally
+ {
+ rwLock.writeLock( ).unlock( );
+ }
+ }
/**
* Adds a new repository group to the current list, or replaces the repository group definition with
rwLock.writeLock( ).lock( );
try
{
- return groupHandler.putWithCheck( repositoryGroupConfiguration, groupHandler.getValidator( ) );
+ return groupHandler.putWithCheck( repositoryGroupConfiguration );
}
finally
{
}
}
+ @Override
+ public CheckedResult<RemoteRepository, Map<String, List<ValidationError>>> putRepositoryAndValidate( RemoteRepositoryConfiguration remoteRepositoryConfiguration ) throws RepositoryException
+ {
+ rwLock.writeLock().lock();
+ try {
+ return remoteRepositoryHandler.putWithCheck( remoteRepositoryConfiguration );
+ } finally
+ {
+ rwLock.writeLock().unlock();
+ }
+ }
+
/**
* Adds a new repository or updates the repository with the same id. The given configuration object is updated, but
* the configuration is not saved.
*/
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
import org.springframework.stereotype.Service;
import java.util.concurrent.locks.ReentrantReadWriteLock;
*/
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.indexer.merger.MergedRemoteIndexesScheduler;
import org.apache.archiva.repository.EditableRepository;
import org.apache.archiva.repository.EditableRepositoryGroup;
*/
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.IndexCreationFailedException;
import org.apache.archiva.indexer.IndexManagerFactory;
*/
import org.apache.archiva.components.registry.RegistryException;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.IndexCreationFailedException;
import org.apache.archiva.indexer.IndexManagerFactory;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationEvent;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ConfigurationEvent;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.provider.FileTypes;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.Plugin;
import org.apache.archiva.model.SnapshotVersion;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.indexer.merger.MergedRemoteIndexesScheduler;
import org.apache.archiva.repository.EditableRepositoryGroup;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.filelock.FileLockManager;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.indexer.IndexManagerFactory;
-import org.apache.archiva.indexer.merger.MergedRemoteIndexesScheduler;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.Repository;
import org.apache.archiva.repository.validation.ValidationError;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.indexer.IndexManagerFactory;
import org.apache.archiva.repository.EditableRemoteRepository;
import org.apache.archiva.repository.RemoteRepository;
* under the License.
*/
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.repository.*;
import org.apache.archiva.event.Event;
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
* under the License.
*/
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.common.utils.BaseFile;
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.admin.model.beans.NetworkConfiguration;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.admin.model.beans.UiConfiguration;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.springframework.stereotype.Service;
import java.util.List;
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.repository.base.managed.BasicManagedRepository;
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-lazy-init="true">
- <bean name="archivaConfiguration#test-conf" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#test-conf" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#configured"/>
</bean>
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.IndexCreationFailedException;
import junit.framework.TestCase;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.search.SearchResultHit;
import org.apache.archiva.indexer.search.SearchResults;
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ArchivaRuntimeConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.PolicyOption;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.NetworkProxyConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.Plugin;
import org.apache.archiva.model.SnapshotVersion;
* under the License.
*/
-import org.apache.archiva.configuration.*;
+import org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.provider.*;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryException;
import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.archiva.configuration.model.Configuration;
import org.apache.commons.lang3.StringUtils;
-import org.mockito.Mockito;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
* under the License.
*/
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.repository.base.managed.BasicManagedRepository;
import org.apache.archiva.repository.base.remote.BasicRemoteRepository;
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva.maven</groupId>
*/
import org.apache.archiva.common.filelock.FileLockManager;
-import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.AbstractRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.event.Event;
import org.apache.archiva.event.EventHandler;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.ItemDeleteStatus;
*/
import org.apache.archiva.common.filelock.FileLockManager;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.maven.repository.metadata.storage.ArtifactMappingProvider;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.filter.Filter;
import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.model.ArtifactMetadata;
*/
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaRuntimeConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.repository.EditableRepositoryGroup;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.VersionComparator;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileType;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.maven.repository.MavenManagedRepository;
import org.apache.archiva.maven.repository.metadata.storage.ArtifactMappingProvider;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.FileType;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.maven.repository.MavenManagedRepository;
import org.apache.archiva.maven.repository.metadata.storage.ArtifactMappingProvider;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.maven.model.Artifact;
import org.apache.archiva.maven.model.TreeEntry;
import org.apache.archiva.repository.RepositoryRegistry;
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
*/
import org.apache.archiva.common.utils.VersionComparator;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.maven.repository.AbstractRepositoryLayerTestCase;
import org.apache.archiva.maven.repository.MavenManagedRepository;
import org.apache.archiva.maven.repository.metadata.storage.mock.MockConfiguration;
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.filter.AllFilter;
import org.apache.archiva.filter.Filter;
import org.apache.archiva.metadata.model.ArtifactMetadata;
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.filter.AllFilter;
import org.apache.archiva.filter.Filter;
import org.apache.archiva.metadata.model.ArtifactMetadata;
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
import org.apache.archiva.filter.AllFilter;
import org.apache.archiva.filter.ExcludesFilter;
import org.apache.archiva.filter.Filter;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryException;
import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ArchivaRuntimeConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.FileType;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.model.FileType;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.IndexCreationFailedException;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorOrderComparator;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.commons.lang3.StringUtils;
import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryException;
import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.model.RepositoryScanningConfiguration;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryException;
import org.apache.archiva.components.registry.RegistryListener;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.provider.IndeterminateConfigurationException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
<context:property-placeholder system-properties-mode="OVERRIDE"/>
<context:component-scan base-package="org.apache.archiva.maven.repository.content" />
- <bean name="archivaConfiguration#repo-request-test" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#repo-request-test" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#configured"/>
</bean>
<property name="configuration" ref="archivaConfiguration#default"/>
</bean>
- <bean name="filetypes" class="org.apache.archiva.configuration.FileTypes">
+ <bean name="filetypes" class="org.apache.archiva.configuration.provider.FileTypes">
<property name="archivaConfiguration" ref="archivaConfiguration#default"/>
</bean>
<context:component-scan base-package="org.apache.archiva.repository,org.apache.archiva.configuration,org.apache.archiva.metadata.repository,org.apache.archiva.maven.repository.mock"/>
- <bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
</bean>
<alias name="archivaConfiguration#test" alias="archivaConfiguration#default"/>
<alias name="archivaConfiguration#test" alias="archivaConfiguration"/>
<property name="configuration" ref="archivaConfiguration#default"/>
</bean>
- <bean name="filetypes" class="org.apache.archiva.configuration.FileTypes">
+ <bean name="filetypes" class="org.apache.archiva.configuration.provider.FileTypes">
<property name="archivaConfiguration" ref="archivaConfiguration#default"/>
</bean>
<artifactId>archiva-storage-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexException;
import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexScheduler;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationEvent;
-import org.apache.archiva.configuration.ConfigurationListener;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ConfigurationEvent;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
import org.apache.archiva.maven.common.proxy.WagonFactory;
import org.apache.archiva.repository.RepositoryRegistry;
</bean>
<!-- wire up more basic configuration so it doesn't overwrite any config files -->
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
</dependency>
<!--
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
-->
<dependency>
-->
<!--
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import org.apache.archiva.common.ArchivaException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationEvent;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ConfigurationEvent;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.RepositorySession;
import junit.framework.TestCase;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsManager;
import org.apache.archiva.mock.MockRepositorySessionFactory;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.common.utils.PathUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.indexer.ArchivaIndexManager;
import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.IndexCreationFailedException;
import org.apache.archiva.admin.model.beans.NetworkConfiguration;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.admin.model.beans.UiConfiguration;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import java.util.ArrayList;
import java.util.List;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import java.util.List;
import java.util.Map;
<alias name="repositoryStatisticsManager#test" alias="repositoryStatisticsManager#default"/>
- <bean name="archivaConfiguration#test-repository-scanning" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#test-repository-scanning" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#test-configured"/>
</bean>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
+ </dependency>
<dependency>
* @author Martin Stockhammer <martin_s@apache.org>
*/
@Schema(name="Artifact", description = "Information about artifacts")
-public class Artifact implements Serializable
+public class Artifact implements Serializable, RestModel
{
private static final long serialVersionUID = 7581578317346876555L;
private String name;
/**
* @author Martin Stockhammer <martin_s@apache.org>
*/
-public class ArtifactTransferRequest implements Serializable
+public class ArtifactTransferRequest implements Serializable, RestModel
{
private static final long serialVersionUID = -7377281345536573342L;
*/
@XmlRootElement(name="beanInformation")
@Schema(name="BeanInformation",description = "Information about a bean instance.")
-public class BeanInformation implements Serializable
+public class BeanInformation implements Serializable, RestModel
{
private static final long serialVersionUID = -432385743277355987L;
private String id;
@XmlRootElement( name = "cacheConfiguration" )
@Schema(name="CacheConfiguration",description = "Cache configuration attributes")
public class CacheConfiguration
- implements Serializable
+ implements Serializable, RestModel
{
private static final long serialVersionUID = 5479989049980673894L;
/**
* @author Martin Stockhammer <martin_s@apache.org>
*/
@Schema(name="FileInfo",description = "Information about a file stored in the repository")
-public class FileInfo implements Serializable
+public class FileInfo implements Serializable, RestModel
{
private static final long serialVersionUID = 900497784542880195L;
private OffsetDateTime modified;
* @author Martin Stockhammer <martin_s@apache.org>
*/
@Schema(name="IndexingTask",description = "Information about indexing tasks")
-public class IndexingTask implements Serializable
+public class IndexingTask implements Serializable, RestModel
{
private static final long serialVersionUID = -1947200162602613310L;
private String repositoryId = "";
*/
@XmlRootElement(name="ldapConfiguration")
@Schema(name="LdapConfiguration", description = "LDAP configuration attributes")
-public class LdapConfiguration implements Serializable
+public class LdapConfiguration implements Serializable, RestModel
{
private static final long serialVersionUID = -4736767846016398583L;
*/
@XmlRootElement(name="mergeConfiguration")
@Schema(name="MergeConfiguration", description = "Configuration settings for index merge of remote repositories.")
-public class MergeConfiguration implements Serializable
+public class MergeConfiguration implements Serializable, RestModel
{
private static final long serialVersionUID = -3629274059574459133L;
* @since 3.0
*/
@Schema(description = "Repository data")
-public class Repository implements Serializable
+public class Repository implements Serializable, RestModel
{
private static final long serialVersionUID = -4741025877287175182L;
*/
@XmlRootElement(name="repositoryGroup")
@Schema(name="RepositoryGroup", description = "Information about a repository group, which combines multiple repositories as one virtual repository.")
-public class RepositoryGroup implements Serializable
+public class RepositoryGroup implements Serializable, RestModel
{
private static final long serialVersionUID = -7319687481737616081L;
private String id;
*/
@XmlRootElement(name="repositoryStatistics")
@Schema(name="RepositoryStatistics", description = "Statistics data")
-public class RepositoryStatistics implements Serializable
+public class RepositoryStatistics implements Serializable, RestModel
{
private static final long serialVersionUID = 7943367882738452531L;
--- /dev/null
+package org.apache.archiva.rest.api.v2.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Marker interface that represents a model instance for REST services
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public interface RestModel
+{
+}
* @author Martin Stockhammer <martin_s@apache.org>
*/
@Schema(name="ScanStatus", description = "Status of repository scan tasks")
-public class ScanStatus implements Serializable
+public class ScanStatus implements Serializable, RestModel
{
private boolean scanRunning = false;
private int scanQueued = 0;
* @author Martin Stockhammer <martin_s@apache.org>
*/
@Schema(name="ScanTask", description = "Repository scan task information")
-public class ScanTask implements Serializable
+public class ScanTask implements Serializable, RestModel
{
private static final long serialVersionUID = -681163357370848098L;
private String repositoryId="";
*/
@XmlRootElement(name = "securityConfiguration")
@Schema(name = "SecurityConfiguration", description = "Security configuration attributes.")
-public class SecurityConfiguration implements Serializable
+public class SecurityConfiguration implements Serializable, RestModel
{
private static final long serialVersionUID = -4186866365979053029L;
*/
@XmlRootElement(name = "validationError")
@Schema(name = "ValidationError", description = "A validation error.")
-public class ValidationError implements Serializable
+public class ValidationError implements Serializable, RestModel
{
private static final long serialVersionUID = 2079020598090660171L;
--- /dev/null
+package org.apache.archiva.rest.api.v2.model.map;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.ModelMapper;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.rest.api.v2.model.MavenManagedRepository;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public class MavenRepositoryMapper implements RestMapper<MavenManagedRepository, ManagedRepositoryConfiguration>
+{
+ @Override
+ public ManagedRepositoryConfiguration map( MavenManagedRepository source )
+ {
+ return null;
+ }
+
+ @Override
+ public void update( MavenManagedRepository source, ManagedRepositoryConfiguration target )
+ {
+
+ }
+
+ @Override
+ public MavenManagedRepository reverseMap( ManagedRepositoryConfiguration target )
+ {
+ return null;
+ }
+
+ @Override
+ public void reverseUpdate( ManagedRepositoryConfiguration target, MavenManagedRepository source )
+ {
+
+ }
+
+ @Override
+ public Class<MavenManagedRepository> getSourceType( )
+ {
+ return MavenManagedRepository.class;
+ }
+
+ @Override
+ public Class<ManagedRepositoryConfiguration> getTargetType( )
+ {
+ return ManagedRepositoryConfiguration.class;
+ }
+
+ @Override
+ public <S, T> boolean supports( Class<S> sourceType, Class<T> targetType )
+ {
+ return (
+ sourceType.isAssignableFrom( getSourceType() ) &&
+ targetType.isAssignableFrom( getTargetType() ) );
+ }
+}
--- /dev/null
+package org.apache.archiva.rest.api.v2.model.map;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.ModelMapper;
+import org.apache.archiva.configuration.model.ConfigurationModel;
+import org.apache.archiva.rest.api.v2.model.RestModel;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public interface RestMapper<S extends RestModel, T extends ConfigurationModel> extends ModelMapper<S,T>
+{
+}
--- /dev/null
+package org.apache.archiva.rest.api.v2.model.map;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.ModelMapper;
+import org.apache.archiva.common.ModelMapperFactory;
+import org.apache.archiva.configuration.model.ConfigurationModel;
+import org.apache.archiva.rest.api.v2.model.RestModel;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+@Service("modelMapperFactory#rest")
+public class ServiceMapperFactory implements ModelMapperFactory<RestModel, ConfigurationModel>
+{
+ @Inject
+ List<ModelMapper> modelMapperList;
+
+ Map<Class<? extends RestModel>, Map<Class<? extends ConfigurationModel>,ModelMapper<? extends RestModel, ? extends ConfigurationModel>>> modelMap;
+
+ @PostConstruct
+ void initMapper() {
+ modelMap = new HashMap<>( );
+ for ( ModelMapper<?, ?> mapper : modelMapperList )
+ {
+ if (!mapper.supports( RestModel.class, ConfigurationModel.class )) {
+ continue;
+ }
+ Class<? extends RestModel> sType = (Class<? extends RestModel>) mapper.getSourceType( );
+ Class<? extends ConfigurationModel> tType = (Class<? extends ConfigurationModel>) mapper.getTargetType( );
+ Map<Class<? extends ConfigurationModel>, ModelMapper<? extends RestModel, ? extends ConfigurationModel>> tMap;
+ if (modelMap.containsKey( sType )) {
+ tMap = modelMap.get( sType );
+ } else {
+ tMap = new HashMap<>( );
+ }
+ tMap.put( tType, (ModelMapper<? extends RestModel, ? extends ConfigurationModel>) mapper );
+ }
+ }
+
+ @Override
+ public <S extends RestModel, T extends ConfigurationModel> ModelMapper<S, T> getMapper( Class<S> sourceType, Class<T> targetType ) throws IllegalArgumentException
+ {
+ if (!modelMap.containsKey( sourceType )) {
+ throw new IllegalArgumentException( "No mapper defined for the given source type "+sourceType );
+ }
+ Map<Class<? extends ConfigurationModel>, ModelMapper<? extends RestModel, ? extends ConfigurationModel>> tMap = modelMap.get( sourceType );
+ if ( !tMap.containsKey( targetType ) )
+ {
+ throw new IllegalArgumentException( "No mapper defined for the given target type "+targetType );
+ }
+ return (ModelMapper<S, T>) tMap.get( targetType );
+ }
+}
import org.apache.archiva.components.rest.model.PagedResult;
import org.apache.archiva.components.rest.util.QueryHelper;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.repository.EditableRepositoryGroup;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.components.rest.model.PagedResult;
import org.apache.archiva.components.rest.util.QueryHelper;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.AuthorizationException;
import org.apache.archiva.redback.rest.services.RedbackAuthenticationThreadLocal;
return new AuditInformation( user, remoteAddr );
}
+ public static ManagedRepositoryConfiguration toConfig(MavenManagedRepository repo) {
+ ManagedRepositoryConfiguration cfg = new ManagedRepositoryConfiguration( );
+ return cfg;
+
+ }
+
@Override
public PagedResult<MavenManagedRepository> getManagedRepositories( final String searchTerm, final Integer offset,
final Integer limit, final List<String> orderBy,
repoBean.setDeleteReleasedSnapshots( repository.isDeleteSnapshotsOfRelease() );
repoBean.setSkipPackedIndexCreation( repository.isSkipPackedIndexCreation() );
repoBean.setRetentionCount( repository.getRetentionCount() );
- repoBean.setRetentionPeriod( repository.getRetentionPeriod().getDays() );
+ if (repository.getRetentionPeriod()!=null)
+ {
+ repoBean.setRetentionPeriod( repository.getRetentionPeriod( ).getDays( ) );
+ }
repoBean.setIndexDirectory( repository.getIndexPath() );
repoBean.setPackedIndexDirectory( repository.getPackedIndexPath() );
repoBean.setLayout( repository.getLayout() );
import org.apache.archiva.rest.v2.svc.AbstractNativeRestServices;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestMethodOrder;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import static io.restassured.RestAssured.given;
import static io.restassured.http.ContentType.JSON;
assertEquals( "snapshots", repositories.get( 1 ).getId( ) );
}
+ private Response createRepository(String id, String name, String description, String token) {
+ Map<String, Object> jsonAsMap = new HashMap<>( );
+ jsonAsMap.put( "id", id );
+ jsonAsMap.put( "name", name );
+ jsonAsMap.put( "description", description );
+ return given( ).spec( getRequestSpec( token ) ).contentType( JSON )
+ .when( )
+ .body( jsonAsMap )
+ .post( "" )
+ .then( ).statusCode( 201 ).extract( ).response( );
+ }
+
+
+ @Disabled
+ @Test
+ @Order( 2 )
+ void testCreateRepository() {
+ String token = getAdminToken( );
+ Response response = createRepository( "repo001", "Repository 001", "This is repository 001", token );
+ assertNotNull( response );
+ JsonPath json = response.getBody( ).jsonPath( );
+ assertNotNull( json );
+ assertEquals( "repo001", json.get( "id" ) );
+ assertEquals( "Repository 001", json.get( "name" ) );
+ assertEquals( "maven", json.get( "type" ) );
+ assertEquals( "This is repository 001", json.get( "description" ) );
+ }
+
}
</bean>
<!-- wire up more basic configuration so it doesn't overwrite any config files -->
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
</bean>
<!-- wire up more basic configuration so it doesn't overwrite any config files -->
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
import org.apache.archiva.redback.rbac.UserAssignment;
<alias name="servletAuthenticator" alias="servletAuthenticator#test"/>
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#test"/>
</bean>
<alias name="archivaConfiguration#default" alias="archivaConfiguration"/>
<artifactId>metadata-repository-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.components.taskqueue.TaskQueueException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.SnapshotVersion;
*/
import org.apache.archiva.common.ArchivaException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ConfigurationNames;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.components.registry.RegistryListener;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.rbac.RbacManagerException;
import junit.framework.TestCase;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.repository.base.managed.BasicManagedRepository;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
*/
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
import org.apache.archiva.web.AbstractRestServicesTest;
<alias name="securitySystem#test" alias="securitySystem"/>
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
</bean>
<!-- wire up more basic configuration so it doesn't overwrite any config files -->
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
</bean>
<!-- wire up more basic configuration so it doesn't overwrite any config files -->
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<artifactId>archiva-repository-scanner</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
<!-- should be runtime but currently not possible due ConfigurationListener
<scope>runtime</scope>
-->
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.merger.IndexMerger;
import org.apache.archiva.indexer.merger.IndexMergerException;
*/
import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationEvent;
-import org.apache.archiva.configuration.ConfigurationListener;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ConfigurationEvent;
+import org.apache.archiva.configuration.provider.ConfigurationListener;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.apache.archiva.repository.base.ArchivaRepositoryRegistry;
import org.apache.archiva.repository.ManagedRepository;
import com.gargoylesoftware.htmlunit.WebClient;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.policies.*;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.server.HttpConnectionFactory;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RemoteRepositoryConfiguration;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.base.ArchivaRepositoryRegistry;
import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin;
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
import org.apache.archiva.common.filelock.FileLockManager;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.provider.FileTypes;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.proxy.ProxyRegistry;
import org.apache.archiva.repository.EditableManagedRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mockito;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.webdav.mock.httpunit.MkColMethodWebRequest;
import org.junit.After;
import org.junit.Before;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.policies.PolicyOption;
import org.apache.archiva.policies.SnapshotsPolicy;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.policies.PolicyOption;
import org.apache.archiva.policies.ReleasesPolicy;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.policies.PolicyOption;
import org.apache.archiva.policies.SnapshotsPolicy;
import org.junit.After;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.model.ProxyConnectorConfiguration;
import org.apache.archiva.policies.PolicyOption;
import org.apache.archiva.policies.SnapshotsPolicy;
import org.junit.After;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
import org.apache.archiva.common.utils.FileUtils;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.RepositoryGroupConfiguration;
import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.commons.lang3.StringUtils;
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.UnauthorizedException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mockito;
import org.springframework.context.ApplicationContext;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import javax.inject.Inject;
import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.repository.ManagedRepository;
import org.junit.Before;
import org.junit.Test;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavServletRequest;
import org.springframework.context.ApplicationContext;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge"/>
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
<bean name="servletAuthenticator" class="org.apache.archiva.webdav.MockServletAuthenticator"/>
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
<bean name="servletAuthenticator" class="org.apache.archiva.webdav.MockServletAuthenticator"/>
- <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+ <bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.provider.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolver;
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import org.apache.archiva.checksum.ChecksumAlgorithm;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.QueryParameter;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.CiManagement;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
import org.apache.archiva.metadata.model.MetadataFacetFactory;
import org.apache.archiva.metadata.repository.AbstractRepositorySessionFactory;
import org.apache.archiva.metadata.repository.MetadataRepository;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.provider.ArchivaConfiguration;
+import org.apache.archiva.configuration.model.Configuration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.model.MetadataFacetFactory;
import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
import org.apache.archiva.metadata.repository.MetadataRepository;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>${jdk.version}</source>
- <target>${jdk.version}</target>
- </configuration>
</plugin>
<!-- Maven Shade Plugin -->
<dependencies>
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
*/
import junit.framework.TestCase;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.model.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.RepositorySession;
</dependency>
<!-- FIXME this deps must be removed -->
<dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.checksum.ChecksummedFile;
-import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.provider.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.archiva</groupId>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.configuration</groupId>
+ <artifactId>archiva-configuration-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva.configuration</groupId>
<artifactId>archiva-configuration</artifactId>
<version>${project.version}</version>
</dependency>