private boolean createFolder(RemoteFile remoteFile) throws StorageException { PathAwareRemoteFileAttributes pathAwareRemoteFileAttributes = remoteFile.getAttributes(PathAwareRemoteFileAttributes.class); boolean notAPathAwareRemoteFile = pathAwareRemoteFileAttributes == null || !pathAwareRemoteFileAttributes.hasPath(); if (notAPathAwareRemoteFile) { return true; } else { String remoteFilePath = pathToString(Paths.get(underlyingTransferManager.getRemoteFilePath(remoteFile.getClass()), pathAwareRemoteFileAttributes.getPath())); logger.log(Level.INFO, "Remote file is path aware, creating folder " + remoteFilePath); boolean success = pathAwareFeatureExtension.createPath(remoteFilePath); return success; } }
private boolean removeFolder(RemoteFile remoteFile) throws StorageException { PathAwareRemoteFileAttributes pathAwareRemoteFileAttributes = remoteFile.getAttributes(PathAwareRemoteFileAttributes.class); boolean notAPathAwareRemoteFile = pathAwareRemoteFileAttributes == null || !pathAwareRemoteFileAttributes.hasPath(); if (notAPathAwareRemoteFile) { return true; } else { String remoteFilePath = pathToString(Paths.get(underlyingTransferManager.getRemoteFilePath(remoteFile.getClass()), pathAwareRemoteFileAttributes.getPath())); logger.log(Level.INFO, "Remote file is path aware, cleaning empty folders at " + remoteFilePath); boolean success = removeFolder(remoteFilePath); return success; } }