use of org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration 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);
}
}
}
use of org.apache.archiva.configuration.model.ProxyConnectorRuleConfiguration 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;
}
Aggregations