magoffin.matt.ma2.support
Class BasicMediaRequest

java.lang.Object
  extended by magoffin.matt.ma2.support.BasicMediaRequest
All Implemented Interfaces:
MediaRequest

public class BasicMediaRequest
extends java.lang.Object
implements MediaRequest

Basic implementation of MediaRequest.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Field Summary
 
Fields inherited from interface magoffin.matt.ma2.MediaRequest
OUTPUT_FILE_KEY, USER_AGENT_KEY
 
Constructor Summary
BasicMediaRequest()
          Default constructor.
BasicMediaRequest(java.lang.Long id)
          Construct with some parameters.
BasicMediaRequest(java.lang.Long id, MediaSize size, MediaQuality quality)
          Construct with some parameters.
BasicMediaRequest(MediaRequest request)
          Copy constructor.
 
Method Summary
 java.lang.String getCacheKey()
          Generates a cache key based on the item's ID, size, and quality.
 java.util.List<MediaEffect> getEffects()
          Get a List of effects to apply to the request.
 java.lang.Long getMediaItemId()
          Get the ID of the media item desired.
 java.util.Map<java.lang.String,java.lang.Object> getParameters()
          Get a Map of optional additional parameters.
 MediaQuality getQuality()
          Get the desired quality constant.
 MediaSize getSize()
          Get the desired size constant.
 boolean isOriginal()
          Return true if the original media item file is desired.
 void setEffects(java.util.List<MediaEffect> effects)
           
 void setMediaItemId(java.lang.Long mediaItemId)
           
 void setOriginal(boolean original)
           
 void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
           
 void setQuality(MediaQuality quality)
           
 void setSize(MediaSize size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMediaRequest

public BasicMediaRequest()
Default constructor.


BasicMediaRequest

public BasicMediaRequest(MediaRequest request)
Copy constructor.

Parameters:
request - the request to copy

BasicMediaRequest

public BasicMediaRequest(java.lang.Long id)
Construct with some parameters.

Parameters:
id - the media item ID

BasicMediaRequest

public BasicMediaRequest(java.lang.Long id,
                         MediaSize size,
                         MediaQuality quality)
Construct with some parameters.

Parameters:
id - the media item ID
size - the size
quality - the quality
Method Detail

getMediaItemId

public java.lang.Long getMediaItemId()
Description copied from interface: MediaRequest
Get the ID of the media item desired.

Specified by:
getMediaItemId in interface MediaRequest
Returns:
the media item ID

isOriginal

public boolean isOriginal()
Description copied from interface: MediaRequest
Return true if the original media item file is desired.

Specified by:
isOriginal in interface MediaRequest
Returns:
boolean

getSize

public MediaSize getSize()
Description copied from interface: MediaRequest
Get the desired size constant.

Specified by:
getSize in interface MediaRequest
Returns:
the desired size

getQuality

public MediaQuality getQuality()
Description copied from interface: MediaRequest
Get the desired quality constant.

Specified by:
getQuality in interface MediaRequest
Returns:
the desired quality

getParameters

public java.util.Map<java.lang.String,java.lang.Object> getParameters()
Description copied from interface: MediaRequest
Get a Map of optional additional parameters.

During request handling, MediaHandler implementations are allowed to add parameters to this map.

Specified by:
getParameters in interface MediaRequest
Returns:
parameters

getCacheKey

public java.lang.String getCacheKey()
Generates a cache key based on the item's ID, size, and quality.

Specified by:
getCacheKey in interface MediaRequest
Returns:
unique cache key

setMediaItemId

public void setMediaItemId(java.lang.Long mediaItemId)
Parameters:
mediaItemId - The mediaItemId to set.

setOriginal

public void setOriginal(boolean original)
Parameters:
original - The original to set.

setParameters

public void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Parameters:
parameters - The parameters to set.

setQuality

public void setQuality(MediaQuality quality)
Parameters:
quality - The quality to set.

setSize

public void setSize(MediaSize size)
Parameters:
size - The size to set.

getEffects

public java.util.List<MediaEffect> getEffects()
Description copied from interface: MediaRequest
Get a List of effects to apply to the request.

The effects should be applied in the order of the list. The MediaHandler servicing the request should be allowed to make changes to this List as it sees fit.

Specified by:
getEffects in interface MediaRequest
Returns:
Returns the effects.

setEffects

public void setEffects(java.util.List<MediaEffect> effects)
Parameters:
effects - The effects to set.