Search in sources :

Example 16 with ProxyConnectorConfiguration

use of org.apache.archiva.configuration.model.ProxyConnectorConfiguration in project archiva by apache.

the class ProxyConnectorConfigurationOrderComparatorTest method createConnector.

private ProxyConnectorConfiguration createConnector(String id, int order) {
    ProxyConnectorConfiguration proxy = new ProxyConnectorConfiguration();
    proxy.setProxyId(id);
    proxy.setOrder(order);
    proxy.setSourceRepoId(id + "_m");
    proxy.setTargetRepoId(id + "_r");
    return proxy;
}
Also used : ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration)

Example 17 with ProxyConnectorConfiguration

use of org.apache.archiva.configuration.model.ProxyConnectorConfiguration in project archiva by apache.

the class ConfigurationRegistryReader method readProxyConnectorConfiguration.

private ProxyConnectorConfiguration readProxyConnectorConfiguration(String prefix, Registry registry) {
    ProxyConnectorConfiguration value = new ProxyConnectorConfiguration();
    int order = registry.getInt(prefix + "order", value.getOrder());
    value.setOrder(order);
    // String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
    List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
    String sourceRepoId = value.getSourceRepoId();
    if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
            sb.append(sourceRepoIdList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        sourceRepoId = sb.toString();
    }
    value.setSourceRepoId(sourceRepoId);
    // String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
    List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
    String targetRepoId = value.getTargetRepoId();
    if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
            sb.append(targetRepoIdList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        targetRepoId = sb.toString();
    }
    value.setTargetRepoId(targetRepoId);
    // String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
    List<String> proxyIdList = registry.getList(prefix + "proxyId");
    String proxyId = value.getProxyId();
    if (proxyIdList != null && !proxyIdList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = proxyIdList.size(); i < size; i++) {
            sb.append(proxyIdList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        proxyId = sb.toString();
    }
    value.setProxyId(proxyId);
    java.util.List blackListPatterns = new java.util.ArrayList();
    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;
}
Also used : List(java.util.List) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration)

Example 18 with ProxyConnectorConfiguration

use of org.apache.archiva.configuration.model.ProxyConnectorConfiguration in project archiva by apache.

the class DefaultArchivaConfiguration method load.

