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 com.redwood.scheduler.api.model.Format
findByFile(com.redwood.scheduler.api.model.SchedulerSession session, File file)
static com.redwood.scheduler.api.model.Format
findByFileName(com.redwood.scheduler.api.model.SchedulerSession session, String fileName)
static com.redwood.scheduler.api.model.Format
findByFileNameMimeType(com.redwood.scheduler.api.model.SchedulerSession session, String fileName, String mimeType)
static com.redwood.scheduler.api.model.Format
findByMimeType(com.redwood.scheduler.api.model.SchedulerSession session, String mimeType)
static com.redwood.scheduler.api.model.Format
getDefaultJobFileFormat(com.redwood.scheduler.api.model.SchedulerSession session, com.redwood.scheduler.api.model.Job job, com.redwood.scheduler.api.model.enumeration.JobFileType fileType, String jobFileName, Long fileOrder)
Get the fileFormat for this kind of output file.static String
getExtension(String fileName)
static com.redwood.scheduler.api.model.Format
getFormat(com.redwood.scheduler.api.model.SchedulerSession session, String extension, String mimeType)
-
-
-
Method Detail
-
findByFile
public static com.redwood.scheduler.api.model.Format findByFile(com.redwood.scheduler.api.model.SchedulerSession session, File file)
-
findByFileName
public static com.redwood.scheduler.api.model.Format findByFileName(com.redwood.scheduler.api.model.SchedulerSession session, String fileName)
-
findByMimeType
public static com.redwood.scheduler.api.model.Format findByMimeType(com.redwood.scheduler.api.model.SchedulerSession session, String mimeType)
-
findByFileNameMimeType
public static com.redwood.scheduler.api.model.Format findByFileNameMimeType(com.redwood.scheduler.api.model.SchedulerSession session, String fileName, String mimeType)
-
getFormat
public static com.redwood.scheduler.api.model.Format getFormat(com.redwood.scheduler.api.model.SchedulerSession session, String extension, String mimeType)
-
getDefaultJobFileFormat
public static com.redwood.scheduler.api.model.Format getDefaultJobFileFormat(com.redwood.scheduler.api.model.SchedulerSession session, com.redwood.scheduler.api.model.Job job, com.redwood.scheduler.api.model.enumeration.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
-
-