er.attachment.processors
Class ERS3AttachmentProcessor
java.lang.Object
er.attachment.processors.ERAttachmentProcessor<ERS3Attachment>
er.attachment.processors.ERS3AttachmentProcessor
public class ERS3AttachmentProcessor
- extends ERAttachmentProcessor<ERS3Attachment>
ERS3AttachmentProcessor implements storing attachments in Amazon's S3 service. For more
information about configuring an ERS3AttachmentProcessor, see the top level documentation.
- Author:
- mschrag
|
Method Summary |
ERS3Attachment |
_process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFileName,
String mimeType,
String configurationName,
String ownerID,
boolean pendingDelete)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that
represents it. |
protected String |
accessKeyID(String configurationName)
|
InputStream |
attachmentInputStream(ERS3Attachment attachment)
Returns an InputStream to the data of the given attachment. |
void |
attachmentInserted(ERS3Attachment attachment)
Called after an attachment has been inserted (from didInsert). |
String |
attachmentUrl(ERS3Attachment attachment,
WORequest request,
WOContext context)
Returns a URL to the attachment's data. |
protected com.amazon.s3.AWSAuthConnection |
awsConnection(String configurationName)
|
void |
deleteAttachment(ERS3Attachment attachment)
Deletes the attachment from the data store. |
protected boolean |
failed(com.amazon.s3.Response response)
|
void |
performUpload(File uploadedFile,
String originalFileName,
String bucket,
String key,
String mimeType,
String configurationName)
|
protected com.amazon.s3.QueryStringAuthGenerator |
queryStringAuthGenerator(String configurationName)
|
protected String |
secretAccessKey(String configurationName)
|
| Methods inherited from class er.attachment.processors.ERAttachmentProcessor |
_parsePathTemplate, addAttachmentProcessorForType, delegate, process, process, process, process, process, processorForConfigurationName, processorForType, processorForType, processors, proxiedUrl, proxyAsAttachment, setDelegate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
S3_URL
public static final String S3_URL
- See Also:
- Constant Field Values
ERS3AttachmentProcessor
public ERS3AttachmentProcessor()
_process
public ERS3Attachment _process(EOEditingContext editingContext,
File uploadedFile,
String recommendedFileName,
String mimeType,
String configurationName,
String ownerID,
boolean pendingDelete)
- Description copied from class:
ERAttachmentProcessor
- Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that
represents it. uploadedFile will be deleted after the import process is complete.
- Specified by:
_process in class ERAttachmentProcessor<ERS3Attachment>
- Parameters:
editingContext - the EOEditingContext to create the ERAttachment inuploadedFile - the uploaded temporary file (which will be deleted at the end)recommendedFileName - the filename recommended by the user during importmimeType - the mimeType to use (null = guess based on file extension)configurationName - the name of the configuration settings to use for this processor (see top level docs)ownerID - an arbitrary string that represents the ID of the "owner" of this thumbnail (Person.primaryKey, for instance)pendingDelete - if true, the uploadedFile will be deleted after import; if false, it will be left alone
- Returns:
- an ERAttachment that represents the file
attachmentInputStream
public InputStream attachmentInputStream(ERS3Attachment attachment)
throws IOException
- Description copied from class:
ERAttachmentProcessor
- Returns an InputStream to the data of the given attachment.
- Specified by:
attachmentInputStream in class ERAttachmentProcessor<ERS3Attachment>
- Parameters:
attachment - the attachment to retrieve the data for
- Returns:
- an InputStream onto the data
- Throws:
IOException - if the stream cannot be created
attachmentUrl
public String attachmentUrl(ERS3Attachment attachment,
WORequest request,
WOContext context)
- Description copied from class:
ERAttachmentProcessor
- Returns a URL to the attachment's data.
- Specified by:
attachmentUrl in class ERAttachmentProcessor<ERS3Attachment>
- Parameters:
attachment - the attachment to generate a URL forrequest - the current requestcontext - the current context
- Returns:
- a URL to the attachment's data
deleteAttachment
public void deleteAttachment(ERS3Attachment attachment)
throws MalformedURLException,
IOException
- Description copied from class:
ERAttachmentProcessor
- Deletes the attachment from the data store.
- Specified by:
deleteAttachment in class ERAttachmentProcessor<ERS3Attachment>
- Parameters:
attachment - the attachment to delete
- Throws:
IOException - if the delete fails
MalformedURLException
attachmentInserted
public void attachmentInserted(ERS3Attachment attachment)
- Description copied from class:
ERAttachmentProcessor
- Called after an attachment has been inserted (from didInsert).
- Overrides:
attachmentInserted in class ERAttachmentProcessor<ERS3Attachment>
- Parameters:
attachment - the inserted attachment
performUpload
public void performUpload(File uploadedFile,
String originalFileName,
String bucket,
String key,
String mimeType,
String configurationName)
throws MalformedURLException,
IOException
- Throws:
MalformedURLException
IOException
accessKeyID
protected String accessKeyID(String configurationName)
secretAccessKey
protected String secretAccessKey(String configurationName)
awsConnection
protected com.amazon.s3.AWSAuthConnection awsConnection(String configurationName)
queryStringAuthGenerator
protected com.amazon.s3.QueryStringAuthGenerator queryStringAuthGenerator(String configurationName)
failed
protected boolean failed(com.amazon.s3.Response response)
throws IOException
- Throws:
IOException
Copyright © 2002 – 2007 Project Wonder.