com.atlassian.bamboo.v2.build.agent.capability
Class ExecutablePathUtils

java.lang.Object
  extended by com.atlassian.bamboo.v2.build.agent.capability.ExecutablePathUtils

public final class ExecutablePathUtils
extends java.lang.Object


Method Summary
static java.io.File detectExecutableOnPath(java.lang.String executableName)
          Detects the executable home directory and validates that it matches the required pattern using existsInHomeBinExePattern(String, String)
static boolean existsInHomeBinExePattern(java.lang.String homePath, java.lang.String executableName)
          Validates that the executable exists at the path ${homePath}/bin/${executableName} Appends ".bat" to the executable name if the platform is Windows
static java.io.File findExecutable(java.lang.String executableName, com.google.common.base.Predicate<java.io.File> validityPredicate, java.lang.String envHomeDir, java.lang.String fhsHome)
          This method will return the executable home path, searching first in environment home, then on PATH, finally in a FHS - compliant directory.
static java.lang.String findExecutablePath(java.lang.String executableName)
          Finds the path of the executable given its name.
static java.io.File getHomeFromExecutableInHomeBin(java.io.File executable)
          Gets the home directory for an executable if its parent directory is 'bin'
static java.lang.String makeBatchIfOnWindows(java.lang.String builder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

existsInHomeBinExePattern

public static boolean existsInHomeBinExePattern(@Nullable
                                                java.lang.String homePath,
                                                @NotNull
                                                java.lang.String executableName)
Validates that the executable exists at the path ${homePath}/bin/${executableName} Appends ".bat" to the executable name if the platform is Windows

Parameters:
homePath -
executableName -
Returns:
matches

makeBatchIfOnWindows

@NotNull
public static java.lang.String makeBatchIfOnWindows(java.lang.String builder)

detectExecutableOnPath

@Nullable
public static java.io.File detectExecutableOnPath(@NotNull
                                                           java.lang.String executableName)
Detects the executable home directory and validates that it matches the required pattern using existsInHomeBinExePattern(String, String)

Parameters:
executableName - of the builder executable
Returns:
home

getHomeFromExecutableInHomeBin

@Nullable
public static java.io.File getHomeFromExecutableInHomeBin(@NotNull
                                                                   java.io.File executable)
Gets the home directory for an executable if its parent directory is 'bin'

Parameters:
executable - the executable file used to detect the home directory
Returns:
homeDir

findExecutable

@Nullable
public static java.io.File findExecutable(@NotNull
                                                   java.lang.String executableName,
                                                   @Nullable
                                                   com.google.common.base.Predicate<java.io.File> validityPredicate,
                                                   @Nullable
                                                   java.lang.String envHomeDir,
                                                   @Nullable
                                                   java.lang.String fhsHome)
This method will return the executable home path, searching first in environment home, then on PATH, finally in a FHS - compliant directory.

Parameters:
executableName - executable name to search for
validityPredicate - predicate used to validate the executable path
envHomeDir - home directory from environment
fhsHome - FHS-compliant home directory
Returns:
file to executable

findExecutablePath

@Nullable
public static java.lang.String findExecutablePath(@NotNull
                                                           java.lang.String executableName)
Finds the path of the executable given its name.

Parameters:
executableName - of the executable
Returns:
path


Copyright © 2012 Atlassian. All Rights Reserved.