Package org.artifactory.repo
Interface Repositories
-
public interface Repositories
Public API for working with repositories- Author:
- Fred Simon
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description StatusHolder
copy(RepoPath source, RepoPath target)
Copies the source repoPath to the targetRepoPathStatusHolder
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.StatusHolder
delete(RepoPath repoPath)
Deletes the specified repoPath.StatusHolder
deleteAtomic(RepoPath repoPath)
Deletes the specified repoPath.void
deleteProperty(RepoPath repoPath, String propertyName)
Deletes the property from the item.StatusHolder
deploy(RepoPath repoPath, InputStream inputStream)
Deploy an artifactboolean
exists(RepoPath repoPath)
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.long
getArtifactsCount(RepoPath repoPath)
Returns the total number of file artifacts under the provided directory repo path.long
getArtifactsSize(RepoPath repoPath)
Returns the total storage size of the file artifacts under the given directory repo path.List<ItemInfo>
getChildren(RepoPath repoPath)
ResourceStreamHandle
getContent(RepoPath repoPath)
Get a stream handle for the file contentRepoPath
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.List<String>
getFederatedRepositories()
Returns a list of keys of federated repositoriesFileInfo
getFileInfo(RepoPath repoPath)
ItemInfo
getItemInfo(RepoPath repoPath)
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.List<String>
getLocalRepositories()
Returns a list of keys of local repositoriesProperties
getProperties(RepoPath repoPath)
String
getProperty(RepoPath repoPath, String propertyName)
Set<String>
getPropertyValues(RepoPath repoPath, String propertyName)
List<String>
getRemoteRepositories()
Returns a list of keys of remote repositoriesRepositoryConfiguration
getRepositoryConfiguration(String repoKey)
StatsInfo
getStats(RepoPath repoPath)
Returns statistics for therepoPath
, which include downloads count, last download time and last downloader's name.String
getStringContent(FileInfo fileInfo)
Deprecated.UsegetStringContent(RepoPath)
()}String
getStringContent(RepoPath repoPath)
Get the content of a file as a stringList<String>
getVirtualRepositories()
Returns a list of keys of virtual repositoriesboolean
hasProperty(RepoPath repoPath, String propertyName)
boolean
isLcoalRepoPathHandled(RepoPath repoPath)
Deprecated.UseisRepoPathHandled(RepoPath)
()}boolean
isLocalRepoPathAccepted(RepoPath repoPath)
Deprecated.UseisRepoPathAccepted(RepoPath)
()}boolean
isRepoPathAccepted(RepoPath repoPath)
Checks if the specified repoPath is accepted by the include/exclude rules of the repoPath's repository.boolean
isRepoPathHandled(RepoPath repoPath)
Checks if the specified repoPath is handled by the snapshot(integration)/release policy of the repoPath's repository.StatusHolder
move(RepoPath source, RepoPath target)
Moves the source repoPath to the targetRepoPathStatusHolder
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.Properties
setProperty(RepoPath repoPath, String propertyName, String... values)
Properties
setPropertyRecursively(RepoPath repoPath, String propertyName, String... values)
String
translateFilePath(RepoPath source, String targetRepoKey)
Translates the path of a file from source repository layout to target's one.StatusHolder
undeploy(RepoPath repoPath)
Deprecated.UsedeleteAtomic(RepoPath)
ordelete(RepoPath)
instead
-
-
-
Method Detail
-
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.
-
getStringContent
@Deprecated String getStringContent(FileInfo fileInfo)
Deprecated.UsegetStringContent(RepoPath)
()}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 callResourceStreamHandle.close()
on the resourceStreamHandle after usage, to avoid leaking resources! - Since:
- 2.4.0
-
getProperties
Properties getProperties(RepoPath repoPath)
-
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 pathpropertyName
- 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.UsedeleteAtomic(RepoPath)
ordelete(RepoPath)
instead- 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.UseisRepoPathHandled(RepoPath)
()}
-
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.UseisRepoPathAccepted(RepoPath)
()}
-
move
StatusHolder move(RepoPath source, RepoPath target)
Moves the source repoPath to the targetRepoPath- Parameters:
source
- - A source repository pathtarget
- - 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 pathtarget
- - 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 pathtarget
- - 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 pathtarget
- - 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 pathtargetRepoKey
- 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 fromrepoKey
- 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 fromrepoKey
- 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
-
-