@SuppressWarnings("unchecked")
private Configuration load() {
    // TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties)
    Registry subset = registry.getSubset(KEY);
    if (subset.getString("version") == null) {
        if (subset.getSubset("repositoryScanning").isEmpty()) {
            // only for empty
            subset = readDefaultConfiguration();
        } else {
            throw new RuntimeException("No version tag found in configuration. Archiva configuration version 1.x is not longer supported.");
        }
    }
    Configuration config = new ConfigurationRegistryReader().read(subset);
    // Resolving data and repositories directories
    // If the config entries are absolute, the path is used as it is
    // if the config entries are empty, they are resolved:
    // dataDirectory = ${appserver.base}/data
    // repositoryDirectory = ${dataDirectory}/repositories
    // If the entries are relative they are resolved
    // relative to the appserver.base, for dataDirectory
    // relative to dataDirectory for repositoryBase
    String dataDir = config.getArchivaRuntimeConfiguration().getDataDirectory();
    if (StringUtils.isEmpty(dataDir)) {
        dataDirectory = getAppServerBaseDir().resolve("data");
    } else {
        Path tmpDataDir = Paths.get(dataDir);
        if (tmpDataDir.isAbsolute()) {
            dataDirectory = tmpDataDir;
        } else {
            dataDirectory = getAppServerBaseDir().resolve(tmpDataDir);
        }
    }
    config.getArchivaRuntimeConfiguration().setDataDirectory(dataDirectory.normalize().toString());
    String repoBaseDir = config.getArchivaRuntimeConfiguration().getRepositoryBaseDirectory();
    if (StringUtils.isEmpty(repoBaseDir)) {
        repositoryBaseDirectory = dataDirectory.resolve("repositories");
    } else {
        Path tmpRepoBaseDir = Paths.get(repoBaseDir);
        if (tmpRepoBaseDir.isAbsolute()) {
            repositoryBaseDirectory = tmpRepoBaseDir;
        } else {
            dataDirectory.resolve(tmpRepoBaseDir);
        }
    }
    String remoteRepoBaseDir = config.getArchivaRuntimeConfiguration().getRemoteRepositoryBaseDirectory();
    if (StringUtils.isEmpty(remoteRepoBaseDir)) {
        remoteRepositoryBaseDirectory = dataDirectory.resolve("remotes");
    } else {
        Path tmpRemoteRepoDir = Paths.get(remoteRepoBaseDir);
        if (tmpRemoteRepoDir.isAbsolute()) {
            remoteRepositoryBaseDirectory = tmpRemoteRepoDir;
        } else {
            dataDirectory.resolve(tmpRemoteRepoDir);
        }
    }
    String repositoryGroupBaseDir = config.getArchivaRuntimeConfiguration().getRepositoryGroupBaseDirectory();
    if (StringUtils.isEmpty(repositoryGroupBaseDir)) {
        repositoryGroupBaseDirectory = dataDirectory.resolve("groups");
    } else {
        Path tmpGroupDir = Paths.get(repositoryGroupBaseDir);
        if (tmpGroupDir.isAbsolute()) {
            repositoryGroupBaseDirectory = tmpGroupDir;
        } else {
            dataDirectory.resolve(tmpGroupDir);
        }
    }
    config.getRepositoryGroups();
    config.getRepositoryGroupsAsMap();
    if (!CollectionUtils.isEmpty(config.getRemoteRepositories())) {
        List<RemoteRepositoryConfiguration> remoteRepos = config.getRemoteRepositories();
        for (RemoteRepositoryConfiguration repo : remoteRepos) {
            // [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
            if (StringUtils.isBlank(repo.getUsername())) {
                repo.setUsername(null);
            }
            if (StringUtils.isBlank(repo.getPassword())) {
                repo.setPassword(null);
            }
        }
    }
    if (!config.getProxyConnectors().isEmpty()) {
        // Fix Proxy Connector Settings.
        // Create a copy of the list to read from (to prevent concurrent modification exceptions)
        List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<>(config.getProxyConnectors());
        // Remove the old connector list.
        config.getProxyConnectors().clear();
        for (ProxyConnectorConfiguration connector : proxyConnectorList) {
            // Fix policies
            boolean connectorValid = true;
            Map<String, String> policies = new HashMap<>();
            // Make copy of policies
            policies.putAll(connector.getPolicies());
            // Clear out policies
            connector.getPolicies().clear();
            // Work thru policies. cleaning them up.
            for (Entry<String, String> entry : policies.entrySet()) {
                String policyId = entry.getKey();
                String setting = entry.getValue();
                // Upgrade old policy settings.
                if ("releases".equals(policyId) || "snapshots".equals(policyId)) {
                    if ("ignored".equals(setting)) {
                        setting = AbstractUpdatePolicy.ALWAYS.getId();
                    } else if ("disabled".equals(setting)) {
                        setting = AbstractUpdatePolicy.NEVER.getId();
                    }
                } else if ("cache-failures".equals(policyId)) {
                    if ("ignored".equals(setting)) {
                        setting = CachedFailuresPolicy.NO.getId();
                    } else if ("cached".equals(setting)) {
                        setting = CachedFailuresPolicy.YES.getId();
                    }
                } else if ("checksum".equals(policyId)) {
                    if ("ignored".equals(setting)) {
                        setting = ChecksumPolicy.IGNORE.getId();
                    }
                }
                // Validate existance of policy key.
                connector.addPolicy(policyId, setting);
            }
            if (connectorValid) {
                config.addProxyConnector(connector);
            }
        }
        // Normalize the order fields in the proxy connectors.
        Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = config.getProxyConnectorAsMap();
        for (List<ProxyConnectorConfiguration> connectors : proxyConnectorMap.values()) {
            // Sort connectors by order field.
            Collections.sort(connectors, ProxyConnectorConfigurationOrderComparator.getInstance());
            // Normalize the order field values.
            int order = 1;
            for (ProxyConnectorConfiguration connector : connectors) {
                connector.setOrder(order++);
            }
        }
    }
    this.defaultLocale = Locale.forLanguageTag(config.getArchivaRuntimeConfiguration().getDefaultLanguage());
    this.languagePriorities = Locale.LanguageRange.parse(config.getArchivaRuntimeConfiguration().getLanguageRange());
    return config;
}
Also used : Path(java.nio.file.Path) RepositoryCheckPath(org.apache.archiva.configuration.model.RepositoryCheckPath) ManagedRepositoryConfiguration(org.apache.archiva.configuration.model.ManagedRepositoryConfiguration) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration) Configuration(org.apache.archiva.configuration.model.Configuration) RemoteRepositoryConfiguration(org.apache.archiva.configuration.model.RemoteRepositoryConfiguration) ConfigurationRegistryReader(org.apache.archiva.configuration.provider.io.registry.ConfigurationRegistryReader) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration) CommonsConfigurationRegistry(org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry) Registry(org.apache.archiva.components.registry.Registry) RemoteRepositoryConfiguration(org.apache.archiva.configuration.model.RemoteRepositoryConfiguration) ArrayList(java.util.ArrayList) List(java.util.List)

