Search in sources :

Example 6 with FileStoreDefinition

use of com.serotonin.m2m2.module.FileStoreDefinition in project ma-core-public by infiniteautomation.

the class ModuleRegistry method ensureFileStoreDefinitions.

private static void ensureFileStoreDefinitions() {
    if (FILE_STORE_DEFINITIONS == null) {
        synchronized (LOCK) {
            if (FILE_STORE_DEFINITIONS == null) {
                Map<String, FileStoreDefinition> map = new HashMap<>();
                for (FileStoreDefinition def : Module.getDefinitions(preDefaults, FileStoreDefinition.class)) {
                    map.put(def.getStoreName(), def);
                }
                for (Module module : MODULES.values()) {
                    for (FileStoreDefinition def : module.getDefinitions(FileStoreDefinition.class)) map.put(def.getStoreName(), def);
                }
                for (FileStoreDefinition def : Module.getDefinitions(postDefaults, FileStoreDefinition.class)) {
                    map.put(def.getStoreName(), def);
                }
                FILE_STORE_DEFINITIONS = map;
            }
        }
    }
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) PublicFileStoreDefinition(com.serotonin.m2m2.module.definitions.filestore.PublicFileStoreDefinition) DocsFileStoreDefinition(com.serotonin.m2m2.module.definitions.filestore.DocsFileStoreDefinition) CoreFileStoreDefinition(com.serotonin.m2m2.module.definitions.filestore.CoreFileStoreDefinition)

Aggregations

FileStoreDefinition (com.serotonin.m2m2.module.FileStoreDefinition)5 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 File (java.io.File)4 MultipartFile (org.springframework.web.multipart.MultipartFile)4 CommonsMultipartFile (org.springframework.web.multipart.commons.CommonsMultipartFile)4 GenericRestException (com.infiniteautomation.mango.rest.v2.exception.GenericRestException)3 NotFoundRestException (com.infiniteautomation.mango.rest.v2.exception.NotFoundRestException)3 TranslatableMessage (com.serotonin.m2m2.i18n.TranslatableMessage)3 ResponseEntity (org.springframework.http.ResponseEntity)3 ResourceNotFoundException (com.infiniteautomation.mango.rest.v2.exception.ResourceNotFoundException)2 ArrayList (java.util.ArrayList)2 AccessDeniedException (org.springframework.security.access.AccessDeniedException)2 FileModel (com.infiniteautomation.mango.rest.v2.model.filestore.FileModel)1 CoreFileStoreDefinition (com.serotonin.m2m2.module.definitions.filestore.CoreFileStoreDefinition)1 DocsFileStoreDefinition (com.serotonin.m2m2.module.definitions.filestore.DocsFileStoreDefinition)1 PublicFileStoreDefinition (com.serotonin.m2m2.module.definitions.filestore.PublicFileStoreDefinition)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1