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
Properties |
er.attachment.[configurationName].s3.bucket | er.attachment.[configurationName].s3.bucket |
er.attachment.s3.bucket | er.attachment.s3.bucket |
er.attachment.[configurationName].s3.key | er.attachment.[configurationName].s3.key |
er.attachment.s3.key | er.attachment.s3.key |
er.attachment.[configurationName].s3.accessKeyID | er.attachment.[configurationName].s3.accessKeyID |
er.attachment.s3.accessKeyID | er.attachment.s3.accessKeyID |
er.attachment.[configurationName].s3.secretAccessKey | er.attachment.[configurationName].s3.secretAccessKey |
er.attachment.s3.secretAccessKey | er.attachment.s3.secretAccessKey |
Field Summary |
static java.lang.String |
S3_URL
|
Method Summary |
ERS3Attachment |
_process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile,
java.lang.String recommendedFileName,
java.lang.String mimeType,
java.lang.String configurationName,
java.lang.String ownerID,
boolean pendingDelete)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that
represents it. |
java.io.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). |
java.lang.String |
attachmentUrl(ERS3Attachment attachment,
com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Returns a URL to the attachment's data. |
void |
deleteAttachment(ERS3Attachment attachment)
Deletes the attachment from the data store. |
protected boolean |
failed(com.amazon.s3.Response response)
|
void |
performUpload(java.io.File uploadedFile,
java.lang.String originalFileName,
java.lang.String bucket,
java.lang.String key,
java.lang.String mimeType,
ERS3Attachment attachment)
|
Methods inherited from class er.attachment.processors.ERAttachmentProcessor |
_parsePathTemplate, addAttachmentProcessorForType, delegate, process, 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 java.lang.String S3_URL
- See Also:
- Constant Field Values
ERS3AttachmentProcessor
public ERS3AttachmentProcessor()
_process
public ERS3Attachment _process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile,
java.lang.String recommendedFileName,
java.lang.String mimeType,
java.lang.String configurationName,
java.lang.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 java.io.InputStream attachmentInputStream(ERS3Attachment attachment)
throws java.io.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:
java.io.IOException
- if the stream cannot be created
attachmentUrl
public java.lang.String attachmentUrl(ERS3Attachment attachment,
com.webobjects.appserver.WORequest request,
com.webobjects.appserver.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 java.net.MalformedURLException,
java.io.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:
java.io.IOException
- if the delete fails
java.net.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(java.io.File uploadedFile,
java.lang.String originalFileName,
java.lang.String bucket,
java.lang.String key,
java.lang.String mimeType,
ERS3Attachment attachment)
throws java.net.MalformedURLException,
java.io.IOException
- Throws:
java.net.MalformedURLException
java.io.IOException
failed
protected boolean failed(com.amazon.s3.Response response)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2002 – 2007 Project Wonder.