ERAttachmentProcessor< T extends ERAttachment > Class Reference

Collaboration diagram for ERAttachmentProcessor< T extends ERAttachment >:

Collaboration graph
[legend]

List of all members.

Classes

class  ERXAttachmentExceedsLengthException

Public Member Functions

abstract T _process (EOEditingContext editingContext, File uploadedFile, String recommendedFileName, String mimeType, String configurationName, String ownerID, boolean pendingDelete) throws IOException
abstract InputStream attachmentInputStream (T attachment) throws IOException
void attachmentInserted (T attachment)
abstract String attachmentUrl (T attachment, WORequest request, WOContext context)
IERAttachmentProcessorDelegate delegate ()
abstract void deleteAttachment (T attachment) throws IOException
process (EOEditingContext editingContext, ERPendingAttachment pendingAttachment) throws IOException
process (EOEditingContext editingContext, File uploadedFile, String recommendedFilePath, String mimeType, int width, int height, String configurationName, String ownerID) throws IOException
process (EOEditingContext editingContext, File uploadedFile, String recommendedFilePath, String mimeType, String configurationName, String ownerID) throws IOException
process (EOEditingContext editingContext, File uploadedFile, String recommendedFilePath, String mimeType) throws IOException
process (EOEditingContext editingContext, File uploadedFile, String recommendedFilePath) throws IOException
process (EOEditingContext editingContext, File uploadedFile) throws IOException
boolean proxyAsAttachment (T attachment)
void setDelegate (IERAttachmentProcessorDelegate delegate)

Static Public Member Functions

static synchronized void addAttachmentProcessorForType (ERAttachmentProcessor<?> processor, String storageType)
static< TextendsERAttachment >
ERAttachmentProcessor< T > 
processorForConfigurationName (String configurationName)
static< TextendsERAttachment >
ERAttachmentProcessor< T > 
processorForType (String storageType)
static< TextendsERAttachment >
ERAttachmentProcessor< T > 
processorForType (T attachment)
static synchronized
NSMutableDictionary< String,
ERAttachmentProcessor<?> > 
processors ()

Static Public Attributes

static final Logger log = Logger.getLogger(ERAttachmentProcessor.class)

Protected Member Functions

String proxiedUrl (T attachment, WOContext context)

Static Protected Member Functions

static String _parsePathTemplate (ERAttachment attachment, String templatePath, String recommendedFileName)

Private Attributes

IERAttachmentProcessorDelegate _delegate

Static Private Attributes

static NSMutableDictionary
< String,
ERAttachmentProcessor<?> > 
_processors
static final String EXT_VARIABLE = "\\$\\{ext\\}"
static final String FILE_NAME_VARIABLE = "\\$\\{fileName\\}"
static final String HASH_VARIABLE = "\\$\\{hash\\}"
static final String PK_VARIABLE = "\\$\\{pk\\}"
static final String UUID_VARIABLE = "\\$\\{uuid\\}"


Member Function Documentation

static String _parsePathTemplate ( ERAttachment  attachment,
String  templatePath,
String  recommendedFileName 
) [static, protected]

Parses a path template with ${ext}, ${fileName}, ${hash}, ${uuid}, and ${pk} variables in it. See the ERAttachment top level documentation for more information.

Parameters:
attachment the attachment being processed
templatePath the template path definition
recommendedFileName the original file name recommended by the uploading user

abstract T _process ( EOEditingContext  editingContext,
File  uploadedFile,
String  recommendedFileName,
String  mimeType,
String  configurationName,
String  ownerID,
boolean  pendingDelete 
) throws IOException [pure virtual]

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.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
uploadedFile the uploaded temporary file (which will be deleted at the end)
recommendedFileName the filename recommended by the user during import
mimeType 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
Exceptions:
IOException if the processing fails

static synchronized void addAttachmentProcessorForType ( ERAttachmentProcessor<?>  processor,
String  storageType 
) [static]

Adds a new attachment processor for the given storage type.

Parameters:
processor the processor
storageType the storage type that corresponds to the processor

abstract InputStream attachmentInputStream ( attachment  )  throws IOException [pure virtual]

Returns an InputStream to the data of the given attachment.

Parameters:
attachment the attachment to retrieve the data for
Returns:
an InputStream onto the data
Exceptions:
IOException if the stream cannot be created

void attachmentInserted ( attachment  ) 

Called after an attachment has been inserted (from didInsert).

Parameters:
attachment the inserted attachment

abstract String attachmentUrl ( attachment,
WORequest  request,
WOContext  context 
) [pure virtual]

Returns a URL to the attachment's data.

Parameters:
attachment the attachment to generate a URL for
request the current request
context the current context
Returns:
a URL to the attachment's data

Returns the attachment processor delegate for this processor.

Returns:
the attachment processor delegate for this processor

abstract void deleteAttachment ( attachment  )  throws IOException [pure virtual]

