/** * Provide initial configuration to the server in order to create the {@link ImportProcessPrx} * which will manage state server-side. * * @param container the import container * @return the new import process from the server * @throws ServerError if the import process could not be created * @throws IOException if the used files' absolute path could not be found */ public ImportProcessPrx createImport(final ImportContainer container) throws ServerError, IOException { checkManagedRepo(); String[] usedFiles = container.getUsedFiles(); File target = container.getFile(); if (log.isDebugEnabled()) { log.debug("Main file: " + target.getAbsolutePath()); log.debug("Used files before:"); for (String f : usedFiles) { log.debug(f); } } notifyObservers( new ImportEvent.FILESET_UPLOAD_PREPARATION(null, 0, usedFiles.length, null, null, null)); // Copied to ClientPathExclusion // TODO: allow looser sanitization according to server configuration final FilePathRestrictions portableRequiredRules = FilePathRestrictionInstance.getFilePathRestrictions( FilePathRestrictionInstance.WINDOWS_REQUIRED, FilePathRestrictionInstance.UNIX_REQUIRED); final ClientFilePathTransformer sanitizer = new ClientFilePathTransformer(new MakePathComponentSafe(portableRequiredRules)); final ImportSettings settings = new ImportSettings(); final Fileset fs = new FilesetI(); container.fillData(settings, fs, sanitizer, transfer); String caStr = container.getChecksumAlgorithm(); if (caStr != null) { settings.checksumAlgorithm = ChecksumAlgorithmMapper.getChecksumAlgorithm(caStr); } else { // check if the container object has ChecksumAlgorithm // present and pass it into the settings object settings.checksumAlgorithm = repo.suggestChecksumAlgorithm(availableChecksumAlgorithms); if (settings.checksumAlgorithm == null) { throw new RuntimeException("no supported checksum algorithm negotiated with server"); } } return repo.importFileset(fs, settings); }
/** * Delete files from the managed repository. * * @param container The current import container containing usedFiles to be deleted. * @return List of files that could not be deleted. */ public List<String> deleteFilesFromRepository(ImportContainer container) throws ServerError { checkManagedRepo(); // FIXME List<String> undeleted = repo.deleteFiles(container.getUsedFiles()); // return undeleted; return null; }