Search in sources :

Example 6 with ProxyConnectorRule

use of org.apache.archiva.admin.model.beans.ProxyConnectorRule in project archiva by apache.

the class DefaultProxyConnectorRuleAdmin method getProxyConnectorRules.

@Override
public List<ProxyConnectorRule> getProxyConnectorRules() throws RepositoryAdminException {
    List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations = getArchivaConfiguration().getConfiguration().getProxyConnectorRuleConfigurations();
    if (proxyConnectorRuleConfigurations.isEmpty()) {
        return Collections.emptyList();
    }
    List<ProxyConnectorRule> proxyConnectorRules = new ArrayList<>(proxyConnectorRuleConfigurations.size());
    for (ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration : proxyConnectorRuleConfigurations) {
        ProxyConnectorRule proxyConnectorRule = new ProxyConnectorRule();
        proxyConnectorRule.setPattern(proxyConnectorRuleConfiguration.getPattern());
        proxyConnectorRule.setProxyConnectorRuleType(getProxyConnectorRuleType(proxyConnectorRuleConfiguration.getRuleType()));
        for (ProxyConnectorConfiguration proxyConnectorConfiguration : proxyConnectorRuleConfiguration.getProxyConnectors()) {
            ProxyConnector proxyConnector = new ProxyConnector();
            proxyConnector.setSourceRepoId(proxyConnectorConfiguration.getSourceRepoId());
            proxyConnector.setTargetRepoId(proxyConnectorConfiguration.getTargetRepoId());
            proxyConnectorRule.getProxyConnectors().add(proxyConnector);
        }
        proxyConnectorRules.add(proxyConnectorRule);
    }
    return proxyConnectorRules;
}
Also used : ProxyConnectorRuleConfiguration(org.apache.archiva.configuration.ProxyConnectorRuleConfiguration) ProxyConnectorRule(org.apache.archiva.admin.model.beans.ProxyConnectorRule) ArrayList(java.util.ArrayList) ProxyConnectorConfiguration(org.apache.archiva.configuration.ProxyConnectorConfiguration) ProxyConnector(org.apache.archiva.admin.model.beans.ProxyConnector)

Aggregations

ProxyConnectorRule (org.apache.archiva.admin.model.beans.ProxyConnectorRule)6 ProxyConnector (org.apache.archiva.admin.model.beans.ProxyConnector)5 Test (org.junit.Test)4 AbstractRepositoryAdminTest (org.apache.archiva.admin.repository.AbstractRepositoryAdminTest)3 RemoteRepository (org.apache.archiva.admin.model.beans.RemoteRepository)2 ArrayList (java.util.ArrayList)1 ProxyConnectorConfiguration (org.apache.archiva.configuration.ProxyConnectorConfiguration)1 ProxyConnectorRuleConfiguration (org.apache.archiva.configuration.ProxyConnectorRuleConfiguration)1 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)1 ProxyConnectorRuleService (org.apache.archiva.rest.api.services.ProxyConnectorRuleService)1