com.atlassian.confluence.util
Class DefaultResourceManager

java.lang.Object
  extended by com.atlassian.confluence.util.DefaultResourceManager
All Implemented Interfaces:
ResourceManager, com.atlassian.event.EventListener

public class DefaultResourceManager
extends java.lang.Object
implements ResourceManager, com.atlassian.event.EventListener

Handles the mapping of resources to confluence.home/userResources. The manager does not itself handle permissions. It is assumed that the client will check the permissions of the user before calling upon this. Each mapped resource will be available via the FileServerServlet under 'download/resources/foo'.


Constructor Summary
DefaultResourceManager()
           
 
Method Summary
 void addResource(java.lang.String key, java.io.File resourceFile, Space space)
           
 void addResource(java.lang.String key, java.io.File resourceFile, Space space, java.lang.String contentTypePrefix)
           
 void addResource(java.lang.String key, org.springframework.core.io.Resource resource, Space space)
           
 void addResource(java.lang.String key, org.springframework.core.io.Resource resourceFile, Space space, java.lang.String contentTypePrefix)
           
 void deleteAllSpaceResources(java.lang.String spaceKey)
           
 java.lang.Class[] getHandledEventClasses()
           
 Resource getResource(java.lang.String key, Space space)
           
 java.io.File getResourceFile(java.lang.String relativePathToFile)
           
 java.io.File getResourceFile(java.lang.String relativePathToFile, Space space)
           
 Resource getResourceWithSpaceKey(java.lang.String key, java.lang.String spaceKey)
           
 void handleEvent(com.atlassian.event.Event event)
           
 void removeResource(java.lang.String key, Space space)
          Removes a resource from a Bandana mapping and the file system, if it exists.
 void setBandanaManager(com.atlassian.bandana.BandanaManager bandanaManager)
           
 void setBootstrapManager(BootstrapManager bootstrapManager)
           
 void setSpaceManager(SpaceManager spaceManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourceManager

public DefaultResourceManager()
Method Detail

getResourceWithSpaceKey

public Resource getResourceWithSpaceKey(java.lang.String key,
                                        java.lang.String spaceKey)
Specified by:
getResourceWithSpaceKey in interface ResourceManager
Parameters:
key - - key for the value to be mapped against
spaceKey - - context in which the resource should be mapped

deleteAllSpaceResources

public void deleteAllSpaceResources(java.lang.String spaceKey)
Specified by:
deleteAllSpaceResources in interface ResourceManager

addResource

public void addResource(java.lang.String key,
                        java.io.File resourceFile,
                        Space space)
Specified by:
addResource in interface ResourceManager
Parameters:
key - - the mapping for the uploaded resource in confluence-global.bandana.xml
resourceFile - - a File on the resource to store
space - - the required space this resource should be mapped against

addResource

public void addResource(java.lang.String key,
                        org.springframework.core.io.Resource resource,
                        Space space)
Specified by:
addResource in interface ResourceManager

addResource

public void addResource(java.lang.String key,
                        java.io.File resourceFile,
                        Space space,
                        java.lang.String contentTypePrefix)
Specified by:
addResource in interface ResourceManager

addResource

public void addResource(java.lang.String key,
                        org.springframework.core.io.Resource resourceFile,
                        Space space,
                        java.lang.String contentTypePrefix)
Specified by:
addResource in interface ResourceManager
Parameters:
key - - the mapping for the uploaded resource in confluence-global.bandana.xml
resourceFile - - a File on the resource to store
contentTypePrefix - - for example, a file of type image/gif would be given a contentTypePrefix of "image" and the "gif" extension will be extracted from the filename.

getResource

public Resource getResource(java.lang.String key,
                            Space space)
Specified by:
getResource in interface ResourceManager
Parameters:
key - - the bandana mapping to a user resource
Returns:
File object mapped to the key, or null

removeResource

public void removeResource(java.lang.String key,
                           Space space)
Removes a resource from a Bandana mapping and the file system, if it exists.

Specified by:
removeResource in interface ResourceManager
Parameters:
key -
space -

getResourceFile

public java.io.File getResourceFile(java.lang.String relativePathToFile)

getResourceFile

public java.io.File getResourceFile(java.lang.String relativePathToFile,
                                    Space space)

setBandanaManager

public void setBandanaManager(com.atlassian.bandana.BandanaManager bandanaManager)

setBootstrapManager

public void setBootstrapManager(BootstrapManager bootstrapManager)

setSpaceManager

public void setSpaceManager(SpaceManager spaceManager)

handleEvent

public void handleEvent(com.atlassian.event.Event event)
Specified by:
handleEvent in interface com.atlassian.event.EventListener

getHandledEventClasses

public java.lang.Class[] getHandledEventClasses()
Specified by:
getHandledEventClasses in interface com.atlassian.event.EventListener


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.