com.atlassian.confluence.util
Class DefaultResourceManager
java.lang.Object
com.atlassian.confluence.util.DefaultResourceManager
- All Implemented Interfaces:
- EventListener, ResourceManager
- public class DefaultResourceManager
- extends Object
- implements ResourceManager, 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'.
Method Summary |
void |
addResource(String key,
File resourceFile,
Space space)
|
void |
addResource(String key,
File resourceFile,
Space space,
String contentTypePrefix)
|
void |
deleteAllSpaceResources(String spaceKey)
|
Class[] |
getHandledEventClasses()
|
Resource |
getResource(String key,
Space space)
|
File |
getResourceFile(String relativePathToFile)
|
File |
getResourceFile(String relativePathToFile,
Space space)
|
Resource |
getResourceWithSpaceKey(String key,
String spaceKey)
|
void |
handleEvent(Event event)
|
void |
removeResource(String key,
Space space)
Removes a resource from a Bandana mapping and the file system, if it exists. |
void |
setBandanaManager(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 |
DefaultResourceManager
public DefaultResourceManager()
getResourceWithSpaceKey
public Resource getResourceWithSpaceKey(String key,
String spaceKey)
- Specified by:
getResourceWithSpaceKey
in interface ResourceManager
- Parameters:
key
- - key for the value to be mapped againstspaceKey
- - context in which the resource should be mapped
deleteAllSpaceResources
public void deleteAllSpaceResources(String spaceKey)
- Specified by:
deleteAllSpaceResources
in interface ResourceManager
addResource
public void addResource(String key,
File resourceFile,
Space space)
- Specified by:
addResource
in interface ResourceManager
- Parameters:
key
- - the mapping for the uploaded resource in confluence-global.bandana.xmlresourceFile
- - a File on the resource to storespace
- - the required space this resource should be mapped against
addResource
public void addResource(String key,
File resourceFile,
Space space,
String contentTypePrefix)
- Specified by:
addResource
in interface ResourceManager
- Parameters:
key
- - the mapping for the uploaded resource in confluence-global.bandana.xmlresourceFile
- - a File on the resource to storecontentTypePrefix
- - 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(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(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 File getResourceFile(String relativePathToFile)
getResourceFile
public File getResourceFile(String relativePathToFile,
Space space)
setBandanaManager
public void setBandanaManager(BandanaManager bandanaManager)
setBootstrapManager
public void setBootstrapManager(BootstrapManager bootstrapManager)
setSpaceManager
public void setSpaceManager(SpaceManager spaceManager)
handleEvent
public void handleEvent(Event event)
- Specified by:
handleEvent
in interface EventListener
getHandledEventClasses
public Class[] getHandledEventClasses()
- Specified by:
getHandledEventClasses
in interface EventListener