Package com.redwood.scheduler.api.model
Class FileFormatFinder
- java.lang.Object
-
- com.redwood.scheduler.api.model.FileFormatFinder
-
public class FileFormatFinder extends Object
Centralized Format identifier utility class. The sequential lookup rules to follow:1. Lookup all Formats that have case insensitive extension match OR matching mime-type that is not application/octet-stream. If none found, return Format.OctetStream.
2. Try to find a Format where BOTH match (exclude format with null/empty extension for extension matching case)
- if one found: return
- if multiple found: return the first one
- if non-found: continue
3. Try to find a Format where the extension matches (exclude format with null/empty extension for extension matching case)
- if one found: return
- if multiple found: return the first one
- if non-found: continue
4. Try to find a Format where the mime-type matches
- if one found: return
- if multiple found: return the first one
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Format
findByFile(SchedulerSession session, File file)
static Format
findByFileName(SchedulerSession session, String fileName)
static Format
findByFileNameMimeType(SchedulerSession session, String fileName, String mimeType)
static Format
findByMimeType(SchedulerSession session, String mimeType)
static Format
getDefaultJobFileFormat(SchedulerSession session, Job job, JobFileType fileType, String jobFileName, Long fileOrder)
Get the fileFormat for this kind of output file.static String
getExtension(String fileName)
static Format
getFormat(SchedulerSession session, String extension, String mimeType)
-
-
-
Method Detail
-
findByFile
public static Format findByFile(SchedulerSession session, File file)
-
findByFileName
public static Format findByFileName(SchedulerSession session, String fileName)
-
findByMimeType
public static Format findByMimeType(SchedulerSession session, String mimeType)
-
findByFileNameMimeType
public static Format findByFileNameMimeType(SchedulerSession session, String fileName, String mimeType)
-
getFormat
public static Format getFormat(SchedulerSession session, String extension, String mimeType)
-
getDefaultJobFileFormat
public static Format getDefaultJobFileFormat(SchedulerSession session, Job job, JobFileType fileType, String jobFileName, Long fileOrder) throws IOException
Get the fileFormat for this kind of output file. FileType can be one of the standard choices Output or Log. It is fine to determine which kind of file type is associated to the log-output of this job definition.- Parameters:
session
-job
-fileType
-jobFileName
-fileOrder
-- Returns:
- file format
- Throws:
IOException
-
-