protected void initializeDefaults() { if (getJetS3tProperties().getBoolProperty( "storage-service.apply-recommended-dns-caching-defaults", true)) { // Configure the InetAddress DNS caching times to work well with remote services. The cached // DNS will timeout after 5 minutes, while failed DNS lookups will be retried after 1 second. java.security.Security.setProperty("networkaddress.cache.ttl", "300"); java.security.Security.setProperty("networkaddress.cache.negative.ttl", "1"); if (this.log.isDebugEnabled()) { this.log.debug("Setting recommended DNS caching defaults"); } } else { if (this.log.isDebugEnabled()) { this.log.debug("Skipped setting recommended DNS caching defaults because JetS3t" + " property 'storage-service.apply-recommended-dns-caching-defaults' is false"); } } if (this.log.isDebugEnabled()) { log.debug("Using DNS caching system settings:" + " networkaddress.cache.ttl=" + java.security.Security.getProperty("networkaddress.cache.ttl") + ", networkaddress.cache.negative.ttl=" + java.security.Security.getProperty("networkaddress.cache.negative.ttl")); } // (Re)initialize the JetS3t JMX delegate, in case system properties have changed. MxDelegate.getInstance().init(); MxDelegate.getInstance().registerS3ServiceMBean(); MxDelegate.getInstance().registerS3ServiceExceptionMBean(); }
protected void initializeDefaults() { if (getJetS3tProperties().getBoolProperty( "storage-service.apply-recommended-dns-caching-defaults", true)) { // Configure the InetAddress DNS caching times to work well with remote services. The cached // DNS will timeout after 5 minutes, while failed DNS lookups will be retried after 1 second. java.security.Security.setProperty("networkaddress.cache.ttl", "300"); java.security.Security.setProperty("networkaddress.cache.negative.ttl", "1"); if (this.log.isDebugEnabled()) { this.log.debug("Setting recommended DNS caching defaults"); } } else { if (this.log.isDebugEnabled()) { this.log.debug("Skipped setting recommended DNS caching defaults because JetS3t" + " property 'storage-service.apply-recommended-dns-caching-defaults' is false"); } } if (this.log.isDebugEnabled()) { log.debug("Using DNS caching system settings:" + " networkaddress.cache.ttl=" + java.security.Security.getProperty("networkaddress.cache.ttl") + ", networkaddress.cache.negative.ttl=" + java.security.Security.getProperty("networkaddress.cache.negative.ttl")); } // (Re)initialize the JetS3t JMX delegate, in case system properties have changed. MxDelegate.getInstance().init(); MxDelegate.getInstance().registerS3ServiceMBean(); MxDelegate.getInstance().registerS3ServiceExceptionMBean(); }
String[] ifNoneMatchTags) throws ServiceException MxDelegate.getInstance().registerStorageObjectHeadEvent(bucketName, objectKey); return getObjectDetailsImpl(bucketName, objectKey, ifModifiedSince, ifUnmodifiedSince, ifMatchTags, ifNoneMatchTags, null);
/** * Create a service exception that includes a specific message, an optional XML error * document returned by service, and an optional underlying cause exception. * * @param message * @param xmlMessage * @param cause */ public ServiceException(String message, String xmlMessage, Throwable cause) { super(message, cause); if (xmlMessage != null) { parseXmlMessage(xmlMessage); } MxDelegate.getInstance().registerS3ServiceExceptionEvent(getErrorCode()); }
/** * Create a service exception that includes a specific message, an optional XML error * document returned by service, and an optional underlying cause exception. * * @param message * @param xmlMessage * @param cause */ public ServiceException(String message, String xmlMessage, Throwable cause) { super(message, cause); if (xmlMessage != null) { parseXmlMessage(xmlMessage); } MxDelegate.getInstance().registerS3ServiceExceptionEvent(getErrorCode()); }
/** * Lists the buckets belonging to the service user. * <p> * This method cannot be performed by anonymous services, and will fail with an exception * if the service is not authenticated. * * @return * the list of buckets owned by the service user. * @throws ServiceException */ public StorageBucket[] listAllBuckets() throws ServiceException { assertAuthenticatedConnection("List all buckets"); StorageBucket[] buckets = listAllBucketsImpl(); MxDelegate.getInstance().registerStorageBucketMBeans(buckets); return buckets; }
/** * Deletes an object from a bucket. * <p> * This method can be performed by anonymous services. Anonymous services * can delete objects from publicly-writable buckets. * * @param bucketName * the name of the bucket containing the object to be deleted. * @param objectKey * the key representing the object * @throws ServiceException */ public void deleteObject(String bucketName, String objectKey) throws ServiceException { assertValidObject(objectKey, "deleteObject"); MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey); deleteObjectImpl(bucketName, objectKey, null, null, null); }
/** * Lists the buckets belonging to the service user. * <p> * This method cannot be performed by anonymous services, and will fail with an exception * if the service is not authenticated. * * @return * the list of buckets owned by the service user. * @throws ServiceException */ public StorageBucket[] listAllBuckets() throws ServiceException { assertAuthenticatedConnection("List all buckets"); StorageBucket[] buckets = listAllBucketsImpl(); MxDelegate.getInstance().registerStorageBucketMBeans(buckets); return buckets; }
/** * Deletes an object from a bucket. * <p> * This method can be performed by anonymous services. Anonymous services * can delete objects from publicly-writable buckets. * * @param bucketName * the name of the bucket containing the object to be deleted. * @param objectKey * the key representing the object * @throws ServiceException */ public void deleteObject(String bucketName, String objectKey) throws ServiceException { assertValidObject(objectKey, "deleteObject"); MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey); deleteObjectImpl(bucketName, objectKey, null, null, null); }
/** * List all buckets in a given project * @param projectId The ID of the project being listed * @return a list of {@link GSBucket} * @throws ServiceException Service error */ public GSBucket[] listAllBuckets(String projectId) throws ServiceException { assertAuthenticatedConnection("List all buckets"); StorageBucket[] buckets = listAllBucketsImpl(projectId); MxDelegate.getInstance().registerStorageBucketMBeans(buckets); return GSBucket.cast(buckets); }
/** * List all buckets in a given project * @param projectId The ID of the project being listed * @return a list of {@link GSBucket} * @throws ServiceException Service error */ public GSBucket[] listAllBuckets(String projectId) throws ServiceException { assertAuthenticatedConnection("List all buckets"); StorageBucket[] buckets = listAllBucketsImpl(projectId); MxDelegate.getInstance().registerStorageBucketMBeans(buckets); return GSBucket.cast(buckets); }
/** * Returns an object representing the details of an item in S3 with a specific given version, * without the object's data and without applying any preconditions. Versioned objects are only * available from buckets with versioning enabled, see {@link #enableBucketVersioning(String)}. * <p> * This method can be performed by anonymous services. Anonymous services * can get a publicly-readable object's details. * * @param versionId * object's version identifier * @param bucketName * the name of the versioned bucket containing the object. * @param objectKey * the key identifying the object. * @return * the object with the given key in S3, including only general details and metadata (not the data * input stream) * @throws S3ServiceException */ public S3Object getVersionedObjectDetails(String versionId, String bucketName, String objectKey) throws S3ServiceException { try { MxDelegate.getInstance().registerStorageObjectHeadEvent(bucketName, objectKey); return (S3Object) getObjectDetailsImpl(bucketName, objectKey, null, null, null, null, versionId); } catch (ServiceException se) { throw new S3ServiceException(se); } }
MxDelegate.getInstance().registerStorageObjectGetEvent(bucketName, objectKey); return (S3Object) getObjectImpl(bucketName, objectKey, null, null, null, null, null, null, versionId);
/** * Returns an object representing the details of an item in S3 with a specific given version, * without the object's data and without applying any preconditions. Versioned objects are only * available from buckets with versioning enabled, see {@link #enableBucketVersioning(String)}. * <p> * This method can be performed by anonymous services. Anonymous services * can get a publicly-readable object's details. * * @param versionId * object's version identifier * @param bucketName * the name of the versioned bucket containing the object. * @param objectKey * the key identifying the object. * @return * the object with the given key in S3, including only general details and metadata (not the data * input stream) * @throws S3ServiceException */ public S3Object getVersionedObjectDetails(String versionId, String bucketName, String objectKey) throws S3ServiceException { try { MxDelegate.getInstance().registerStorageObjectHeadEvent(bucketName, objectKey); return (S3Object) getObjectDetailsImpl(bucketName, objectKey, null, null, null, null, versionId); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Deletes a object version from a bucket in S3. This will delete only the specific * version identified and will not affect any other Version or DeleteMarkers related * to the object. * <p> * This operation can only be performed by the owner of the S3 bucket. * * @param versionId * the identifier of an object version that will be deleted. * @param bucketName * the name of the versioned bucket containing the object to be deleted. * @param objectKey * the key representing the object in S3. * @throws S3ServiceException */ public void deleteVersionedObject(String versionId, String bucketName, String objectKey) throws S3ServiceException { try { assertValidObject(objectKey, "deleteVersionedObject"); MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey); deleteObjectImpl(bucketName, objectKey, versionId, null, null); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Puts an object inside an existing bucket, creating a new object or overwriting * an existing one with the same key. The Access Control List settings of the object * (if any) will also be applied. * <p> * This method can be performed by anonymous services. Anonymous services * can put objects into a publicly-writable bucket. * * @param bucketName * the name of the bucket inside which the object will be put. * @param object * the object containing all information that will be written to the service. * At very least this object must be valid. Beyond that it may contain: an input stream * with the object's data content, metadata, and access control settings. * <p> * <b>Note:</b> It is very important to set the object's Content-Length to match the size of the * data input stream when possible, as this can remove the need to read data into memory to * determine its size. * * @return * the object populated with any metadata. * @throws ServiceException */ public StorageObject putObject(String bucketName, StorageObject object) throws ServiceException { assertValidObject(object, "Create Object in bucket " + bucketName); MxDelegate.getInstance().registerStorageObjectPutEvent(bucketName, object.getKey()); return putObjectImpl(bucketName, object); }
/** * Deletes a object version from a bucket in S3. This will delete only the specific * version identified and will not affect any other Version or DeleteMarkers related * to the object. * <p> * This operation can only be performed by the owner of the S3 bucket. * * @param versionId * the identifier of an object version that will be deleted. * @param bucketName * the name of the versioned bucket containing the object to be deleted. * @param objectKey * the key representing the object in S3. * @throws S3ServiceException */ public void deleteVersionedObject(String versionId, String bucketName, String objectKey) throws S3ServiceException { try { assertValidObject(objectKey, "deleteVersionedObject"); MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey); deleteObjectImpl(bucketName, objectKey, versionId, null, null); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Puts an object inside an existing bucket, creating a new object or overwriting * an existing one with the same key. The Access Control List settings of the object * (if any) will also be applied. * <p> * This method can be performed by anonymous services. Anonymous services * can put objects into a publicly-writable bucket. * * @param bucketName * the name of the bucket inside which the object will be put. * @param object * the object containing all information that will be written to the service. * At very least this object must be valid. Beyond that it may contain: an input stream * with the object's data content, metadata, and access control settings. * <p> * <b>Note:</b> It is very important to set the object's Content-Length to match the size of the * data input stream when possible, as this can remove the need to read data into memory to * determine its size. * * @return * the object populated with any metadata. * @throws ServiceException */ public StorageObject putObject(String bucketName, StorageObject object) throws ServiceException { assertValidObject(object, "Create Object in bucket " + bucketName); MxDelegate.getInstance().registerStorageObjectPutEvent(bucketName, object.getKey()); return putObjectImpl(bucketName, object); }
MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey); deleteObjectImpl(bucketName, objectKey, versionId, multiFactorSerialNumber, multiFactorAuthCode);
MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey); deleteObjectImpl(bucketName, objectKey, versionId, multiFactorSerialNumber, multiFactorAuthCode);