private LocalAdvancedRepositoryConfigModel createLocalAdvancedConfig( LocalRepoDescriptor descriptor) { LocalAdvancedRepositoryConfigModel advanced = new LocalAdvancedRepositoryConfigModel(); advanced.setAllowContentBrowsing(descriptor.isArchiveBrowsingEnabled()); advanced.setBlackedOut(descriptor.isBlackedOut()); List<PropertySet> propertySetsList = descriptor.getPropertySets(); List<PropertySetNameModel> propertySetNameModelList = collectPropertySets(propertySetsList); advanced.setPropertySets(propertySetNameModelList); return advanced; }
@Override public Map<String, LocalRepoDescriptor> unmarshal(Wrappper wrapper) throws Exception { Map<String, LocalRepoDescriptor> localRepositoriesMap = Maps.newLinkedHashMap(); for (LocalRepoDescriptor repository : wrapper.getList()) { String key = repository.getKey(); LocalRepoDescriptor repo = localRepositoriesMap.put(key, repository); // Test for repositories with the same key if (repo != null) { // Throw an error since jaxb swallows exceptions throw new Error("Duplicate repository key in configuration: " + key + "."); } } return localRepositoriesMap; }
/** Populate model configuration from local repository descriptor */ public void populateLocalDescriptorValuesToModel( LocalRepoDescriptor descriptor, LocalRepositoryConfigModel model) { GeneralRepositoryConfigModel general = createGeneralConfig(descriptor); LocalBasicRepositoryConfigModel basic = createLocalBasicConfig(descriptor); LocalAdvancedRepositoryConfigModel advanced = createLocalAdvancedConfig(descriptor); TypeSpecificConfigModel typeSpecific = createLocalTypeSpecific(descriptor.getType(), descriptor); List<LocalReplicationDescriptor> replicationDescriptors = centralConfig.getDescriptor().getMultiLocalReplications(descriptor.getKey()); List<LocalReplicationConfigModel> replications = replicationDescriptors .stream() .map(this::createLocalReplicationConfig) .collect(Collectors.toList()); model.setGeneral(general); model.setBasic(basic); model.setAdvanced(advanced); model.setTypeSpecific(typeSpecific); model.setReplications(replications); }
private void populateMavenLocalValues( MavenTypeSpecificConfigModel model, LocalRepoDescriptor descriptor) { populateSharedMavenValues(model, descriptor); model.setSnapshotVersionBehavior(descriptor.getSnapshotVersionBehavior()); model.setLocalChecksumPolicy(descriptor.getChecksumPolicyType()); }
private TypeSpecificConfigModel createLocalTypeSpecific( RepoType type, LocalRepoDescriptor descriptor) { MavenTypeSpecificConfigModel mavenModel = null; TypeSpecificConfigModel model = null; switch (type) { case Bower: model = new BowerTypeSpecificConfigModel(); break; case Docker: DockerTypeSpecificConfigModel dockerType = new DockerTypeSpecificConfigModel(); DockerApiVersion dockerApiVersion = descriptor.getDockerApiVersion(); if (dockerApiVersion != null) { dockerType.setDockerApiVersion(dockerApiVersion); } dockerType.setForceDockerAuthentication(descriptor.isForceDockerAuthentication()); model = dockerType; break; case NuGet: NugetTypeSpecificConfigModel nugetType = new NugetTypeSpecificConfigModel(); populateSharedNuGetValues(nugetType, descriptor); nugetType.setMaxUniqueSnapshots(descriptor.getMaxUniqueSnapshots()); model = nugetType; break; case Npm: model = new NpmTypeSpecificConfigModel(); break; case Pypi: model = new PypiTypeSpecificConfigModel(); break; case Vagrant: model = new VagrantTypeSpecificConfigModel(); break; case GitLfs: model = new GitLfsTypeSpecificConfigModel(); break; case Debian: DebTypeSpecificConfigModel debType = new DebTypeSpecificConfigModel(); debType.setTrivialLayout(descriptor.isDebianTrivialLayout()); model = debType; break; case YUM: YumTypeSpecificConfigModel yumType = new YumTypeSpecificConfigModel(); yumType.setMetadataFolderDepth(descriptor.getYumRootDepth()); yumType.setGroupFileNames(descriptor.getYumGroupFileNames()); yumType.setAutoCalculateYumMetadata(descriptor.isCalculateYumMetadata()); model = yumType; break; case Gems: model = new GemsTypeSpecificConfigModel(); break; case Generic: model = new GenericTypeSpecificConfigModel(); break; case Maven: mavenModel = new MavenTypeSpecificConfigModel(); break; case Gradle: mavenModel = new GradleTypeSpecificConfigModel(); break; case Ivy: mavenModel = new IvyTypeSpecificConfigModel(); break; case SBT: mavenModel = new SbtTypeSpecificConfigModel(); break; } if (model != null) { return model; } // We will get here only if our model is maven / gradle / ivy / sbt and we populate the values populateMavenLocalValues(mavenModel, descriptor); return mavenModel; }