Example 19 with ProxyConnectorConfiguration

use of org.apache.archiva.configuration.model.ProxyConnectorConfiguration in project archiva by apache.

the class ConfigurationRegistryReader method readConfiguration.

private Configuration readConfiguration(String prefix, Registry registry) {
    Configuration value = new Configuration();
    // String version = registry.getString( prefix + "version", value.getVersion() );
    List<String> versionList = registry.getList(prefix + "version");
    String version = value.getVersion();
    if (versionList != null && !versionList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = versionList.size(); i < size; i++) {
            sb.append(versionList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        version = sb.toString();
    }
    value.setVersion(version);
    // String metadataStore = registry.getString( prefix + "metadataStore", value.getMetadataStore() );
    List<String> metadataStoreList = registry.getList(prefix + "metadataStore");
    String metadataStore = value.getMetadataStore();
    if (metadataStoreList != null && !metadataStoreList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = metadataStoreList.size(); i < size; i++) {
            sb.append(metadataStoreList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        metadataStore = sb.toString();
    }
    value.setMetadataStore(metadataStore);
    java.util.List repositoryGroups = new java.util.ArrayList();
    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;
}
Also used : RepositoryGroupConfiguration(org.apache.archiva.configuration.model.RepositoryGroupConfiguration) LdapConfiguration(org.apache.archiva.configuration.model.LdapConfiguration) ManagedRepositoryConfiguration(org.apache.archiva.configuration.model.ManagedRepositoryConfiguration) NetworkConfiguration(org.apache.archiva.configuration.model.NetworkConfiguration) RedbackRuntimeConfiguration(org.apache.archiva.configuration.model.RedbackRuntimeConfiguration) AbstractRepositoryConfiguration(org.apache.archiva.configuration.model.AbstractRepositoryConfiguration) ArchivaRuntimeConfiguration(org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration) AbstractRepositoryConnectorConfiguration(org.apache.archiva.configuration.model.AbstractRepositoryConnectorConfiguration) FileLockConfiguration(org.apache.archiva.configuration.model.FileLockConfiguration) RepositoryGroupConfiguration(org.apache.archiva.configuration.model.RepositoryGroupConfiguration) CacheConfiguration(org.apache.archiva.configuration.model.CacheConfiguration) Configuration(org.apache.archiva.configuration.model.Configuration) RepositoryScanningConfiguration(org.apache.archiva.configuration.model.RepositoryScanningConfiguration) RemoteRepositoryConfiguration(org.apache.archiva.configuration.model.RemoteRepositoryConfiguration) SyncConnectorConfiguration(org.apache.archiva.configuration.model.SyncConnectorConfiguration) ArchivaDefaultConfiguration(org.apache.archiva.configuration.model.ArchivaDefaultConfiguration) WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) NetworkProxyConfiguration(org.apache.archiva.configuration.model.NetworkProxyConfiguration) ProxyConnectorRuleConfiguration(org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration) ManagedRepositoryConfiguration(org.apache.archiva.configuration.model.ManagedRepositoryConfiguration) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration) WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) ProxyConnectorRuleConfiguration(org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration) Iterator(java.util.Iterator) NetworkProxyConfiguration(org.apache.archiva.configuration.model.NetworkProxyConfiguration) List(java.util.List) NetworkConfiguration(org.apache.archiva.configuration.model.NetworkConfiguration) ArchivaDefaultConfiguration(org.apache.archiva.configuration.model.ArchivaDefaultConfiguration) ArchivaRuntimeConfiguration(org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration) List(java.util.List) LegacyArtifactPath(org.apache.archiva.configuration.model.LegacyArtifactPath) OrganisationInformation(org.apache.archiva.configuration.model.OrganisationInformation) RemoteRepositoryConfiguration(org.apache.archiva.configuration.model.RemoteRepositoryConfiguration) RepositoryScanningConfiguration(org.apache.archiva.configuration.model.RepositoryScanningConfiguration) RedbackRuntimeConfiguration(org.apache.archiva.configuration.model.RedbackRuntimeConfiguration)

