Package kr.motd.maven.os
Class Detector
java.lang.Object
kr.motd.maven.os.Detector
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
private final FileOperationProvider
private static final String
private static final String
private static final String[]
private static final String
private static final Pattern
private static final String
private final SystemPropertyOperationProvider
private static final String
private static final Pattern
-
Constructor Summary
ConstructorsConstructorDescriptionDetector()
Detector
(SystemPropertyOperationProvider systemPropertyOperationProvider, FileOperationProvider fileOperationProvider) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
closeQuietly
(Closeable obj) protected void
detect
(Properties props, List<String> classifierWithLikes) private int
determineBitness
(String architecture) private Detector.LinuxRelease
static int
protected abstract void
protected abstract void
logProperty
(String name, String value) private static String
private static String
normalizeArch
(String value) private static String
normalizeOs
(String value) private static String
normalizeOsReleaseValue
(String value) private Detector.LinuxRelease
parseLinuxOsReleaseFile
(String fileName) Parses a file in the format of/etc/os-release
and return aDetector.LinuxRelease
based on theID
,ID_LIKE
, andVERSION_ID
entries.private Detector.LinuxRelease
parseLinuxRedhatReleaseFile
(String fileName) Parses the/etc/redhat-release
and returns aDetector.LinuxRelease
containing the ID and like ["rhel", "fedora", ID].private void
setProperty
(Properties props, String name, String value)
-
Field Details
-
DETECTED_NAME
- See Also:
-
DETECTED_ARCH
- See Also:
-
DETECTED_BITNESS
- See Also:
-
DETECTED_VERSION
- See Also:
-
DETECTED_VERSION_MAJOR
- See Also:
-
DETECTED_VERSION_MINOR
- See Also:
-
DETECTED_CLASSIFIER
- See Also:
-
DETECTED_RELEASE
- See Also:
-
DETECTED_RELEASE_VERSION
- See Also:
-
DETECTED_RELEASE_LIKE_PREFIX
- See Also:
-
UNKNOWN
- See Also:
-
LINUX_ID_PREFIX
- See Also:
-
LINUX_ID_LIKE_PREFIX
- See Also:
-
LINUX_VERSION_ID_PREFIX
- See Also:
-
LINUX_OS_RELEASE_FILES
-
REDHAT_RELEASE_FILE
- See Also:
-
DEFAULT_REDHAT_VARIANTS
-
VERSION_REGEX
-
REDHAT_MAJOR_VERSION_REGEX
-
systemPropertyOperationProvider
-
fileOperationProvider
-
-
Constructor Details
-
Detector
public Detector() -
Detector
public Detector(SystemPropertyOperationProvider systemPropertyOperationProvider, FileOperationProvider fileOperationProvider)
-
-
Method Details
-
detect
-
setProperty
-
log
-
logProperty
-
normalizeOs
-
normalizeArch
-
normalize
-
getLinuxRelease
-
parseLinuxOsReleaseFile
Parses a file in the format of/etc/os-release
and return aDetector.LinuxRelease
based on theID
,ID_LIKE
, andVERSION_ID
entries. -
parseLinuxRedhatReleaseFile
Parses the/etc/redhat-release
and returns aDetector.LinuxRelease
containing the ID and like ["rhel", "fedora", ID]. Currently only supported for CentOS, Fedora, and RHEL. Other variants will returnnull
. -
normalizeOsReleaseValue
-
determineBitness
-
guessBitnessFromArchitecture
-
closeQuietly
-