com.android.ide.common.repository
Enum SdkMavenRepository

java.lang.Object
  extended by java.lang.Enum<SdkMavenRepository>
      extended by com.android.ide.common.repository.SdkMavenRepository
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<SdkMavenRepository>

public enum SdkMavenRepository
extends java.lang.Enum<SdkMavenRepository>

A SdkMavenRepository represents a Maven repository that is shipped with the SDK and located in the extras folder of the SDK location.


Enum Constant Summary
ANDROID
          The Android repository; contains support lib, app compat, media router, etc
GOOGLE
          The Google repository; contains Play Services etc
 
Method Summary
static SdkMavenRepository getByGroupId(java.lang.String groupId)
           
 java.lang.String getDirName()
          The directory name of the repository inside the extras folder
 GradleCoordinate getHighestInstalledVersion(java.io.File sdkHome, java.lang.String groupId, java.lang.String artifactId, java.lang.String filter, boolean allowPreview)
          Deprecated. For testability use getHighestInstalledVersion(File, String, String, String, boolean, FileOp)
 GradleCoordinate getHighestInstalledVersion(java.io.File sdkHome, java.lang.String groupId, java.lang.String artifactId, java.lang.String filter, boolean allowPreview, com.android.repository.io.FileOp fileOp)
          Find the best matching GradleCoordinate
static GradleCoordinate getHighestInstalledVersion(java.lang.String groupId, java.lang.String artifactId, java.io.File repository, java.lang.String filter, boolean allowPreview)
          Deprecated. For testability, use getHighestInstalledVersion(String, String, File, String, boolean, FileOp).
static GradleCoordinate getHighestInstalledVersion(java.lang.String groupId, java.lang.String artifactId, java.io.File repository, java.lang.String filter, boolean allowPreview, com.android.repository.io.FileOp fileOp)
          Find the best matching GradleCoordinate
 java.lang.String getPackageId()
           
 java.io.File getRepositoryLocation(java.io.File sdkHome, boolean requireExists)
          Deprecated. For testability, use getRepositoryLocation(File, boolean, FileOp).
 java.io.File getRepositoryLocation(java.io.File sdkHome, boolean requireExists, com.android.repository.io.FileOp fileOp)
          Returns the location of the repository within a given SDK home
 boolean isInstalled(com.android.sdklib.repositoryv2.AndroidSdkHandler sdkHandler)
          Returns true if the given SDK repository is installed
 boolean isInstalled(java.io.File sdkHome, com.android.repository.io.FileOp fileOp)
          Returns true if the given SDK repository is installed
static SdkMavenRepository valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static SdkMavenRepository[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ANDROID

public static final SdkMavenRepository ANDROID
The Android repository; contains support lib, app compat, media router, etc


GOOGLE

public static final SdkMavenRepository GOOGLE
The Google repository; contains Play Services etc

Method Detail

values

public static SdkMavenRepository[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SdkMavenRepository c : SdkMavenRepository.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SdkMavenRepository valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getRepositoryLocation

@Deprecated
@Nullable
public java.io.File getRepositoryLocation(@Nullable
                                                              java.io.File sdkHome,
                                                              boolean requireExists)
Deprecated. For testability, use getRepositoryLocation(File, boolean, FileOp).


getRepositoryLocation

public java.io.File getRepositoryLocation(@Nullable
                                          java.io.File sdkHome,
                                          boolean requireExists,
                                          @NonNull
                                          com.android.repository.io.FileOp fileOp)
Returns the location of the repository within a given SDK home

Parameters:
sdkHome - the SDK home, or null
requireExists - if true, the location will only be returned if it also exists
Returns:
the location of the this repository within a given SDK

isInstalled

public boolean isInstalled(@Nullable
                           java.io.File sdkHome,
                           @NonNull
                           com.android.repository.io.FileOp fileOp)
Returns true if the given SDK repository is installed

Parameters:
sdkHome - the SDK installation location
Returns:
true if the repository is installed

isInstalled

public boolean isInstalled(@Nullable
                           com.android.sdklib.repositoryv2.AndroidSdkHandler sdkHandler)
Returns true if the given SDK repository is installed

Parameters:
sdkHandler - the SDK to check
Returns:
true if the repository is installed

getPackageId

public java.lang.String getPackageId()

getHighestInstalledVersion

@Deprecated
public GradleCoordinate getHighestInstalledVersion(@Nullable
                                                              java.io.File sdkHome,
                                                              @NonNull
                                                              java.lang.String groupId,
                                                              @NonNull
                                                              java.lang.String artifactId,
                                                              @Nullable
                                                              java.lang.String filter,
                                                              boolean allowPreview)
Deprecated. For testability use getHighestInstalledVersion(File, String, String, String, boolean, FileOp)


getHighestInstalledVersion

@Nullable
public GradleCoordinate getHighestInstalledVersion(@Nullable
                                                            java.io.File sdkHome,
                                                            @NonNull
                                                            java.lang.String groupId,
                                                            @NonNull
                                                            java.lang.String artifactId,
                                                            @Nullable
                                                            java.lang.String filter,
                                                            boolean allowPreview,
                                                            @NonNull
                                                            com.android.repository.io.FileOp fileOp)
Find the best matching GradleCoordinate

Parameters:
sdkHome - the SDK installation
groupId - the artifact group id
artifactId - the artifact id
filter - an optional filter which the matched coordinate's version name must start with
allowPreview - whether preview versions are allowed to match
fileOp - To allow mocking of filesystem operations.
Returns:
the best (highest version) matching coordinate, or null if none were found

getHighestInstalledVersion

@Deprecated
@Nullable
public static GradleCoordinate getHighestInstalledVersion(@NonNull
                                                                              java.lang.String groupId,
                                                                              @NonNull
                                                                              java.lang.String artifactId,
                                                                              @NonNull
                                                                              java.io.File repository,
                                                                              @Nullable
                                                                              java.lang.String filter,
                                                                              boolean allowPreview)
Deprecated. For testability, use getHighestInstalledVersion(String, String, File, String, boolean, FileOp).


getHighestInstalledVersion

@Nullable
public static GradleCoordinate getHighestInstalledVersion(@NonNull
                                                                   java.lang.String groupId,
                                                                   @NonNull
                                                                   java.lang.String artifactId,
                                                                   @NonNull
                                                                   java.io.File repository,
                                                                   @Nullable
                                                                   java.lang.String filter,
                                                                   boolean allowPreview,
                                                                   @NonNull
                                                                   com.android.repository.io.FileOp fileOp)
Find the best matching GradleCoordinate

Parameters:
groupId - the artifact group id
artifactId - the artifact id
repository - the path to the m2repository directory
filter - an optional filter which the matched coordinate's version name must start with
allowPreview - whether preview versions are allowed to match
Returns:
the best (highest version) matching coordinate, or null if none were found

getByGroupId

@Nullable
public static SdkMavenRepository getByGroupId(@NonNull
                                                       java.lang.String groupId)

getDirName

@NonNull
public java.lang.String getDirName()
The directory name of the repository inside the extras folder