public class ResourceModuleRegistry extends java.lang.Object implements ModuleRegistry
Resource based implementation of ModuleRegistry. While not being coupled to java.io.File
access, will try to sanitize file paths as much as possible.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ARCHIVE_AS_FILE_EXTENSION
The extension the module 'File' must have if it's not in exploded dir format.
|
static java.lang.String |
HASH_EXTENSION
The extension to use for storing an uploaded module hash.
|
protected org.springframework.core.io.support.ResourcePatternResolver |
resolver |
protected java.lang.String |
root |
| Constructor and Description |
|---|
ResourceModuleRegistry(java.lang.String root) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
collect(org.springframework.core.io.Resource resource,
java.util.List<ModuleDefinition> holder) |
ModuleDefinition |
findDefinition(java.lang.String name,
ModuleType moduleType)
Lookup a module of the given type with the given name.
|
java.util.List<ModuleDefinition> |
findDefinitions()
Returns all module definitions.
|
java.util.List<ModuleDefinition> |
findDefinitions(ModuleType type)
Searches the registry for the type specified and returns all module definitions that match the type.
|
java.util.List<ModuleDefinition> |
findDefinitions(java.lang.String name)
Searches the registry for the name specified and returns all module definitions that match the name regardless of
module type.
|
protected java.lang.Iterable<org.springframework.core.io.Resource> |
getResources(java.lang.String moduleType,
java.lang.String moduleName,
java.lang.String suffix) |
protected org.springframework.core.io.Resource |
hashResource(org.springframework.core.io.Resource moduleResource) |
void |
setRequireHashFiles(boolean requireHashFiles) |
public static final java.lang.String ARCHIVE_AS_FILE_EXTENSION
public static final java.lang.String HASH_EXTENSION
protected org.springframework.core.io.support.ResourcePatternResolver resolver
protected java.lang.String root
protected org.springframework.core.io.Resource hashResource(org.springframework.core.io.Resource moduleResource)
throws java.io.IOException
java.io.IOExceptionpublic ModuleDefinition findDefinition(java.lang.String name, ModuleType moduleType)
ModuleRegistryfindDefinition in interface ModuleRegistrynull if this registry does not have such a modulepublic java.util.List<ModuleDefinition> findDefinitions(java.lang.String name)
ModuleRegistryfindDefinitions in interface ModuleRegistryname - The module definition name to be searched.public java.util.List<ModuleDefinition> findDefinitions(ModuleType type)
ModuleRegistryfindDefinitions in interface ModuleRegistrytype - The module type name to be searched.public java.util.List<ModuleDefinition> findDefinitions()
ModuleRegistryfindDefinitions in interface ModuleRegistryprotected java.lang.Iterable<org.springframework.core.io.Resource> getResources(java.lang.String moduleType,
java.lang.String moduleName,
java.lang.String suffix)
throws java.io.IOException
java.io.IOExceptionprotected void collect(org.springframework.core.io.Resource resource,
java.util.List<ModuleDefinition> holder)
throws java.io.IOException
java.io.IOExceptionpublic void setRequireHashFiles(boolean requireHashFiles)