java.lang.Object
eu.sealsproject.platform.res.tool.impl.AbstractPlugin
All Implemented Interfaces:
eu.sealsproject.platform.res.domain.omt.IOntologyMatchingToolBridge, eu.sealsproject.platform.res.tool.api.IPlugin, eu.sealsproject.platform.res.tool.api.IToolBridge

public class MatcherSeals
extends MatcherFile
This matcher wraps the SEALS client such that a SEALS zip file or folder can be executed. If multiple matcher should be instantiated, have a look at MatcherSealsBuilder buildFromFolder.
  • Field Details

    • SEALS_DOWNLOAD_URL_VERSION

      private static final String SEALS_DOWNLOAD_URL_VERSION
      See Also:
      Constant Field Values
    • SEALS_DOWNLOAD_URL

      private static final String SEALS_DOWNLOAD_URL
      See Also:
      Constant Field Values
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • matcherFolder

      private File matcherFolder
      The folder which represents one matcher.
    • sealsClientJar

      private File sealsClientJar
      Path to the JAR of the SEALS client.
    • tmpFolder

      private File tmpFolder
      Path to a temporary folder. Default is set to the systems tmp. In this folder creates folders will be created and can be removed after execution.
    • timeout

      private long timeout
      Time out for the external seals process. The timeout is applied for each testcase and not track.
    • timeoutTimeUnit

      private TimeUnit timeoutTimeUnit
      Time unit for the process time out.
    • javaRuntimeParameters

      private List<String> javaRuntimeParameters
      The parameters that appear between java [parameters] -jar. Example: ("-Xmx25g", "-Xms15g").
    • freshMatcherInstance

      private boolean freshMatcherInstance
      If true, the original matcher folder is untouched and the folder is copied. Some matchers require this, because the do not close some resources.
    • doNotUseInputAlignment

      private boolean doNotUseInputAlignment
      If true, the input alignment is not passed to SEALS even if one is provided.
    • javaCommand

      private String javaCommand
      The command to start java in the terminal. Typically, this is "java" Seals needs java version 1.8
    • matcherNamePattern

      private static final Pattern matcherNamePattern
      Regex pattern to get the matcher name from the SEALS descriptor.xml file.
  • Constructor Details

    • MatcherSeals

      public MatcherSeals​(File matcherFileOrFolder, File sealsClientJar, File tmpFolder, long timeout, TimeUnit timeoutTimeUnit, List<String> javaRuntimeParameters, boolean freshMatcherInstance, boolean doNotUseInputAlignment, String javaCommand)
      Constructor with all parameters. IMPORTANT: the sealsHome folder will be deleted (do not use any folder which contains content). USE IT WITH CARE. The Seals client will be downloaded on demand, if necessary.
      Parameters:
      matcherFileOrFolder - The file (zip file) or folder which represents one matcher.
      sealsClientJar - The path to the local SEALS client JAR file.
      tmpFolder - folder to store the matcher temporary.
      timeout - Timeout for one testcase as long.
      timeoutTimeUnit - The unit of the timeout.
      javaRuntimeParameters - Runtime parameters such as ("-Xmx25g", "-Xms15g").
      freshMatcherInstance - If true, the original matcher folder is untouched and the folder is copied
      doNotUseInputAlignment - If true, the input alignment is not passed to SEALS even if one is provided.
      javaCommand - the java 1.8 command on the system. usually it is just java
    • MatcherSeals

      public MatcherSeals​(File matcherFileOrFolder, File sealsClientJar, long timeout, TimeUnit timeoutTimeUnit, List<String> javaRuntimeParameters, boolean freshMatcherInstance, boolean doNotUseInputAlignment, String javaCommand)
    • MatcherSeals

      public MatcherSeals​(File matcherFileOrFolder, File sealsClientJar)
      Constructor with reasonable defaults like 12 hours timeout, no runtime parameter, java as the java command and no new matcher instance every time.
      Parameters:
      matcherFileOrFolder - The file (zip file) or folder which represents one matcher.
      sealsClientJar - the seals client jar
    • MatcherSeals

      public MatcherSeals​(File matcherFileOrFolder)
      The SEALS client will be search in the systems tmp directory with the name seals-omt-client-v7.0.5.jar.
      Parameters:
      matcherFileOrFolder - The file (zip file) or folder which represents one matcher.
    • MatcherSeals

      public MatcherSeals​(String matcherFileOrFolderPath)
      The SEALS client will be search in the systems tmp directory with the name seals-omt-client-v7.0.5.jar.
      Parameters:
      matcherFileOrFolderPath - The file (zip file) or folder which represents one matcher.
  • Method Details

    • getSealsDownloadUrlVersion

      public static String getSealsDownloadUrlVersion()
    • downloadSealsIfNecessary

      private static void downloadSealsIfNecessary​(File sealsClientJar)
    • prepareMatcherFolder

      private static File prepareMatcherFolder​(File tmpDirectory, File matcherFileOrFolder)
    • isJava8

      private boolean isJava8()
    • match

      public void match​(URL source, URL target, URL inputAlignment, File alignmentResult) throws Exception
      Specified by:
      match in class MatcherFile
      Throws:
      Exception
    • getFirstSubDirectoryRunnableInSeals

      public static File getFirstSubDirectoryRunnableInSeals​(File rootDir)
      This method visits all folders below the starting directory and returns the first directory which is runnable in seals. The traversing strategy is breadth first search.
      Parameters:
      rootDir - Path to the starting directory.
      Returns:
      The first directory which is runnable in seals or null if such a folder does not exist
    • copyDirectory

      private static void copyDirectory​(File targetDirectory, File sourceDirectory)
    • unzipToDirectory

      private static void unzipToDirectory​(File targetDirectory, File sourceFile, boolean deleteOnExit)
    • isDirectoryRunnableInSeals

      public static boolean isDirectoryRunnableInSeals​(File directory)
      Determines whether the specified directory is runnable in seals.
      Parameters:
      directory - Path to the directory.
      Returns:
      True if runnable, else false.
    • getName

      public String getName()
    • getMatcherFolder

      public File getMatcherFolder()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMatcherNameFromSealsDescriptor

      public static String getMatcherNameFromSealsDescriptor​(File file)
      Returns the matcher name in the seals descriptor.
      Parameters:
      file - File instance which points to a descriptor file or a matcher directory.
      Returns:
      name of the matcher or MatcherSeals-randomNumber if not available.
    • getDefaultMatcherName

      private static String getDefaultMatcherName()
    • getSealsClientJar

      public File getSealsClientJar()
    • setSealsClientJar

      public void setSealsClientJar​(File sealsClientJar)
    • getJavaCommand

      public String getJavaCommand()
    • setJavaCommand

      public void setJavaCommand​(String javaCommand)
    • getTimeoutAsText

      public String getTimeoutAsText()