/** * @param jets3tProperties * the object containing the properties that will be applied in the instance. * @return * a FileComparer instance. */ public static FileComparer getInstance(Jets3tProperties jets3tProperties) { return new FileComparer(jets3tProperties); }
/** * Compares the contents of a directory on the local file system with the contents of a service * resource. This comparison is performed on a map of files and a map of service objects previously * generated using other methods in this class. * * @param objectKeyToFilepathMap * map of '/'-delimited object key names to local file absolute paths * @param objectsMap * a map of keys to StorageObjects. * @return * an object containing the results of the file comparison. * * @throws NoSuchAlgorithmException * @throws FileNotFoundException * @throws IOException * @throws ParseException */ public FileComparerResults buildDiscrepancyLists( Map<String, String> objectKeyToFilepathMap, Map<String, StorageObject> objectsMap) throws NoSuchAlgorithmException, FileNotFoundException, IOException, ParseException { return buildDiscrepancyLists(objectKeyToFilepathMap, objectsMap, null, false); }
List<Pattern> parentIgnorePatternList) List<Pattern> ignorePatternList = buildIgnoreRegexpList(directory, parentIgnorePatternList); if (!isIgnored(ignorePatternList, childFile)) { String objectKeyName = normalizeUnicode(fileKeyPrefix + childFile.getName()); objectKeyToFilepathMap.put(objectKeyName, childFile.getAbsolutePath()); buildObjectKeyToFilepathMapForDirectory( childFile, objectKeyName, objectKeyToFilepathMap, includeDirectories, ignorePatternList);
boolean storeEmptyDirectories = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME) .getBoolProperty("uploads.storeEmptyDirectories", true); objectKeyToFilepathMap = FileComparer.getInstance() .buildObjectKeyToFilepathMap(downloadDirectory.listFiles(), "", storeEmptyDirectories); } catch (Exception e) { String message = "Unable to review files in targetted download directory"; s3DownloadObjectsMap = FileComparer.getInstance() .populateObjectMap("", getSelectedObjects());
if (fileComparer.isGenerateMd5Files()) { md5HashOfFile = fileComparer.generateFileMD5Hash(file, targetKey, null); } else if (fileComparer.isUseMd5Files()) { md5HashOfFile = fileComparer.lookupFileMD5Hash(file, targetKey);
throws IOException, NoSuchAlgorithmException File computedHashFile = getPreComputedHashFile(file, relativeFilePath); byte[] computedHash = lookupFileMD5Hash(file, relativeFilePath); if (isGenerateMd5Files() && !file.getName().endsWith(".md5") && (!computedHashFile.exists() || computedHashFile.lastModified() < file.lastModified()))
StorageObject storageObject = entry.getValue(); String[] splitPathComponents = splitFilePathIntoDirPaths( keyPath, storageObject.isDirectoryPlaceholder()); generateFileMD5Hash(file, storageObject.getKey(), progressWatcher)); if (!isAssumeLocalLatestInMismatch() && log.isWarnEnabled()) { log.warn("Using service last modified date as file date. This is not reliable " + "as the time according to service can differ from your local system time. " if (isAssumeLocalLatestInMismatch()) { if (log.isWarnEnabled()) { log.warn("Backed-up object \"" + storageObject.getKey()
FileComparerResults comparisonResults = FileComparer.getInstance() .buildDiscrepancyLists(objectKeyToFilepathMap, s3ObjectsMap, progressWatcher);
PartialObjectListing partialListing = fileComparer.buildObjectMapPartial( storageService, bucketName, rootObjectPath, priorLastKey, objectKeyToFilepathMap, !isBatchMode, forceMetadataDownload, isForce, FileComparerResults discrepancyResults = fileComparer.buildDiscrepancyLists( objectKeyToFilepathMap, objectsMap, md5GenerationProgressWatcher, isForce);
File preComputedHashFile = getPreComputedHashFile(file, relativeFilePath); byte[] preComputedHash = null; if (isUseMd5Files() && preComputedHashFile.canRead() && preComputedHashFile.lastModified() > file.lastModified())
throws ServiceException Map<String, StorageObject> objectMap = populateObjectMap(targetPath, objectsWithoutMetadata); } else { fileHashAsHex = ServiceUtils.toHex( generateFileMD5Hash(file, objectKey, progressWatcher)); objectMap.putAll(populateObjectMap(targetPath, objectsWithMetadata));
protected File getPreComputedHashFile(File file, String relativeFilePath) throws IOException { return (getMd5FilesRootDirectoryFile() != null ? new File(getMd5FilesRootDirectoryFile(), relativeFilePath + ".md5") : new File(file.getPath() + ".md5")); }
this.reportLevel = reportLevel; this.properties = properties; this.fileComparer = FileComparer.getInstance(properties);
objectKeyToFilepathMap = fileComparer.buildObjectKeyToFilepathMap( files, "", storeEmptyDirectories); } else if ("DOWN".equals(actionCommand)) { + files[0].getAbsolutePath()); objectKeyToFilepathMap = fileComparer.buildObjectKeyToFilepathMap( filesInTargetDir, "", storeEmptyDirectories);
final Map<String, String> objectKeyToFilepathMap = FileComparer.getInstance() .buildObjectKeyToFilepathMap(downloadDirectory.listFiles(), "", storeEmptyDirectories); final Map s3DownloadObjectsMap = FileComparer.getInstance() .populateObjectMap("", getSelectedObjects());
if (fileComparer.isGenerateMd5Files()) { md5HashOfFile = fileComparer.generateFileMD5Hash(file, targetKey, null); } else if (fileComparer.isUseMd5Files()) { md5HashOfFile = fileComparer.lookupFileMD5Hash(file, targetKey);
throws IOException, NoSuchAlgorithmException File computedHashFile = getPreComputedHashFile(file, relativeFilePath); byte[] computedHash = lookupFileMD5Hash(file, relativeFilePath); if (isGenerateMd5Files() && !file.getName().endsWith(".md5") && (!computedHashFile.exists() || computedHashFile.lastModified() < file.lastModified()))
StorageObject storageObject = entry.getValue(); String[] splitPathComponents = splitFilePathIntoDirPaths( keyPath, storageObject.isDirectoryPlaceholder()); generateFileMD5Hash(file, storageObject.getKey(), progressWatcher)); if (!isAssumeLocalLatestInMismatch() && log.isWarnEnabled()) { log.warn("Using service last modified date as file date. This is not reliable " + "as the time according to service can differ from your local system time. " if (isAssumeLocalLatestInMismatch()) { if (log.isWarnEnabled()) { log.warn("Backed-up object \"" + storageObject.getKey()
FileComparerResults comparisonResults = FileComparer.getInstance() .buildDiscrepancyLists(objectKeyToFilepathMap, s3ObjectsMap, progressWatcher);
PartialObjectListing partialListing = fileComparer.buildObjectMapPartial( storageService, bucketName, rootObjectPath, priorLastKey, objectKeyToFilepathMap, !isBatchMode, forceMetadataDownload, isForce, FileComparerResults discrepancyResults = fileComparer.buildDiscrepancyLists( objectKeyToFilepathMap, objectsMap, md5GenerationProgressWatcher, isForce);