Interface Repositories


public interface Repositories
Public API for working with repositories
Author:
Fred Simon
  • Method Details

    • getLocalRepositories

      @Nonnull List<String> getLocalRepositories()
      Returns a list of keys of local repositories
      Returns:
      keys of local repositories
    • getFederatedRepositories

      @Nonnull List<String> getFederatedRepositories()
      Returns a list of keys of federated repositories
      Returns:
      keys of federated repositories
    • getRemoteRepositories

      @Nonnull List<String> getRemoteRepositories()
      Returns a list of keys of remote repositories
      Returns:
      keys of remote repositories
    • getVirtualRepositories

      @Nonnull List<String> getVirtualRepositories()
      Returns a list of keys of virtual repositories
      Returns:
      keys of virtual repositories
    • getRepositoryConfiguration

      @Nullable RepositoryConfiguration getRepositoryConfiguration(String repoKey)
    • getItemInfo

      ItemInfo getItemInfo(RepoPath repoPath)
      Parameters:
      repoPath - Repository path of the item
      Returns:
      Folder or file info. Throws exception if the path doesn't exist.
    • getFileInfo

      FileInfo getFileInfo(RepoPath repoPath)
      Parameters:
      repoPath - Repository path of the file
      Returns:
      The file info. Throws exception if the path doesn't exist or it doesn't point to a file.
    • getChildren

      List<ItemInfo> getChildren(RepoPath repoPath)
    • getStringContent

      @Deprecated String getStringContent(FileInfo fileInfo)
      Deprecated.
      Get the content of a file as a string
      Returns:
      The file's content as string
    • getStringContent

      String getStringContent(RepoPath repoPath)
      Get the content of a file as a string
      Parameters:
      repoPath - The repoPath of the file
      Returns:
      The file's content as string
      Since:
      2.4.0
    • getContent

      ResourceStreamHandle getContent(RepoPath repoPath)
      Get a stream handle for the file content
      Parameters:
      repoPath - The repoPath of the file
      Returns:
      The content stream handle for an existing file or a null-stream handler for a non exiting one.
      Note: The user must manually call ResourceStreamHandle.close() on the resourceStreamHandle after usage, to avoid leaking resources!
      Since:
      2.4.0
    • getProperties

      Properties getProperties(RepoPath repoPath)
    • hasProperty

      boolean hasProperty(RepoPath repoPath, String propertyName)
    • getPropertyValues

      Set<String> getPropertyValues(RepoPath repoPath, String propertyName)
    • getProperty

      String getProperty(RepoPath repoPath, String propertyName)
    • setProperty

      Properties setProperty(RepoPath repoPath, String propertyName, String... values)
    • setPropertyRecursively

      Properties setPropertyRecursively(RepoPath repoPath, String propertyName, String... values)
    • deleteProperty

      void deleteProperty(RepoPath repoPath, String propertyName)
      Deletes the property from the item.
      Parameters:
      repoPath - The item repo path
      propertyName - Property name to delete
    • exists

      boolean exists(RepoPath repoPath)
    • deploy

      StatusHolder deploy(RepoPath repoPath, InputStream inputStream)
      Deploy an artifact
      Returns:
      The result status for the deploy operation
    • delete

      StatusHolder delete(RepoPath repoPath)
      Deletes the specified repoPath. Directories are deleted recursively in multiple transactions.
      Parameters:
      repoPath - The repository path to delete
      Returns:
      Deletion status
      Since:
      3.7.0
    • deleteAtomic

      StatusHolder deleteAtomic(RepoPath repoPath)
      Deletes the specified repoPath. Directories are deleted recursively in a single transaction, which might be resource intensive when deleting very large directories.
      Parameters:
      repoPath - The repository path to delete
      Returns:
      Deletion status
      Since:
      2.4.0
    • undeploy

      @Deprecated StatusHolder undeploy(RepoPath repoPath)
      Deprecated.
      Parameters:
      repoPath - The repository path to delete
      Returns:
      Result of the undeploy operation
    • isRepoPathHandled

      boolean isRepoPathHandled(RepoPath repoPath)
      Checks if the specified repoPath is handled by the snapshot(integration)/release policy of the repoPath's repository.
      Returns:
      True if repoPath is handled by the snapshot(integration)/release policy of the repoPath's repository
    • isLcoalRepoPathHandled

      @Deprecated boolean isLcoalRepoPathHandled(RepoPath repoPath)
      Deprecated.
    • isRepoPathAccepted

      boolean isRepoPathAccepted(RepoPath repoPath)
      Checks if the specified repoPath is accepted by the include/exclude rules of the repoPath's repository.
      Returns:
      True if the specified repoPath is accepted by the include/exclude rules of the repoPath's repository
    • isLocalRepoPathAccepted

      @Deprecated boolean isLocalRepoPathAccepted(RepoPath repoPath)
      Deprecated.
    • move

      StatusHolder move(RepoPath source, RepoPath target)
      Moves the source repoPath to the targetRepoPath
      Parameters:
      source - - A source repository path
      target - - A target repository path
      Returns:
      The result status for the move operation
    • moveAtomic

      StatusHolder moveAtomic(RepoPath source, RepoPath target)
      Moves the source repoPath to the targetRepoPath , Directories are moved recursively in a single transaction, which might be resource intensive when moving very large directories.
      Parameters:
      source - - A source repository path
      target - - A target repository path
      Returns:
      The result status for the move operation
    • copy

      StatusHolder copy(RepoPath source, RepoPath target)
      Copies the source repoPath to the targetRepoPath
      Parameters:
      source - - A source repository path
      target - - A target repository path
      Returns:
      The result status for the copy operation
    • copyAtomic

      StatusHolder copyAtomic(RepoPath source, RepoPath target)
      Copies the source repoPath to the targetRepoPath , Directories are copied recursively in a single transaction, which might be resource intensive when copying very large directories.
      Parameters:
      source - - A source repository path
      target - - A target repository path
      Returns:
      The result status for the copy operation
    • getLayoutInfo

      FileLayoutInfo getLayoutInfo(RepoPath repoPath)
      Returns module related information (group, artifact, version, etc.) for given file, as it was extracted according to the layout of the repository the file is part of. * @param repoPath the file path
      Returns:
      the file layout information, which can be empty in case of incorrect repoPath or when the layout can't be determined
    • translateFilePath

      String translateFilePath(RepoPath source, String targetRepoKey)
      Translates the path of a file from source repository layout to target's one.
      Parameters:
      source - the source repository path
      targetRepoKey - the target repository key
      Returns:
      the file path according to target repository layout
    • getArtifactRepoPath

      RepoPath getArtifactRepoPath(FileLayoutInfo layoutInfo, String repoKey)
      Returns actual repository path for layout information (group, artifact, version, etc.) of an artifact as it is built according to the layout of the repository.
      Parameters:
      layoutInfo - the layout information to build the path from
      repoKey - the repository the path will be in
      Returns:
      the repository path to the file
    • getDescriptorRepoPath

      RepoPath getDescriptorRepoPath(FileLayoutInfo layoutInfo, String repoKey)
      Returns actual repository path for layout information (group, artifact, version, etc.) of a descriptor as it is built according to the layout of the repository.
      Parameters:
      layoutInfo - the layout information to build the path from
      repoKey - the repository the path will be in
      Returns:
      the repository path to the file
    • getArtifactsCount

      long getArtifactsCount(RepoPath repoPath)
      Returns the total number of file artifacts under the provided directory repo path. Repository root repo path will return the total number of artifacts in the given repository.
      Parameters:
      repoPath - Repo path to count artifacts under
      Returns:
      Total number of artifacts under the given repo path.
    • getArtifactsSize

      long getArtifactsSize(RepoPath repoPath)
      Returns the total storage size of the file artifacts under the given directory repo path.
      Parameters:
      repoPath - Repo path to return total storage under
      Returns:
      Total size (in bytes) of the artifacts under the given repo path
    • getStats

      @Nullable StatsInfo getStats(RepoPath repoPath)
      Returns statistics for the repoPath, which include downloads count, last download time and last downloader's name.
      Parameters:
      repoPath - to return downloads statistics for
      Returns:
      StatsInfo which provides data about downloads, may be null