/** * add new proxy to descriptor to configuration descriptor * * @param proxyDescriptor - new proxy descriptor */ private void addNewProxy(ProxyDescriptor proxyDescriptor) { boolean isDefaultProxy = proxyDescriptor.isDefaultProxy(); MutableCentralConfigDescriptor configDescriptor = centralConfigService.getMutableDescriptor(); configDescriptor.proxyChanged(proxyDescriptor, isDefaultProxy); configDescriptor.addProxy(proxyDescriptor, isDefaultProxy); centralConfigService.saveEditedDescriptorAndReload(configDescriptor); }
private LocalReplicationConfigModel createLocalReplicationConfig( LocalReplicationDescriptor replicationDescriptor) { LocalReplicationConfigModel replication = new LocalReplicationConfigModel(); replication.setUrl(replicationDescriptor.getUrl()); replication.setCronExp(replicationDescriptor.getCronExp()); replication.setEnableEventReplication(replicationDescriptor.isEnableEventReplication()); replication.setEnabled(replicationDescriptor.isEnabled()); ProxyDescriptor proxyDescriptor = replicationDescriptor.getProxy(); if (proxyDescriptor != null) { replication.setProxy(proxyDescriptor.getKey()); } replication.setSocketTimeout(replicationDescriptor.getSocketTimeoutMillis()); replication.setSyncDeletes(replicationDescriptor.isSyncDeletes()); replication.setSyncProperties(replicationDescriptor.isSyncProperties()); replication.setUsername(replicationDescriptor.getUsername()); replication.setPassword(replicationDescriptor.getPassword()); return replication; }
/** * update response with created status and feedback * * @param artifactoryResponse - encapsulate all data require for response * @param proxyDescriptor - proxy descriptor */ private void updateResponse(RestResponse artifactoryResponse, ProxyDescriptor proxyDescriptor) { artifactoryResponse.info("Successfully created proxy '" + proxyDescriptor.getKey() + "'"); artifactoryResponse.responseCode(HttpServletResponse.SC_CREATED); }