public static MxDelegate getInstance() { if (instance == null) { instance = new MxDelegate(); } return instance; }
long maxListingLength) throws ServiceException MxDelegate.getInstance().registerStorageBucketListEvent(bucketName); StorageObject[] objects = listObjectsImpl(bucketName, prefix, delimiter, maxListingLength); MxDelegate.getInstance().registerStorageObjectMBean(bucketName, objects); return objects;
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()); }
Long byteRangeStart, Long byteRangeEnd) throws ServiceException MxDelegate.getInstance().registerStorageObjectGetEvent(bucketName, objectKey); return getObjectImpl(bucketName, objectKey, ifModifiedSince, ifUnmodifiedSince, ifMatchTags, ifNoneMatchTags, byteRangeStart, byteRangeEnd, null);
/** * 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; }
replaceMetadata ? destinationObject.getModifiableMetadata() : null; MxDelegate.getInstance().registerStorageObjectCopyEvent(sourceBucketName, sourceObjectKey); return copyObjectImpl(sourceBucketName, sourceObjectKey, destinationBucketName, destinationObject.getKey(),
/** * 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); }
String[] ifNoneMatchTags) throws ServiceException MxDelegate.getInstance().registerStorageObjectHeadEvent(bucketName, objectKey); return getObjectDetailsImpl(bucketName, objectKey, ifModifiedSince, ifUnmodifiedSince, ifMatchTags, ifNoneMatchTags, null);
Long byteRangeStart, Long byteRangeEnd) throws ServiceException MxDelegate.getInstance().registerStorageObjectGetEvent(bucketName, objectKey); return getObjectImpl(bucketName, objectKey, ifModifiedSince, ifUnmodifiedSince, ifMatchTags, ifNoneMatchTags, byteRangeStart, byteRangeEnd, null);
/** * 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; }
/** * 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()); }
replaceMetadata ? destinationObject.getModifiableMetadata() : null; MxDelegate.getInstance().registerStorageObjectCopyEvent(sourceBucketName, sourceObjectKey); return copyObjectImpl(sourceBucketName, sourceObjectKey, destinationBucketName, destinationObject.getKey(),
/** * 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); }
long maxListingLength) throws ServiceException MxDelegate.getInstance().registerStorageBucketListEvent(bucketName); StorageObject[] objects = listObjectsImpl(bucketName, prefix, delimiter, maxListingLength); MxDelegate.getInstance().registerStorageObjectMBean(bucketName, objects); return objects;
/** * 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);