org.norther.tammi.spray.media
Class DefaultMediaProvider

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.spray.media.DefaultMediaProvider
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, MediaProvider
Direct Known Subclasses:
DefaultCachedMediaProvider

public class DefaultMediaProvider
extends Adaptee
implements MediaProvider

A default implementation of MediaProvider.

Version:
$Id: DefaultMediaProvider.java,v 1.11 2010-03-30 16:01:26 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Constructor Summary
DefaultMediaProvider()
          Constructs a new provider.
 
Method Summary
 void addMediaKey(int index, String key)
          Adds a path finder media key to the specified index.
 void addMediaKey(String key)
          Adds a path finder media key.
 void clearMediaKeys()
          Clears all path finder media keys.
 String getDefaultIndex()
          Gets the default index file.
protected  String getDefaultIndex(boolean localized, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the default index with the terminal extension.
 String[] getMediaKeys()
          Gets the path finder keys for resolving media paths.
 Resource<?> getResource(String path, boolean localized, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the media content resource.
 void removeMediaKey(String key)
          Removes a path finder media key.
 void setDefaultIndex(String index)
          Sets the default index file.
 void setMediaKeys(String[] keys)
          Sets the path finder keys for resolving media paths.
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMediaProvider

public DefaultMediaProvider()
Constructs a new provider.

Method Detail

getMediaKeys

public String[] getMediaKeys()
Description copied from interface: MediaProvider
Gets the path finder keys for resolving media paths.

Specified by:
getMediaKeys in interface MediaProvider
Returns:
the path finder keys.

setMediaKeys

public void setMediaKeys(String[] keys)
Description copied from interface: MediaProvider
Sets the path finder keys for resolving media paths. The default key is PathFinder.MEDIA.

Specified by:
setMediaKeys in interface MediaProvider
Parameters:
keys - an array of path finder keys.

addMediaKey

public void addMediaKey(String key)
Description copied from interface: MediaProvider
Adds a path finder media key.

Specified by:
addMediaKey in interface MediaProvider
Parameters:
key - the path finder key.

addMediaKey

public void addMediaKey(int index,
                        String key)
Description copied from interface: MediaProvider
Adds a path finder media key to the specified index.

Specified by:
addMediaKey in interface MediaProvider
Parameters:
index - the key index.
key - the path finder key.

removeMediaKey

public void removeMediaKey(String key)
Description copied from interface: MediaProvider
Removes a path finder media key.

Specified by:
removeMediaKey in interface MediaProvider
Parameters:
key - the path finder key.

clearMediaKeys

public void clearMediaKeys()
Description copied from interface: MediaProvider
Clears all path finder media keys.

Specified by:
clearMediaKeys in interface MediaProvider

getDefaultIndex

public String getDefaultIndex()
Description copied from interface: MediaProvider
Gets the default index file.

Specified by:
getDefaultIndex in interface MediaProvider
Returns:
the default index file.

setDefaultIndex

public void setDefaultIndex(String index)
Description copied from interface: MediaProvider
Sets the default index file.

Specified by:
setDefaultIndex in interface MediaProvider
Parameters:
index - a default index file.

getResource

public Resource<?> getResource(String path,
                               boolean localized,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain)
                        throws IOException,
                               ConstructionException,
                               AccessDeniedException
Description copied from interface: MediaProvider
Gets the media content resource.

Specified by:
getResource in interface MediaProvider
Parameters:
path - the content path.
localized - the localization option.
request - the servlet request.
response - the servlet response.
chain - the filter chain.
Returns:
the resource source.
Throws:
IOException - on I/O errors.
ConstructionException - on resource errors.
AccessDeniedException - for access restrictions.

getDefaultIndex

protected String getDefaultIndex(boolean localized,
                                 ServletRequest request,
                                 ServletResponse response,
                                 FilterChain chain)
Gets the default index with the terminal extension.

Parameters:
localized - the localization option.
request - the request.
response - the response.
chain - the filter chain.
Returns:
the default index.


Copyright © 2004 The Norther Organization. All rights reserved.