private static void calculateChecksums(File pathOnDisk, ArtifactDescriptor descriptor) { // TODO disable specific algorithms List<String> checksumsToSkip = Collections.emptyList(); Map<String, String> checksums = new HashMap<>(); IStatus status = ChecksumUtilities.calculateChecksums(pathOnDisk, checksums, checksumsToSkip); if (!status.isOK()) { // TODO handle errors in some way LogHelper.log(status); } Map<String, String> checksumProperties = ChecksumUtilities.checksumsToProperties(IArtifactDescriptor.DOWNLOAD_CHECKSUM, checksums); descriptor.addProperties(checksumProperties); }
private IArtifactDescriptor getDestinationDescriptor(IArtifactDescriptor sourceDescriptor) { // Get the descriptor to use to store the artifact // Since we are mirroring, ensure we clear out data from the original descriptor that may // not apply in the new repo location. // TODO this is brittle. perhaps the repo itself should do this? there are cases where // we really do need to give the repo the actual descriptor to use however... IArtifactDescriptor destinationDescriptor = target.createArtifactDescriptor(sourceDescriptor.getArtifactKey()); // destinationDescriptor.setProcessingSteps(EMPTY_STEPS); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, null); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, null); // destinationDescriptor.setProperty(IArtifactDescriptor.FORMAT, null); if (targetDescriptorProperties != null && destinationDescriptor instanceof ArtifactDescriptor) ((ArtifactDescriptor) destinationDescriptor).addProperties(targetDescriptorProperties); if (targetRepositoryProperties != null && destinationDescriptor instanceof SimpleArtifactDescriptor) ((SimpleArtifactDescriptor) destinationDescriptor).addRepositoryProperties(targetRepositoryProperties); return destinationDescriptor; }
private IArtifactDescriptor getDestinationDescriptor(IArtifactDescriptor sourceDescriptor) { // Get the descriptor to use to store the artifact // Since we are mirroring, ensure we clear out data from the original descriptor that may // not apply in the new repo location. // TODO this is brittle. perhaps the repo itself should do this? there are cases where // we really do need to give the repo the actual descriptor to use however... IArtifactDescriptor destinationDescriptor = target.createArtifactDescriptor(sourceDescriptor.getArtifactKey()); // destinationDescriptor.setProcessingSteps(EMPTY_STEPS); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, null); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, null); // destinationDescriptor.setProperty(IArtifactDescriptor.FORMAT, null); if (targetDescriptorProperties != null && destinationDescriptor instanceof ArtifactDescriptor) ((ArtifactDescriptor) destinationDescriptor).addProperties(targetDescriptorProperties); if (targetRepositoryProperties != null && destinationDescriptor instanceof SimpleArtifactDescriptor) ((SimpleArtifactDescriptor) destinationDescriptor).addRepositoryProperties(targetRepositoryProperties); return destinationDescriptor; }
private IArtifactDescriptor getDestinationDescriptor(IArtifactDescriptor sourceDescriptor) { // Get the descriptor to use to store the artifact // Since we are mirroring, ensure we clear out data from the original descriptor that may // not apply in the new repo location. // TODO this is brittle. perhaps the repo itself should do this? there are cases where // we really do need to give the repo the actual descriptor to use however... IArtifactDescriptor destinationDescriptor = target.createArtifactDescriptor(sourceDescriptor.getArtifactKey()); // destinationDescriptor.setProcessingSteps(EMPTY_STEPS); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, null); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, null); // destinationDescriptor.setProperty(IArtifactDescriptor.FORMAT, null); if (targetDescriptorProperties != null && destinationDescriptor instanceof ArtifactDescriptor) ((ArtifactDescriptor) destinationDescriptor).addProperties(targetDescriptorProperties); if (targetRepositoryProperties != null && destinationDescriptor instanceof SimpleArtifactDescriptor) ((SimpleArtifactDescriptor) destinationDescriptor).addRepositoryProperties(targetRepositoryProperties); return destinationDescriptor; }
private IArtifactDescriptor getDestinationDescriptor(IArtifactDescriptor sourceDescriptor) { // Get the descriptor to use to store the artifact // Since we are mirroring, ensure we clear out data from the original descriptor that may // not apply in the new repo location. // TODO this is brittle. perhaps the repo itself should do this? there are cases where // we really do need to give the repo the actual descriptor to use however... IArtifactDescriptor destinationDescriptor = target.createArtifactDescriptor(sourceDescriptor.getArtifactKey()); // destinationDescriptor.setProcessingSteps(EMPTY_STEPS); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, null); // destinationDescriptor.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, null); // destinationDescriptor.setProperty(IArtifactDescriptor.FORMAT, null); if (targetDescriptorProperties != null && destinationDescriptor instanceof ArtifactDescriptor) ((ArtifactDescriptor) destinationDescriptor).addProperties(targetDescriptorProperties); if (targetRepositoryProperties != null && destinationDescriptor instanceof SimpleArtifactDescriptor) ((SimpleArtifactDescriptor) destinationDescriptor).addRepositoryProperties(targetRepositoryProperties); return destinationDescriptor; }
((ArtifactDescriptor) packed).addProperties(additionalProperties); result.put(RepositoryLayoutHelper.PACK200_CLASSIFIER, new P2Artifact(packedLocation, Collections.<IInstallableUnit> emptySet(), packed));