Example 20 with ProxyConnectorConfiguration

use of org.apache.archiva.configuration.model.ProxyConnectorConfiguration in project archiva by apache.

the class ConfigurationRegistryWriter method writeConfiguration.

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);
        }
    }
}
Also used : RepositoryGroupConfiguration(org.apache.archiva.configuration.model.RepositoryGroupConfiguration) LegacyArtifactPath(org.apache.archiva.configuration.model.LegacyArtifactPath) ManagedRepositoryConfiguration(org.apache.archiva.configuration.model.ManagedRepositoryConfiguration) ProxyConnectorRuleConfiguration(org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration) Iterator(java.util.Iterator) NetworkProxyConfiguration(org.apache.archiva.configuration.model.NetworkProxyConfiguration) RemoteRepositoryConfiguration(org.apache.archiva.configuration.model.RemoteRepositoryConfiguration) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration)

Aggregations

ProxyConnectorConfiguration (org.apache.archiva.configuration.model.ProxyConnectorConfiguration)35 ArrayList (java.util.ArrayList)11 Configuration (org.apache.archiva.configuration.model.Configuration)11 ManagedRepositoryConfiguration (org.apache.archiva.configuration.model.ManagedRepositoryConfiguration)9 RemoteRepositoryConfiguration (org.apache.archiva.configuration.model.RemoteRepositoryConfiguration)9 Path (java.nio.file.Path)6 ProxyConnectorRuleConfiguration (org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration)6 ProxyConnector (org.apache.archiva.admin.model.beans.ProxyConnector)5 Iterator (java.util.Iterator)4 List (java.util.List)4 NetworkProxyConfiguration (org.apache.archiva.configuration.model.NetworkProxyConfiguration)4 RepositoryGroupConfiguration (org.apache.archiva.configuration.model.RepositoryGroupConfiguration)4 Wagon (org.apache.maven.wagon.Wagon)4 Before (org.junit.Before)4 ContextConfiguration (org.springframework.test.context.ContextConfiguration)4 RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)3 LegacyArtifactPath (org.apache.archiva.configuration.model.LegacyArtifactPath)3 RepositoryScanningConfiguration (org.apache.archiva.configuration.model.RepositoryScanningConfiguration)3 ArchivaConfiguration (org.apache.archiva.configuration.provider.ArchivaConfiguration)3 WagonFactory (org.apache.archiva.maven.common.proxy.WagonFactory)3