/** * Sets the optional version ID of the object version whose metadata is * being retrieved. * Returns this {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * If not specified, the latest version will be used. * * @param versionId * The optional version ID of the object version whose metadata * is being retrieved. * * @return This {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * * @see GetObjectMetadataRequest#getVersionId() * @see GetObjectMetadataRequest#setVersionId(String) */ public GetObjectMetadataRequest withVersionId(String versionId) { setVersionId(versionId); return this; }
/** * Constructs a new * {@link GetObjectMetadataRequest} * with basic options. * * @param bucketName * The name of the bucket containing the object whose metadata * is being retrieved. * @param key * The key of the object whose metadata is being retrieved. * @param versionId * The version ID of the object version whose metadata is being * retrieved. * * @see GetObjectMetadataRequest#GetObjectMetadataRequest(String bucketName, String key) */ public GetObjectMetadataRequest(String bucketName, String key, String versionId) { this(bucketName, key); setVersionId(versionId); }
/** * Constructs a new * {@link GetObjectMetadataRequest} * with basic options. * * @param bucketName * The name of the bucket containing the object whose metadata * is being retrieved. * @param key * The key of the object whose metadata is being retrieved. * @param versionId * The version ID of the object version whose metadata is being * retrieved. * * @see GetObjectMetadataRequest#GetObjectMetadataRequest(String bucketName, String key) */ public GetObjectMetadataRequest(String bucketName, String key, String versionId) { this(bucketName, key); setVersionId(versionId); }
/** * Sets the optional version ID of the object version whose metadata is * being retrieved. * Returns this {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * If not specified, the latest version will be used. * * @param versionId * The optional version ID of the object version whose metadata * is being retrieved. * * @return This {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * * @see GetObjectMetadataRequest#getVersionId() * @see GetObjectMetadataRequest#setVersionId(String) */ public GetObjectMetadataRequest withVersionId(String versionId) { setVersionId(versionId); return this; }
/** * Constructs a new * {@link GetObjectMetadataRequest} * with basic options. * * @param bucketName * The name of the bucket containing the object whose metadata * is being retrieved. * @param key * The key of the object whose metadata is being retrieved. * @param versionId * The version ID of the object version whose metadata is being * retrieved. * * @see GetObjectMetadataRequest#GetObjectMetadataRequest(String bucketName, String key) */ public GetObjectMetadataRequest(String bucketName, String key, String versionId) { this(bucketName, key); setVersionId(versionId); }
/** * Constructs a new * {@link GetObjectMetadataRequest} * with basic options. * * @param bucketName * The name of the bucket containing the object whose metadata * is being retrieved. * @param key * The key of the object whose metadata is being retrieved. * @param versionId * The version ID of the object version whose metadata is being * retrieved. * * @see GetObjectMetadataRequest#GetObjectMetadataRequest(String bucketName, String key) */ public GetObjectMetadataRequest(String bucketName, String key, String versionId) { this(bucketName, key); setVersionId(versionId); }
/** * Sets the optional version ID of the object version whose metadata is * being retrieved. * Returns this {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * If not specified, the latest version will be used. * * @param versionId * The optional version ID of the object version whose metadata * is being retrieved. * * @return This {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * * @see GetObjectMetadataRequest#getVersionId() * @see GetObjectMetadataRequest#setVersionId(String) */ public GetObjectMetadataRequest withVersionId(String versionId) { setVersionId(versionId); return this; }
/** * Sets the optional version ID of the object version whose metadata is * being retrieved. * Returns this {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * If not specified, the latest version will be used. * * @param versionId * The optional version ID of the object version whose metadata * is being retrieved. * * @return This {@link GetObjectMetadataRequest}, enabling additional method * calls to be chained together. * * @see GetObjectMetadataRequest#getVersionId() * @see GetObjectMetadataRequest#setVersionId(String) */ public GetObjectMetadataRequest withVersionId(String versionId) { setVersionId(versionId); return this; }
private ObjectMetadata getObjectMetadata() { if (this.objectMetadata == null) { try { GetObjectMetadataRequest metadataRequest = new GetObjectMetadataRequest(this.bucketName, this.objectName); if (this.versionId != null) { metadataRequest.setVersionId(this.versionId); } this.objectMetadata = this.amazonS3.getObjectMetadata(metadataRequest); } catch (AmazonS3Exception e) { // Catch 404 (object not found) and 301 (bucket not found, moved permanently) if (e.getStatusCode() == 404 || e.getStatusCode() == 301) { this.objectMetadata = null; } else { throw e; } } } return this.objectMetadata; }
private ObjectMetadata getObjectMetadata() { if (this.objectMetadata == null) { try { GetObjectMetadataRequest metadataRequest = new GetObjectMetadataRequest(this.bucketName, this.objectName); if (this.versionId != null) { metadataRequest.setVersionId(this.versionId); } this.objectMetadata = this.amazonS3.getObjectMetadata(metadataRequest); } catch (AmazonS3Exception e) { // Catch 404 (object not found) and 301 (bucket not found, moved permanently) if (e.getStatusCode() == 404 || e.getStatusCode() == 301) { this.objectMetadata = null; } else { throw e; } } } return this.objectMetadata; }
req.setVersionId(versionId.get());