|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.attachment.processors.ERAttachmentProcessor<T>
T
- the type of ERAttachment that this processor processespublic abstract class ERAttachmentProcessor<T extends ERAttachment>
ERAttachmentProcessors provide the implementation of the communication with the attachment storage method, including import, URL generation, and stream generation.
ERAttachmentProcessors also provide support for path template variables. Read the er.attachment package.html for more information.
Properties | |
er.attachment.maxSize | the maximum size of an uploaded attachment |
er.attachment.[configurationName].maxSize | the maximum size of an uploaded attachment |
er.attachment.[configurationName].storageType | er.attachment.[configurationName].storageType |
er.attachment.storageType | er.attachment.storageType |
er.attachment.[configurationName].proxyAsAttachment | er.attachment.[configurationName].proxyAsAttachment |
er.attachment.proxyAsAttachment | er.attachment.proxyAsAttachment |
Nested Class Summary | |
---|---|
static class |
ERAttachmentProcessor.ERXAttachmentExceedsLengthException
ERXAttachmentExceedsLengthException thrown when an attachment exceeds the maximum attachment size. |
Field Summary | |
---|---|
static org.apache.log4j.Logger |
log
|
Constructor Summary | |
---|---|
ERAttachmentProcessor()
|
Method Summary | ||
---|---|---|
protected static java.lang.String |
_parsePathTemplate(ERAttachment attachment,
java.lang.String templatePath,
java.lang.String recommendedFileName)
Parses a path template with ${ext}, ${fileName}, ${hash}, ${uuid}, and ${pk} variables in it. |
|
abstract T |
_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. |
|
static void |
addAttachmentProcessorForType(ERAttachmentProcessor<?> processor,
java.lang.String storageType)
Adds a new attachment processor for the given storage type. |
|
abstract java.io.InputStream |
attachmentInputStream(T attachment)
Returns an InputStream to the data of the given attachment. |
|
void |
attachmentInserted(T attachment)
Called after an attachment has been inserted (from didInsert). |
|
abstract java.lang.String |
attachmentUrl(T attachment,
com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Returns a URL to the attachment's data. |
|
IERAttachmentProcessorDelegate |
delegate()
Returns the attachment processor delegate for this processor. |
|
abstract void |
deleteAttachment(T attachment)
Deletes the attachment from the data store. |
|
T |
process(com.webobjects.eocontrol.EOEditingContext editingContext,
ERPendingAttachment pendingAttachment)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile,
java.lang.String recommendedFilePath)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile,
java.lang.String recommendedFilePath,
java.lang.String mimeType)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile,
java.lang.String recommendedFilePath,
java.lang.String mimeType,
int width,
int height,
java.lang.String configurationName,
java.lang.String ownerID)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
T |
process(com.webobjects.eocontrol.EOEditingContext editingContext,
java.io.File uploadedFile,
java.lang.String recommendedFilePath,
java.lang.String mimeType,
java.lang.String configurationName,
java.lang.String ownerID)
Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. |
|
static
|
processorForConfigurationName(java.lang.String configurationName)
Returns the processor that corresponds to the given configuration name ("s3", "db", "file", etc). |
|
static
|
processorForType(java.lang.String storageType)
Returns the processor that corresponds to the given storage type ("s3", "db", "file", etc). |
|
static
|
processorForType(T attachment)
Returns the processor that corresponds to the given attachment. |
|
static com.webobjects.foundation.NSMutableDictionary<java.lang.String,ERAttachmentProcessor<?>> |
processors()
Returns all of the processors mapped by storageType. |
|
protected java.lang.String |
proxiedUrl(T attachment,
com.webobjects.appserver.WOContext context)
Returns a URL to the given attachment that routes via the ERAttachmentRequestHandler. |
|
boolean |
proxyAsAttachment(T attachment)
Returns whether or not the proxy request handler should return this as an attachment with a Content-Disposition. |
|
void |
setDelegate(IERAttachmentProcessorDelegate delegate)
Sets the attachment processor delegate for this processor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger log
Constructor Detail |
---|
public ERAttachmentProcessor()
Method Detail |
---|
public static com.webobjects.foundation.NSMutableDictionary<java.lang.String,ERAttachmentProcessor<?>> processors()
public static <T extends ERAttachment> ERAttachmentProcessor<T> processorForType(T attachment)
T
- the attachment typeattachment
- the attachment to lookup a processor for
public static <T extends ERAttachment> ERAttachmentProcessor<T> processorForType(java.lang.String storageType)
storageType
- the type of processor to lookup
public static <T extends ERAttachment> ERAttachmentProcessor<T> processorForConfigurationName(java.lang.String configurationName)
configurationName
- the configuration name to use to lookup the default storage type
public static void addAttachmentProcessorForType(ERAttachmentProcessor<?> processor, java.lang.String storageType)
processor
- the processorstorageType
- the storage type that corresponds to the processorprotected static java.lang.String _parsePathTemplate(ERAttachment attachment, java.lang.String templatePath, java.lang.String recommendedFileName)
attachment
- the attachment being processedtemplatePath
- the template path definitionrecommendedFileName
- the original file name recommended by the uploading userpublic void setDelegate(IERAttachmentProcessorDelegate delegate)
delegate
- the attachment processor delegate for this processorpublic IERAttachmentProcessorDelegate delegate()
protected java.lang.String proxiedUrl(T attachment, com.webobjects.appserver.WOContext context)
attachment
- the attachment to proxycontext
- the context
public T process(com.webobjects.eocontrol.EOEditingContext editingContext, java.io.File uploadedFile) throws java.io.IOException
editingContext
- the EOEditingContext to create the ERAttachment inuploadedFile
- the file to attach (which will NOT be deleted at the end)
java.io.IOException
- if the processing failspublic T process(com.webobjects.eocontrol.EOEditingContext editingContext, java.io.File uploadedFile, java.lang.String recommendedFilePath) throws java.io.IOException
editingContext
- the EOEditingContext to create the ERAttachment inuploadedFile
- the uploaded temporary file (which will be deleted at the end)recommendedFilePath
- the filename recommended by the user during import
java.io.IOException
- if the processing failspublic T process(com.webobjects.eocontrol.EOEditingContext editingContext, java.io.File uploadedFile, java.lang.String recommendedFilePath, java.lang.String mimeType) throws java.io.IOException
editingContext
- the EOEditingContext to create the ERAttachment inuploadedFile
- the uploaded temporary file (which will be deleted at the end)recommendedFilePath
- the filename recommended by the user during importmimeType
- the mimeType to use (null = guess based on file extension)
java.io.IOException
- if the processing failspublic T process(com.webobjects.eocontrol.EOEditingContext editingContext, java.io.File uploadedFile, java.lang.String recommendedFilePath, java.lang.String mimeType, java.lang.String configurationName, java.lang.String ownerID) throws java.io.IOException
editingContext
- the EOEditingContext to create the ERAttachment inuploadedFile
- the uploaded temporary file (which will be deleted at the end)recommendedFilePath
- 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)
java.io.IOException
- if the processing failspublic T process(com.webobjects.eocontrol.EOEditingContext editingContext, java.io.File uploadedFile, java.lang.String recommendedFilePath, java.lang.String mimeType, int width, int height, java.lang.String configurationName, java.lang.String ownerID) throws java.io.IOException
editingContext
- the EOEditingContext to create the ERAttachment inuploadedFile
- the uploaded temporary file (which will be deleted at the end)recommendedFilePath
- 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)width
- the desired width of the attachmentheight
- the desired height of the attachment
java.io.IOException
- if the processing failspublic T process(com.webobjects.eocontrol.EOEditingContext editingContext, ERPendingAttachment pendingAttachment) throws java.io.IOException
editingContext
- the EOEditingContext to create the ERAttachment inpendingAttachment
- the ERPendingAttachment that encapsulates the import information
java.io.IOException
- if the processing failspublic void attachmentInserted(T attachment)
attachment
- the inserted attachmentpublic boolean proxyAsAttachment(T attachment)
public abstract T _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) throws java.io.IOException
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
java.io.IOException
- if the processing failspublic abstract java.io.InputStream attachmentInputStream(T attachment) throws java.io.IOException
attachment
- the attachment to retrieve the data for
java.io.IOException
- if the stream cannot be createdpublic abstract java.lang.String attachmentUrl(T attachment, com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
attachment
- the attachment to generate a URL forrequest
- the current requestcontext
- the current context
public abstract void deleteAttachment(T attachment) throws java.io.IOException
attachment
- the attachment to delete
java.io.IOException
- if the delete fails
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |