use of org.apache.archiva.configuration.Configuration in project archiva by apache.
the class DefaultProxyConnectorAdmin method updateProxyConnector.
// FIXME care take of proxyConnectorRules !
@Override
public Boolean updateProxyConnector(ProxyConnector proxyConnector, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
ProxyConnectorConfiguration proxyConnectorConfiguration = findProxyConnector(proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId(), configuration);
configuration.removeProxyConnector(proxyConnectorConfiguration);
configuration.addProxyConnector(getProxyConnectorConfiguration(proxyConnector));
saveConfiguration(configuration);
triggerAuditEvent(proxyConnector.getSourceRepoId() + "-" + proxyConnector.getTargetRepoId(), null, AuditEvent.MODIFY_PROXY_CONNECTOR, auditInformation);
return Boolean.TRUE;
}
use of org.apache.archiva.configuration.Configuration in project archiva by apache.
the class DefaultProxyConnectorRuleAdmin method deleteProxyConnectorRule.
@Override
public void deleteProxyConnectorRule(ProxyConnectorRule proxyConnectorRule, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
// key is the pattern !!
// recreate a list without the pattern
boolean toSave = false;
List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations = new ArrayList<>();
for (ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration : configuration.getProxyConnectorRuleConfigurations()) {
if (StringUtils.equals(proxyConnectorRuleConfiguration.getPattern(), proxyConnectorRule.getPattern()) && StringUtils.equals(proxyConnectorRuleConfiguration.getRuleType(), proxyConnectorRule.getProxyConnectorRuleType().getRuleType())) {
toSave = true;
} else {
proxyConnectorRuleConfigurations.add(proxyConnectorRuleConfiguration);
}
}
if (toSave) {
configuration.setProxyConnectorRuleConfigurations(proxyConnectorRuleConfigurations);
saveConfiguration(configuration);
}
}
use of org.apache.archiva.configuration.Configuration in project archiva by apache.
the class DefaultProxyConnectorRuleAdmin method addProxyConnectorRule.
@Override
public void addProxyConnectorRule(ProxyConnectorRule proxyConnectorRule, AuditInformation auditInformation) throws RepositoryAdminException {
ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration = new ProxyConnectorRuleConfiguration();
proxyConnectorRuleConfiguration.setPattern(proxyConnectorRule.getPattern());
proxyConnectorRuleConfiguration.setRuleType(proxyConnectorRule.getProxyConnectorRuleType().getRuleType());
for (ProxyConnector proxyConnector : proxyConnectorRule.getProxyConnectors()) {
ProxyConnectorConfiguration proxyConnectorConfiguration = new ProxyConnectorConfiguration();
proxyConnectorConfiguration.setSourceRepoId(proxyConnector.getSourceRepoId());
proxyConnectorConfiguration.setTargetRepoId(proxyConnector.getTargetRepoId());
proxyConnectorRuleConfiguration.getProxyConnectors().add(proxyConnectorConfiguration);
}
Configuration configuration = getArchivaConfiguration().getConfiguration();
configuration.getProxyConnectorRuleConfigurations().add(proxyConnectorRuleConfiguration);
saveConfiguration(configuration);
}
use of org.apache.archiva.configuration.Configuration in project archiva by apache.
the class DefaultProxyConnectorRuleAdmin method updateProxyConnectorRule.
@Override
public void updateProxyConnectorRule(ProxyConnectorRule proxyConnectorRule, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
for (ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration : configuration.getProxyConnectorRuleConfigurations()) {
if (StringUtils.equals(proxyConnectorRuleConfiguration.getPattern(), proxyConnectorRule.getPattern()) && StringUtils.equals(proxyConnectorRuleConfiguration.getRuleType(), proxyConnectorRule.getProxyConnectorRuleType().getRuleType())) {
List<ProxyConnectorConfiguration> proxyConnectors = new ArrayList<>(proxyConnectorRule.getProxyConnectors().size());
for (ProxyConnector proxyConnector : proxyConnectorRule.getProxyConnectors()) {
ProxyConnectorConfiguration proxyConnectorConfiguration = new ProxyConnectorConfiguration();
proxyConnectorConfiguration.setSourceRepoId(proxyConnector.getSourceRepoId());
proxyConnectorConfiguration.setTargetRepoId(proxyConnector.getTargetRepoId());
proxyConnectors.add(proxyConnectorConfiguration);
}
proxyConnectorRuleConfiguration.setProxyConnectors(proxyConnectors);
saveConfiguration(configuration);
}
}
}
use of org.apache.archiva.configuration.Configuration in project archiva by apache.
the class DefaultArchivaAdministration method removeFileType.
@Override
public void removeFileType(String fileTypeId, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
org.apache.archiva.configuration.FileType fileType = new org.apache.archiva.configuration.FileType();
fileType.setId(fileTypeId);
configuration.getRepositoryScanning().removeFileType(fileType);
saveConfiguration(configuration);
}
Aggregations