Deletes the attachment from the data store.

Parameters:
attachment the attachment to delete
Exceptions:
IOException if the delete fails

T process ( EOEditingContext  editingContext,
ERPendingAttachment  pendingAttachment 
) throws IOException

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.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
pendingAttachment the ERPendingAttachment that encapsulates the import information
Returns:
an ERAttachment that represents the file
Exceptions:
IOException if the processing fails

T process ( EOEditingContext  editingContext,
File  uploadedFile,
String  recommendedFilePath,
String  mimeType,
int  width,
int  height,
String  configurationName,
String  ownerID 
) throws IOException

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.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
uploadedFile the uploaded temporary file (which will be deleted at the end)
recommendedFilePath the filename recommended by the user during import
mimeType 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 attachment
height the desired height of the attachment
Returns:
an ERAttachment that represents the file
Exceptions:
IOException if the processing fails

T process ( EOEditingContext  editingContext,
File  uploadedFile,
String  recommendedFilePath,
String  mimeType,
String  configurationName,
String  ownerID 
) throws IOException

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.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
uploadedFile the uploaded temporary file (which will be deleted at the end)
recommendedFilePath the filename recommended by the user during import
mimeType 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)
Returns:
an ERAttachment that represents the file
Exceptions:
IOException if the processing fails

T process ( EOEditingContext  editingContext,
File  uploadedFile,
String  recommendedFilePath,
String  mimeType 
) throws IOException

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.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
uploadedFile the uploaded temporary file (which will be deleted at the end)
recommendedFilePath the filename recommended by the user during import
mimeType the mimeType to use (null = guess based on file extension)
Returns:
an ERAttachment that represents the file
Exceptions:
IOException if the processing fails

T process ( EOEditingContext  editingContext,
File  uploadedFile,
String  recommendedFilePath 
) throws IOException

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.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
uploadedFile the uploaded temporary file (which will be deleted at the end)
recommendedFilePath the filename recommended by the user during import
Returns:
an ERAttachment that represents the file
Exceptions:
IOException if the processing fails

T process ( EOEditingContext  editingContext,
File  uploadedFile 
) throws IOException

Processes an uploaded file, imports it into the appropriate data store, and returns an ERAttachment that represents it. uploadedFile will NOT be deleted after the import process is complete.

Parameters:
editingContext the EOEditingContext to create the ERAttachment in
uploadedFile the file to attach (which will NOT be deleted at the end)
Returns:
an ERAttachment that represents the file
Exceptions:
IOException if the processing fails

static <TextendsERAttachment> ERAttachmentProcessor<T> processorForConfigurationName ( String  configurationName  )  [static]

Returns the processor that corresponds to the given configuration name ("s3", "db", "file", etc).

Parameters:
configurationName the configuration name to use to lookup the default storage type
Returns:
the storage type's processor

static <TextendsERAttachment> ERAttachmentProcessor<T> processorForType ( String  storageType  )  [static]

Returns the processor that corresponds to the given storage type ("s3", "db", "file", etc).

Parameters:
storageType the type of processor to lookup
Returns:
the storage type's processor

static <TextendsERAttachment> ERAttachmentProcessor<T> processorForType ( attachment  )  [static]

Returns the processor that corresponds to the given attachment.

Parameters:
<T> the attachment type
attachment the attachment to lookup a processor for
Returns:
the attachment's processor

static synchronized NSMutableDictionary<String, ERAttachmentProcessor<?> > processors (  )  [static]

Returns all of the processors mapped by storageType.

Returns:
all of the processors mapped by storageType

String proxiedUrl ( attachment,
WOContext  context 
) [protected]

Returns a URL to the given attachment that routes via the ERAttachmentRequestHandler.

Parameters:
attachment the attachment to proxy
context the context
Returns:
an ERAttachmentRequestHandler URL

boolean proxyAsAttachment ( attachment  ) 

Returns whether or not the proxy request handler should return this as an attachment with a Content-Disposition.

Returns:
true if the proxy should use a content-disposition

void setDelegate ( IERAttachmentProcessorDelegate  delegate  ) 

Sets the attachment processor delegate for this processor.

Parameters:
delegate the attachment processor delegate for this processor


Member Data Documentation

NSMutableDictionary<String, ERAttachmentProcessor<?> > _processors [static, private]

final String EXT_VARIABLE = "\\$\\{ext\\}" [static, private]

final String FILE_NAME_VARIABLE = "\\$\\{fileName\\}" [static, private]

final String HASH_VARIABLE = "\\$\\{hash\\}" [static, private]

final Logger log = Logger.getLogger(ERAttachmentProcessor.class) [static]

final String PK_VARIABLE = "\\$\\{pk\\}" [static, private]

final String UUID_VARIABLE = "\\$\\{uuid\\}" [static, private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:42 2012 for Project Wonder by  doxygen 1.5.8