From 790e38f5ec27d5cd6da8502b52d9750a169b3e4d Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Mon, 11 Feb 2019 17:42:11 +0100 Subject: [PATCH] Deactivating code generation. Moving generated code to src tree. Adding licensing part to files --- .../archiva-configuration/pom.xml | 42 - .../AbstractRepositoryConfiguration.java | 262 +++ ...tractRepositoryConnectorConfiguration.java | 359 +++ .../ArchivaDefaultConfiguration.java | 93 + .../ArchivaRuntimeConfiguration.java | 236 ++ .../configuration/CacheConfiguration.java | 141 ++ .../archiva/configuration/Configuration.java | 845 +++++++ .../configuration/FileLockConfiguration.java | 91 + .../archiva/configuration/FileType.java | 146 ++ .../configuration/LdapConfiguration.java | 384 ++++ .../configuration/LdapGroupMapping.java | 116 + .../configuration/LegacyArtifactPath.java | 158 ++ .../ManagedRepositoryConfiguration.java | 353 +++ .../configuration/NetworkConfiguration.java | 119 + .../NetworkProxyConfiguration.java | 259 +++ .../OrganisationInformation.java | 118 + .../ProxyConnectorConfiguration.java | 120 + .../ProxyConnectorRuleConfiguration.java | 147 ++ .../RedbackRuntimeConfiguration.java | 341 +++ .../RemoteRepositoryConfiguration.java | 452 ++++ .../configuration/RepositoryCheckPath.java | 96 + .../RepositoryGroupConfiguration.java | 198 ++ .../RepositoryScanningConfiguration.java | 191 ++ .../SyncConnectorConfiguration.java | 95 + .../configuration/UserInterfaceOptions.java | 170 ++ .../configuration/WebappConfiguration.java | 68 + .../registry/ConfigurationRegistryReader.java | 1944 +++++++++++++++++ .../registry/ConfigurationRegistryWriter.java | 1335 +++++++++++ 28 files changed, 8837 insertions(+), 42 deletions(-) create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConnectorConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaDefaultConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaRuntimeConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/CacheConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/Configuration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileLockConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileType.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapGroupMapping.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LegacyArtifactPath.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ManagedRepositoryConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkProxyConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/OrganisationInformation.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorRuleConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RedbackRuntimeConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RemoteRepositoryConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryCheckPath.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryScanningConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/SyncConnectorConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/UserInterfaceOptions.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/WebappConfiguration.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java create mode 100644 archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index e03bebe1d..75690291a 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -147,48 +147,6 @@ - - org.codehaus.modello - modello-maven-plugin - - - - java - - - - archiva-registry-reader - - generate - - - registry-reader - - - - archiva-registry-writer - - generate - - - registry-writer - - - - site-docs - pre-site - - xdoc - - - - - 3.0.0 - - src/main/mdo/configuration.mdo - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConfiguration.java new file mode 100644 index 000000000..695f0c0c2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConfiguration.java @@ -0,0 +1,262 @@ +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; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConnectorConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConnectorConfiguration.java new file mode 100644 index 000000000..22a4bc6a1 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/AbstractRepositoryConnectorConfiguration.java @@ -0,0 +1,359 @@ +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 blackListPatterns; + + /** + * Field whiteListPatterns. + */ + private java.util.List 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( Object key, String value ) + { + getPolicies().put( key, value ); + } //-- void addPolicy( Object, String ) + + /** + * Method addProperty. + * + * @param key + * @param value + */ + public void addProperty( Object 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 getBlackListPatterns() + { + if ( this.blackListPatterns == null ) + { + this.blackListPatterns = new java.util.ArrayList(); + } + + return this.blackListPatterns; + } //-- java.util.List getBlackListPatterns() + + /** + * Method getPolicies. + * + * @return Map + */ + public java.util.Map 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 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 getWhiteListPatterns() + { + if ( this.whiteListPatterns == null ) + { + this.whiteListPatterns = new java.util.ArrayList(); + } + + return this.whiteListPatterns; + } //-- java.util.List 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 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 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; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaDefaultConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaDefaultConfiguration.java new file mode 100644 index 000000000..3917cc8f0 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaDefaultConfiguration.java @@ -0,0 +1,93 @@ +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 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 getDefaultCheckPaths() + { + if ( this.defaultCheckPaths == null ) + { + this.defaultCheckPaths = new java.util.ArrayList(); + } + + return this.defaultCheckPaths; + } //-- java.util.List 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 defaultCheckPaths ) + { + this.defaultCheckPaths = defaultCheckPaths; + } //-- void setDefaultCheckPaths( java.util.List ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaRuntimeConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaRuntimeConfiguration.java new file mode 100644 index 000000000..7d6f5d38a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaRuntimeConfiguration.java @@ -0,0 +1,236 @@ +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 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 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"; + + + //-----------/ + //- 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 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 ) + + /** + * Set the url failure cache configuration. + * + * @param urlFailureCacheConfiguration + */ + public void setUrlFailureCacheConfiguration( CacheConfiguration urlFailureCacheConfiguration ) + { + this.urlFailureCacheConfiguration = urlFailureCacheConfiguration; + } //-- void setUrlFailureCacheConfiguration( CacheConfiguration ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/CacheConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/CacheConfiguration.java new file mode 100644 index 000000000..5d765edde --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/CacheConfiguration.java @@ -0,0 +1,141 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/Configuration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/Configuration.java new file mode 100644 index 000000000..4d62e81ea --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/Configuration.java @@ -0,0 +1,845 @@ +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 repositoryGroups; + + /** + * Field managedRepositories. + */ + private java.util.List managedRepositories; + + /** + * Field remoteRepositories. + */ + private java.util.List remoteRepositories; + + /** + * Field proxyConnectors. + */ + private java.util.List proxyConnectors; + + /** + * Field networkProxies. + */ + private java.util.List networkProxies; + + /** + * Field legacyArtifactPaths. + */ + private java.util.List 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 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 getLegacyArtifactPaths() + { + if ( this.legacyArtifactPaths == null ) + { + this.legacyArtifactPaths = new java.util.ArrayList(); + } + + return this.legacyArtifactPaths; + } //-- java.util.List getLegacyArtifactPaths() + + /** + * Method getManagedRepositories. + * + * @return List + */ + public java.util.List getManagedRepositories() + { + if ( this.managedRepositories == null ) + { + this.managedRepositories = new java.util.ArrayList(); + } + + return this.managedRepositories; + } //-- java.util.List 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 getNetworkProxies() + { + if ( this.networkProxies == null ) + { + this.networkProxies = new java.util.ArrayList(); + } + + return this.networkProxies; + } //-- java.util.List getNetworkProxies() + + /** + * Get the organisation info. + * + * @return OrganisationInformation + */ + public OrganisationInformation getOrganisationInfo() + { + return this.organisationInfo; + } //-- OrganisationInformation getOrganisationInfo() + + /** + * Method getProxyConnectorRuleConfigurations. + * + * @return List + */ + public java.util.List getProxyConnectorRuleConfigurations() + { + if ( this.proxyConnectorRuleConfigurations == null ) + { + this.proxyConnectorRuleConfigurations = new java.util.ArrayList(); + } + + return this.proxyConnectorRuleConfigurations; + } //-- java.util.List getProxyConnectorRuleConfigurations() + + /** + * Method getProxyConnectors. + * + * @return List + */ + public java.util.List getProxyConnectors() + { + if ( this.proxyConnectors == null ) + { + this.proxyConnectors = new java.util.ArrayList(); + } + + return this.proxyConnectors; + } //-- java.util.List getProxyConnectors() + + /** + * Get the RedbackRuntimeConfiguration. + * + * @return RedbackRuntimeConfiguration + */ + public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration() + { + return this.redbackRuntimeConfiguration; + } //-- RedbackRuntimeConfiguration getRedbackRuntimeConfiguration() + + /** + * Method getRemoteRepositories. + * + * @return List + */ + public java.util.List getRemoteRepositories() + { + if ( this.remoteRepositories == null ) + { + this.remoteRepositories = new java.util.ArrayList(); + } + + return this.remoteRepositories; + } //-- java.util.List getRemoteRepositories() + + /** + * Method getRepositoryGroups. + * + * @return List + */ + public java.util.List getRepositoryGroups() + { + if ( this.repositoryGroups == null ) + { + this.repositoryGroups = new java.util.ArrayList(); + } + + return this.repositoryGroups; + } //-- java.util.List 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 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 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 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 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 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 remoteRepositories ) + { + this.remoteRepositories = remoteRepositories; + } //-- void setRemoteRepositories( java.util.List ) + + /** + * Set the list of repository groups. + * + * @param repositoryGroups + */ + public void setRepositoryGroups( java.util.List 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> repositoryToGroupMap; + + public java.util.Map> getRepositoryToGroupMap() + { + if ( repositoryGroups != null ) + { + java.util.Map> map = new java.util.HashMap>(); + + for ( RepositoryGroupConfiguration group : (java.util.List) repositoryGroups ) + { + for ( String repositoryId : (java.util.List) group.getRepositories() ) + { + java.util.List groups = map.get( repositoryId ); + if ( groups == null ) + { + groups = new java.util.ArrayList(); + map.put( repositoryId, groups ); + } + groups.add( group.getId() ); + } + } + + repositoryToGroupMap = map; + } + return repositoryToGroupMap; + } + + public java.util.Map getRepositoryGroupsAsMap() + { + java.util.Map map = new java.util.HashMap(); + if ( repositoryGroups != null ) + { + for ( RepositoryGroupConfiguration group : (java.util.List) repositoryGroups ) + { + map.put( group.getId(), group ); + } + } + return map; + } + + public RepositoryGroupConfiguration findRepositoryGroupById( String id ) + { + if ( repositoryGroups != null ) + { + for ( RepositoryGroupConfiguration group : (java.util.List) repositoryGroups ) + { + if ( group.getId().equals( id ) ) + { + return group; + } + } + } + return null; + } + + private java.util.Map> groupToRepositoryMap; + + public java.util.Map> getGroupToRepositoryMap() + { + if ( repositoryGroups != null && managedRepositories != null ) + { + java.util.Map> map = new java.util.HashMap>(); + + for ( ManagedRepositoryConfiguration repo : (java.util.List) managedRepositories ) + { + for ( RepositoryGroupConfiguration group : (java.util.List) repositoryGroups ) + { + if ( !group.getRepositories().contains( repo.getId() ) ) + { + String groupId = group.getId(); + java.util.List repos = map.get( groupId ); + if ( repos == null ) + { + repos = new java.util.ArrayList(); + map.put( groupId, repos ); + } + repos.add( repo.getId() ); + } + } + } + groupToRepositoryMap = map; + } + return groupToRepositoryMap; + } + + + public java.util.Map getNetworkProxiesAsMap() + { + java.util.Map map = new java.util.HashMap(); + if ( networkProxies != null ) + { + for ( java.util.Iterator i = networkProxies.iterator(); i.hasNext(); ) + { + NetworkProxyConfiguration proxy = i.next(); + map.put( proxy.getId(), proxy ); + } + } + return map; + } + + public java.util.Map> getProxyConnectorAsMap() + { + java.util.Map> proxyConnectorMap = + new java.util.HashMap>(); + + if( proxyConnectors != null ) + { + java.util.Iterator it = proxyConnectors.iterator(); + while ( it.hasNext() ) + { + ProxyConnectorConfiguration proxyConfig = it.next(); + String key = proxyConfig.getSourceRepoId(); + + java.util.List connectors = proxyConnectorMap.get( key ); + if ( connectors == null ) + { + connectors = new java.util.ArrayList(); + 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 getRemoteRepositoriesAsMap() + { + java.util.Map map = new java.util.HashMap(); + if ( remoteRepositories != null ) + { + for ( java.util.Iterator 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 i = remoteRepositories.iterator(); i.hasNext(); ) + { + RemoteRepositoryConfiguration repo = i.next(); + if ( repo.getId().equals( id ) ) + { + return repo; + } + } + } + return null; + } + + public java.util.Map getManagedRepositoriesAsMap() + { + java.util.Map map = new java.util.HashMap(); + if ( managedRepositories != null ) + { + for ( java.util.Iterator 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 i = managedRepositories.iterator(); i.hasNext(); ) + { + ManagedRepositoryConfiguration repo = i.next(); + if ( repo.getId().equals( id ) ) + { + return repo; + } + } + } + return null; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileLockConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileLockConfiguration.java new file mode 100644 index 000000000..259e3b85a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileLockConfiguration.java @@ -0,0 +1,91 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileType.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileType.java new file mode 100644 index 000000000..d3930c1c1 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileType.java @@ -0,0 +1,146 @@ +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 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 getPatterns() + { + if ( this.patterns == null ) + { + this.patterns = new java.util.ArrayList(); + } + + return this.patterns; + } //-- java.util.List 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 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; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapConfiguration.java new file mode 100644 index 000000000..5541c7310 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapConfiguration.java @@ -0,0 +1,384 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapGroupMapping.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapGroupMapping.java new file mode 100644 index 000000000..05288c148 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LdapGroupMapping.java @@ -0,0 +1,116 @@ +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 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 getRoleNames() + { + if ( this.roleNames == null ) + { + this.roleNames = new java.util.ArrayList(); + } + + return this.roleNames; + } //-- java.util.List 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 roleNames ) + { + this.roleNames = roleNames; + } //-- void setRoleNames( java.util.List ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LegacyArtifactPath.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LegacyArtifactPath.java new file mode 100644 index 000000000..695245fdc --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/LegacyArtifactPath.java @@ -0,0 +1,158 @@ +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; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ManagedRepositoryConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ManagedRepositoryConfiguration.java new file mode 100644 index 000000000..a8da04d6d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ManagedRepositoryConfiguration.java @@ -0,0 +1,353 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkConfiguration.java new file mode 100644 index 000000000..a7eacec7e --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkConfiguration.java @@ -0,0 +1,119 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkProxyConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkProxyConfiguration.java new file mode 100644 index 000000000..234ef8a75 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/NetworkProxyConfiguration.java @@ -0,0 +1,259 @@ +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; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/OrganisationInformation.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/OrganisationInformation.java new file mode 100644 index 000000000..a7f7fb62f --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/OrganisationInformation.java @@ -0,0 +1,118 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorConfiguration.java new file mode 100644 index 000000000..944c8b670 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorConfiguration.java @@ -0,0 +1,120 @@ +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"; + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorRuleConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorRuleConfiguration.java new file mode 100644 index 000000000..3340e0563 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ProxyConnectorRuleConfiguration.java @@ -0,0 +1,147 @@ +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 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 getProxyConnectors() + { + if ( this.proxyConnectors == null ) + { + this.proxyConnectors = new java.util.ArrayList(); + } + + return this.proxyConnectors; + } //-- java.util.List 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 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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RedbackRuntimeConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RedbackRuntimeConfiguration.java new file mode 100644 index 000000000..2c8992926 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RedbackRuntimeConfiguration.java @@ -0,0 +1,341 @@ +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 userManagerImpls; + + /** + * Field rbacManagerImpls. + */ + private java.util.List rbacManagerImpls; + + /** + * the ldap configuration. + */ + private LdapConfiguration ldapConfiguration; + + /** + * Field ldapGroupMappings. + */ + private java.util.List 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 getLdapGroupMappings() + { + if ( this.ldapGroupMappings == null ) + { + this.ldapGroupMappings = new java.util.ArrayList(); + } + + return this.ldapGroupMappings; + } //-- java.util.List getLdapGroupMappings() + + /** + * Method getRbacManagerImpls. + * + * @return List + */ + public java.util.List getRbacManagerImpls() + { + if ( this.rbacManagerImpls == null ) + { + this.rbacManagerImpls = new java.util.ArrayList(); + } + + return this.rbacManagerImpls; + } //-- java.util.List getRbacManagerImpls() + + /** + * Method getUserManagerImpls. + * + * @return List + */ + public java.util.List getUserManagerImpls() + { + if ( this.userManagerImpls == null ) + { + this.userManagerImpls = new java.util.ArrayList(); + } + + return this.userManagerImpls; + } //-- java.util.List 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 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 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 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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RemoteRepositoryConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RemoteRepositoryConfiguration.java new file mode 100644 index 000000000..ca49d315c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RemoteRepositoryConfiguration.java @@ -0,0 +1,452 @@ +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() +"'"; + } + + + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryCheckPath.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryCheckPath.java new file mode 100644 index 000000000..27f766052 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryCheckPath.java @@ -0,0 +1,96 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java new file mode 100644 index 000000000..826fc5063 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java @@ -0,0 +1,198 @@ +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 RepositoryGroupConfiguration. + * + * @version $Revision$ $Date$ + */ +@SuppressWarnings( "all" ) +public class RepositoryGroupConfiguration + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The id of the repository group. + */ + private String id; + + /** + * 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. + * No default value. + * + */ + private String cronExpression = ""; + + /** + * Field repositories. + */ + private java.util.List repositories; + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * 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 java.util.List getRepositories() + { + if ( this.repositories == null ) + { + this.repositories = new java.util.ArrayList(); + } + + return this.repositories; + } //-- java.util.List 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( java.util.List repositories ) + { + this.repositories = repositories; + } //-- void setRepositories( java.util.List ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryScanningConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryScanningConfiguration.java new file mode 100644 index 000000000..976eb345a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryScanningConfiguration.java @@ -0,0 +1,191 @@ +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 fileTypes; + + /** + * Field knownContentConsumers. + */ + private java.util.List knownContentConsumers; + + /** + * Field invalidContentConsumers. + */ + private java.util.List 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 getFileTypes() + { + if ( this.fileTypes == null ) + { + this.fileTypes = new java.util.ArrayList(); + } + + return this.fileTypes; + } //-- java.util.List getFileTypes() + + /** + * Method getInvalidContentConsumers. + * + * @return List + */ + public java.util.List getInvalidContentConsumers() + { + if ( this.invalidContentConsumers == null ) + { + this.invalidContentConsumers = new java.util.ArrayList(); + } + + return this.invalidContentConsumers; + } //-- java.util.List getInvalidContentConsumers() + + /** + * Method getKnownContentConsumers. + * + * @return List + */ + public java.util.List getKnownContentConsumers() + { + if ( this.knownContentConsumers == null ) + { + this.knownContentConsumers = new java.util.ArrayList(); + } + + return this.knownContentConsumers; + } //-- java.util.List 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 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 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 knownContentConsumers ) + { + this.knownContentConsumers = knownContentConsumers; + } //-- void setKnownContentConsumers( java.util.List ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/SyncConnectorConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/SyncConnectorConfiguration.java new file mode 100644 index 000000000..a4f8ff901 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/SyncConnectorConfiguration.java @@ -0,0 +1,95 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/UserInterfaceOptions.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/UserInterfaceOptions.java new file mode 100644 index 000000000..8d8476646 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/UserInterfaceOptions.java @@ -0,0 +1,170 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/WebappConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/WebappConfiguration.java new file mode 100644 index 000000000..aab3660c6 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/WebappConfiguration.java @@ -0,0 +1,68 @@ +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 ) + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java new file mode 100644 index 000000000..102c40333 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java @@ -0,0 +1,1944 @@ + +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.redback.components.registry.Registry; + +// Util imports +import java.util.*; + +// Model class imports +import org.apache.archiva.configuration.Configuration; +import org.apache.archiva.configuration.AbstractRepositoryConfiguration; +import org.apache.archiva.configuration.RemoteRepositoryConfiguration; +import org.apache.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.archiva.configuration.LegacyArtifactPath; +import org.apache.archiva.configuration.RepositoryGroupConfiguration; +import org.apache.archiva.configuration.RepositoryCheckPath; +import org.apache.archiva.configuration.AbstractRepositoryConnectorConfiguration; +import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration; +import org.apache.archiva.configuration.ProxyConnectorConfiguration; +import org.apache.archiva.configuration.SyncConnectorConfiguration; +import org.apache.archiva.configuration.NetworkProxyConfiguration; +import org.apache.archiva.configuration.RepositoryScanningConfiguration; +import org.apache.archiva.configuration.FileType; +import org.apache.archiva.configuration.OrganisationInformation; +import org.apache.archiva.configuration.WebappConfiguration; +import org.apache.archiva.configuration.UserInterfaceOptions; +import org.apache.archiva.configuration.NetworkConfiguration; +import org.apache.archiva.configuration.ArchivaRuntimeConfiguration; +import org.apache.archiva.configuration.RedbackRuntimeConfiguration; +import org.apache.archiva.configuration.ArchivaDefaultConfiguration; +import org.apache.archiva.configuration.LdapConfiguration; +import org.apache.archiva.configuration.FileLockConfiguration; +import org.apache.archiva.configuration.CacheConfiguration; +import org.apache.archiva.configuration.LdapGroupMapping; + + + + +/** + * 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 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 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*/(); + 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/**/(); + 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/**/(); + 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/**/(); + 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/**/(); + 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/**/(); + 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/**/(); + 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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*/(); + 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 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 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 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 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 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*/(); + blackListPatterns.addAll( registry.getList( prefix + "blackListPatterns.blackListPattern" ) ); + value.setBlackListPatterns( blackListPatterns ); + java.util.List whiteListPatterns = new java.util.ArrayList/**/(); + 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 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 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*/(); + 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 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 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 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*/(); + blackListPatterns.addAll( registry.getList( prefix + "blackListPatterns.blackListPattern" ) ); + value.setBlackListPatterns( blackListPatterns ); + java.util.List whiteListPatterns = new java.util.ArrayList/**/(); + 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 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 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 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 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 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*/(); + blackListPatterns.addAll( registry.getList( prefix + "blackListPatterns.blackListPattern" ) ); + value.setBlackListPatterns( blackListPatterns ); + java.util.List whiteListPatterns = new java.util.ArrayList/**/(); + 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 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 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 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 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 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*/(); + 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/**/(); + knownContentConsumers.addAll( registry.getList( prefix + "knownContentConsumers.knownContentConsumer" ) ); + value.setKnownContentConsumers( knownContentConsumers ); + java.util.List invalidContentConsumers = new java.util.ArrayList/**/(); + 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 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*/(); + 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 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 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 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 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 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 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 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 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 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*/(); + userManagerImpls.addAll( registry.getList( prefix + "userManagerImpls.userManagerImpl" ) ); + value.setUserManagerImpls( userManagerImpls ); + java.util.List rbacManagerImpls = new java.util.ArrayList/**/(); + 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/**/(); + 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/**/(); + 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 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 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 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 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 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 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 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 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*/(); + roleNames.addAll( registry.getList( prefix + "roleNames.roleName" ) ); + value.setRoleNames( roleNames ); + + return value; + } + +} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java new file mode 100644 index 000000000..ce696ebe6 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java @@ -0,0 +1,1335 @@ + +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.redback.components.registry.Registry; + +// Util imports +import java.util.*; + +// Model class imports +import org.apache.archiva.configuration.Configuration; +import org.apache.archiva.configuration.AbstractRepositoryConfiguration; +import org.apache.archiva.configuration.RemoteRepositoryConfiguration; +import org.apache.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.archiva.configuration.LegacyArtifactPath; +import org.apache.archiva.configuration.RepositoryGroupConfiguration; +import org.apache.archiva.configuration.RepositoryCheckPath; +import org.apache.archiva.configuration.AbstractRepositoryConnectorConfiguration; +import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration; +import org.apache.archiva.configuration.ProxyConnectorConfiguration; +import org.apache.archiva.configuration.SyncConnectorConfiguration; +import org.apache.archiva.configuration.NetworkProxyConfiguration; +import org.apache.archiva.configuration.RepositoryScanningConfiguration; +import org.apache.archiva.configuration.FileType; +import org.apache.archiva.configuration.OrganisationInformation; +import org.apache.archiva.configuration.WebappConfiguration; +import org.apache.archiva.configuration.UserInterfaceOptions; +import org.apache.archiva.configuration.NetworkConfiguration; +import org.apache.archiva.configuration.ArchivaRuntimeConfiguration; +import org.apache.archiva.configuration.RedbackRuntimeConfiguration; +import org.apache.archiva.configuration.ArchivaDefaultConfiguration; +import org.apache.archiva.configuration.LdapConfiguration; +import org.apache.archiva.configuration.FileLockConfiguration; +import org.apache.archiva.configuration.CacheConfiguration; +import org.apache.archiva.configuration.LdapGroupMapping; + + + + +/** + * Generate Plexus Registry output mechanism for model 'Configuration'. + */ +public class ConfigurationRegistryWriter +{ + public void write( Configuration model, Registry registry ) + { + writeConfiguration( "", model, registry ); + } + + 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.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.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() ); + } + } + } + + 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 -- 2.39.5