View Javadoc
1   /*
2    * Licensed under the Apache License, Version 2.0 (the "License");
3    * you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    *
6    * http://www.apache.org/licenses/LICENSE-2.0
7    *
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS,
10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   * See the License for the specific language governing permissions and
12   * limitations under the License.
13   */
14  
15  package de.softwareforge.testing.postgres.embedded;
16  
17  import jakarta.annotation.Nonnull;
18  import java.io.File;
19  import java.io.IOException;
20  
21  /**
22   * Returns an installation location for a native binary. The implementation is responsible for locating and optionally unpacking installing the binary.
23   *
24   * @since 3.0
25   */
26  @FunctionalInterface
27  public interface NativeBinaryManager {
28  
29      /**
30       * Returns the location (installation directory) for the installed binary.
31       *
32       * @return Installation directory with the native binary installed.
33       * @throws IOException If the binary could not be located or installed.
34       */
35      @Nonnull
36      File getLocation() throws IOException;
37  
38      /**
39       * Sets the installation directory. This method must be called before the first call to {@link NativeBinaryManager#getLocation()}.
40       * <p>
41       * Implementing this method is optional if no local installation directory is required.
42       *
43       * @param installationBaseDirectory Base directory in which the binary distribution is unpacked. Must not be null.
44       */
45      default void setInstallationBaseDirectory(File installationBaseDirectory) {
46      }
47  }