Search in sources :

Example 1 with SoftPolicy

use of org.fagu.fmv.soft.find.SoftPolicy in project fmv by f-agu.

the class VersionSoftPolicy method byProperties.

/**
 * @param versionSoftInfo
 * @return
 */
private SoftFound byProperties(VersionSoftInfo versionSoftInfo) {
    Optional<String> propertyMinVersion = getProperty(versionSoftInfo, "minversion");
    if (propertyMinVersion.isPresent()) {
        Version minVersion = Version.parse(propertyMinVersion.get());
        SoftPolicy onAllPlatforms = new VersionSoftPolicy().onAllPlatforms(minVersion(minVersion));
        return ((VersionSoftPolicy) onAllPlatforms).byDefined(versionSoftInfo);
    }
    return null;
}
Also used : Version(org.fagu.version.Version) SoftPolicy(org.fagu.fmv.soft.find.SoftPolicy)

Example 2 with SoftPolicy

use of org.fagu.fmv.soft.find.SoftPolicy in project fmv by f-agu.

the class PdfSoftProvider method getDefaultSoftPolicy.

// ***********************************************************************
/**
 * @return
 */
private static SoftPolicy getDefaultSoftPolicy() {
    Version v012 = new Version(0, 12);
    BiPredicate<SoftInfo, Provider> isProvider = (s, p) -> s instanceof XPdfVersionSoftInfo && ((XPdfVersionSoftInfo) s).getProvider() == p;
    return new VersionSoftPolicy().on("xpdf", s -> isProvider.test(s, Provider.XPDF), minVersion(Version.V3)).on("poppler", s -> isProvider.test(s, Provider.POPPLER), minVersion(v012)).onAllPlatforms(minVersion(v012));
}
Also used : Arrays(java.util.Arrays) VersionParserManager(org.fagu.version.VersionParserManager) SoftFound(org.fagu.fmv.soft.find.SoftFound) ProgramFilesLocatorSupplier(org.fagu.fmv.soft.win32.ProgramFilesLocatorSupplier) ArrayList(java.util.ArrayList) SoftProvider(org.fagu.fmv.soft.find.SoftProvider) BiPredicate(java.util.function.BiPredicate) Matcher(java.util.regex.Matcher) VersionSoftPolicy(org.fagu.fmv.soft.find.policy.VersionSoftPolicy) ObjectUtils(org.apache.commons.lang3.ObjectUtils) ExceptionKnownAnalyzer(org.fagu.fmv.soft.exec.exception.ExceptionKnownAnalyzer) XpdfExceptionKnownAnalyzer(org.fagu.fmv.soft.xpdf.exception.XpdfExceptionKnownAnalyzer) Soft(org.fagu.fmv.soft.Soft) SoftFoundFactory(org.fagu.fmv.soft.find.SoftFoundFactory) SoftLocator(org.fagu.fmv.soft.find.SoftLocator) SoftPolicy(org.fagu.fmv.soft.find.SoftPolicy) SystemUtils(org.apache.commons.lang3.SystemUtils) SoftInfo(org.fagu.fmv.soft.find.SoftInfo) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) VersionSoftPolicy.minVersion(org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion) List(java.util.List) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Pattern(java.util.regex.Pattern) Version(org.fagu.version.Version) Collections(java.util.Collections) SoftExecutor(org.fagu.fmv.soft.SoftExecutor) SoftInfo(org.fagu.fmv.soft.find.SoftInfo) VersionSoftPolicy(org.fagu.fmv.soft.find.policy.VersionSoftPolicy) VersionSoftPolicy.minVersion(org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion) Version(org.fagu.version.Version) SoftProvider(org.fagu.fmv.soft.find.SoftProvider)

Aggregations

SoftPolicy (org.fagu.fmv.soft.find.SoftPolicy)2 Version (org.fagu.version.Version)2 File (java.io.File)1 IOException (java.io.IOException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 BiPredicate (java.util.function.BiPredicate)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 ObjectUtils (org.apache.commons.lang3.ObjectUtils)1 SystemUtils (org.apache.commons.lang3.SystemUtils)1 Soft (org.fagu.fmv.soft.Soft)1 SoftExecutor (org.fagu.fmv.soft.SoftExecutor)1 ExceptionKnownAnalyzer (org.fagu.fmv.soft.exec.exception.ExceptionKnownAnalyzer)1 Parser (org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser)1 SoftFound (org.fagu.fmv.soft.find.SoftFound)1