Interface ProfileActivationContext

All Known Implementing Classes:
DefaultProfileActivationContext

public interface ProfileActivationContext
Describes the environmental context used to determine the activation status of profiles. The Model is available from the activation context, but only static parts of it are allowed to be used, i.e. those that do not change between file model and effective model.
  • Method Details

    • isProfileActive

      boolean isProfileActive(@Nonnull String profileId)
      Checks if the specified profile has been explicitly activated.
      Parameters:
      profileId - the profile id
      Returns:
      whether the profile has been activated
    • isProfileInactive

      boolean isProfileInactive(@Nonnull String profileId)
      Checks if the specified profile has been explicitly deactivated.
      Parameters:
      profileId - the profile id
      Returns:
      whether the profile has been deactivated
    • getSystemProperty

      @Nullable String getSystemProperty(@Nonnull String key)
      Gets the system property to use for interpolation and profile activation. The system properties are collected from the runtime environment like System.getProperties() and environment variables.
      Parameters:
      key - the name of the system property
      Returns:
      the system property for the specified key, or null
    • getUserProperty

      @Nullable String getUserProperty(@Nonnull String key)
      Gets the user property to use for interpolation and profile activation. The user properties have been configured directly by the user on his discretion, e.g. via the -Dkey=value parameter on the command line.
      Parameters:
      key - the name of the user property
      Returns:
      The user property for the specified key, or null.
    • getModelProperty

      @Nullable String getModelProperty(@Nonnull String key)
      Gets the model property to use for interpolation and profile activation.
      Parameters:
      key - the name of the model property
      Returns:
      The model property for the specified key, or null;
    • getModelArtifactId

      @Nullable String getModelArtifactId()
      Gets the artifactId from the current model.
      Returns:
      The artifactId of the current model, or null if not set.
    • getModelPackaging

      @Nullable String getModelPackaging()
      Gets the packaging type from the current model.
      Returns:
      The packaging type of the current model, or null if not set.
    • getModelRootDirectory

      @Nullable String getModelRootDirectory()
      Gets the root directory of the current model.
      Returns:
      The root directory path of the current model, or null if not set.
    • getModelBaseDirectory

      @Nullable String getModelBaseDirectory()
      Gets the base directory of the current model.
      Returns:
      The base directory path of the current model, or null if not set.
    • interpolatePath

      @Nullable String interpolatePath(@Nullable String path)
      Interpolates the given path string using the current context's properties.
      Parameters:
      path - The path string to interpolate
      Returns:
      The interpolated path string
      Throws:
      InterpolatorException - if an error occurs during interpolation
    • exists

      boolean exists(@Nullable String path, boolean glob)
      Checks if a file or directory matching the given glob pattern exists at the specified path.
      Parameters:
      path - the base path to check
      glob - whether the path can be a glob expression
      Returns:
      true if a matching file exists, false otherwise
      Throws:
      ModelBuilderException - if an error occurs while checking the path
      InterpolatorException - if an error occurs during interpolation