protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; } }
protected PathAttributes toAttributes(final Metadata metadata) { final PathAttributes attributes = new PathAttributes(); if(metadata instanceof FileMetadata) { final FileMetadata fm = (FileMetadata) metadata; attributes.setSize(fm.getSize()); attributes.setModificationDate(fm.getClientModified().getTime()); } return attributes; } }
protected PathAttributes toAttributes(final StorageObject object) { final PathAttributes attributes = new PathAttributes(); if(StringUtils.isNotBlank(object.getMd5sum())) { // For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of // the concatenated string of ETags for each of the segments in the manifest. attributes.setChecksum(Checksum.parse(object.getMd5sum())); } attributes.setSize(object.getSize()); final String lastModified = object.getLastModified(); if(lastModified != null) { try { attributes.setModificationDate(iso8601DateParser.parse(lastModified).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", lastModified, e.getMessage())); try { attributes.setModificationDate(rfc1123DateFormatter.parse(lastModified).getTime()); } catch(InvalidDateException f) { log.warn(String.format("%s is not RFC 1123 format %s", lastModified, f.getMessage())); } } } return attributes; }
protected PathAttributes toAttributes(final B2FileResponse response) { final PathAttributes attributes = new PathAttributes(); attributes.setSize(response.getContentLength()); if(response.getFileInfo().containsKey(X_BZ_INFO_LARGE_FILE_SHA1)) { attributes.setChecksum(Checksum.parse(response.getFileInfo().get(X_BZ_INFO_LARGE_FILE_SHA1))); } else { attributes.setChecksum(Checksum.parse(StringUtils.removeStart(StringUtils.lowerCase(response.getContentSha1(), Locale.ROOT), "unverified:"))); } final Map<String, String> metadata = new HashMap<>(); for(Map.Entry<String, String> entry : response.getFileInfo().entrySet()) { metadata.put(entry.getKey(), entry.getValue()); } attributes.setMetadata(metadata); attributes.setVersionId(response.getFileId()); if(response.getFileInfo().containsKey(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS)) { attributes.setModificationDate(Long.valueOf(response.getFileInfo().get(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS))); } return attributes; }
protected PathAttributes toAttributes(final ObjectMetadata metadata) { final PathAttributes attributes = new PathAttributes(); attributes.setSize(Long.valueOf(metadata.getContentLength())); final String lastModified = metadata.getLastModified(); try { attributes.setModificationDate(rfc1123DateFormatter.parse(lastModified).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not RFC 1123 format %s", lastModified, e.getMessage())); } if(StringUtils.isNotBlank(metadata.getETag())) { final String etag = StringUtils.removePattern(metadata.getETag(), "\""); attributes.setETag(etag); if(metadata.getMetaData().containsKey(Constants.X_STATIC_LARGE_OBJECT)) { // For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of // the concatenated string of ETags for each of the segments in the manifest. attributes.setChecksum(Checksum.NONE); } else { attributes.setChecksum(Checksum.parse(etag)); } } return attributes; } }
/** * @param response List filenames response from server * @return Null when respone filename is not child of working directory directory */ protected PathAttributes parse(final B2FileInfoResponse response) { final PathAttributes attributes = new PathAttributes(); attributes.setChecksum( Checksum.parse(StringUtils.removeStart(StringUtils.lowerCase(response.getContentSha1(), Locale.ROOT), "unverified:")) ); final long timestamp = response.getUploadTimestamp(); if(response.getFileInfo().containsKey(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS)) { attributes.setModificationDate(Long.valueOf(response.getFileInfo().get(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS))); } else { attributes.setModificationDate(timestamp); } attributes.setVersionId(response.getFileId()); switch(response.getAction()) { case hide: // File version marking the file as hidden, so that it will not show up in b2_list_file_names case start: // Large file has been started, but not finished or canceled attributes.setDuplicate(true); attributes.setSize(-1L); break; default: attributes.setSize(response.getSize()); } return attributes; }
public PathAttributes toAttributes(final Node node) throws BackgroundException { final PathAttributes attributes = new PathAttributes(); attributes.setVersionId(String.valueOf(node.getId())); attributes.setRevision(node.getBranchVersion()); attributes.setChecksum(Checksum.parse(node.getHash())); attributes.setCreationDate(node.getCreatedAt() != null ? node.getCreatedAt().getMillis() : -1L); attributes.setModificationDate(node.getUpdatedAt() != null ? node.getUpdatedAt().getMillis() : -1L); attributes.setSize(node.getSize()); attributes.setPermission(this.toPermission(node)); attributes.setAcl(this.toAcl(node)); final Map<String, String> custom = new HashMap<>(); if(null != node.getCntDownloadShares()) { custom.put(SDSAttributesFinderFeature.KEY_CNT_DOWNLOADSHARES, String.valueOf(node.getCntDownloadShares())); } if(null != node.getCntUploadShares()) { custom.put(SDSAttributesFinderFeature.KEY_CNT_UPLOADSHARES, String.valueOf(node.getCntUploadShares())); } custom.put(SDSAttributesFinderFeature.KEY_ENCRYPTED, String.valueOf(node.getIsEncrypted())); attributes.setCustom(custom); return attributes; }
attributes.setModificationDate(metadata.getLastModifiedDateTime().toInstant().toEpochMilli()); attributes.setModificationDate(metadata.getFileSystemInfo().getLastModifiedDateTime().toInstant().toEpochMilli()); attributes.setModificationDate(metadata.getLastModifiedDateTime().toInstant().toEpochMilli()); attributes.setCreationDate(metadata.getCreatedDateTime().toInstant().toEpochMilli());
final Date lastmodified = object.getLastModifiedDate(); if(lastmodified != null) { attributes.setModificationDate(lastmodified.getTime());
segment.attributes().setSize(s.getSize()); try { segment.attributes().setModificationDate(dateParser.parse(s.getLastModified()).getTime());
attributes.setModificationDate(f.getModifiedTime().getValue());
attributes.setModificationDate(stats.getModifiedAt().getTime()); attributes.setCreationDate(stats.getCreatedAt().getTime()); attributes.setSize(stats.getObjSize());
@Override public PathAttributes find(final Path file) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(!f.exists()) { throw new NotfoundException(file.getAbsolute()); } final PathAttributes attributes = new PathAttributes(); final ObjStat stats = fs.getObjStat(f.getAbsolutePath()); attributes.setModificationDate(stats.getModifiedAt().getTime()); attributes.setCreationDate(stats.getCreatedAt().getTime()); attributes.setSize(stats.getObjSize()); attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(stats.getChecksum())))); attributes.setOwner(stats.getOwnerName()); attributes.setGroup(stats.getOwnerZone()); return attributes; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } }
final BlobContainerProperties properties = container.getProperties(); attributes.setETag(properties.getEtag()); attributes.setModificationDate(properties.getLastModified().getTime()); return attributes; final PathAttributes attributes = new PathAttributes(); attributes.setSize(properties.getLength()); attributes.setModificationDate(properties.getLastModified().getTime()); if(StringUtils.isNotBlank(properties.getContentMD5())) { attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(properties.getContentMD5()))));
session.isWorldReadable(object) ? Permission.Action.read : Permission.Action.none)); if(object.getLastModifiedTime() != null) { attributes.setModificationDate(object.getLastModifiedTime().getTime());
public PathAttributes toAttributes(final FileAttributes stat) { final PathAttributes attributes = new PathAttributes(); switch(stat.getType()) { case REGULAR: case UNKNOWN: attributes.setSize(stat.getSize()); } if(0 != stat.getMode().getPermissionsMask()) { attributes.setPermission(new Permission(Integer.toString(stat.getMode().getPermissionsMask(), 8))); } if(0 != stat.getUID()) { attributes.setOwner(String.valueOf(stat.getUID())); } if(0 != stat.getGID()) { attributes.setGroup(String.valueOf(stat.getGID())); } if(0 != stat.getMtime()) { attributes.setModificationDate(stat.getMtime() * 1000L); } if(0 != stat.getAtime()) { attributes.setAccessedDate(stat.getAtime() * 1000L); } return attributes; } }
attributes.setSize(a.size()); attributes.setModificationDate(a.lastModifiedTime().toMillis()); attributes.setCreationDate(a.creationTime().toMillis()); attributes.setAccessedDate(a.lastAccessTime().toMillis());
final PathAttributes attributes = new PathAttributes(); attributes.setVersionId(upload.getUploadId()); attributes.setModificationDate(upload.getInitiatedDate().getTime()); objects.add(new Path(directory, upload.getObjectKey(), EnumSet.of(Path.Type.file, Path.Type.upload), attributes));
attributes.setModificationDate(Long.parseLong(modifiedObj));
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { ResultSegment<CloudBlobContainer> result; ResultContinuation token = null; try { final AttributedList<Path> containers = new AttributedList<Path>(); do { final BlobRequestOptions options = new BlobRequestOptions(); result = session.getClient().listContainersSegmented(null, ContainerListingDetails.NONE, preferences.getInteger("azure.listing.chunksize"), token, options, context); for(CloudBlobContainer container : result.getResults()) { final PathAttributes attributes = new PathAttributes(); attributes.setETag(container.getProperties().getEtag()); attributes.setModificationDate(container.getProperties().getLastModified().getTime()); containers.add(new Path(PathNormalizer.normalize(container.getName()), EnumSet.of(Path.Type.volume, Path.Type.directory), attributes)); } listener.chunk(directory, containers); token = result.getContinuationToken(); } while(result.getHasMoreResults()); return containers; } catch(StorageException e) { throw new AzureExceptionMappingService().map("Listing directory {0} failed", e, directory); } }