Java Code Examples for com.amazonaws.services.s3.model.ObjectMetadata#getLastModified()

The following examples show how to use com.amazonaws.services.s3.model.ObjectMetadata#getLastModified() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CrawlableDatasetAmazonS3.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Returns the date that the dataset was last modified. Will be null if the dataset is a collection or non-existent.
 *
 * @return the date that the dataset was last modified
 */
@Override
public Date lastModified() {
  S3ObjectSummary objectSummary = objectSummaryCache.getIfPresent(s3uri);
  if (objectSummary != null) {
    return objectSummary.getLastModified();
  }

  ObjectMetadata metadata = threddsS3Client.getObjectMetadata(s3uri);
  if (metadata != null) {
    return metadata.getLastModified();
  } else {
    // "this" may be a collection or non-existent. In both cases, we return null.
    return null;
  }
}
 
Example 2
Source File: DataS3.java    From BigDataScript with Apache License 2.0 6 votes vote down vote up
/**
 * Update object's information
 */
protected boolean updateInfo(S3Object s3object) {
	// Read metadata
	ObjectMetadata om = s3object.getObjectMetadata();

	// Update data
	size = om.getContentLength();
	canRead = true;
	canWrite = true;
	lastModified = om.getLastModified();
	exists = true;
	latestUpdate = new Timer(CACHE_TIMEOUT);

	// Show information
	if (debug) Timer.showStdErr("Updated infromation for '" + this + "'"//
			+ "\n\tcanRead      : " + canRead //
			+ "\n\texists       : " + exists //
			+ "\n\tlast modified: " + lastModified //
			+ "\n\tsize         : " + size //
	);

	return true;
}
 
Example 3
Source File: PrestoS3FileSystem.java    From presto with Apache License 2.0 4 votes vote down vote up
private static long lastModifiedTime(ObjectMetadata metadata)
{
    Date date = metadata.getLastModified();
    return (date != null) ? date.getTime() : 0;
}