Package org.artifactory.repo
Interface Repositories
-
public interface RepositoriesPublic API for working with repositories- Author:
- Fred Simon
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description StatusHoldercopy(RepoPath source, RepoPath target)Copies the source repoPath to the targetRepoPathStatusHoldercopyAtomic(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.StatusHolderdelete(RepoPath repoPath)Deletes the specified repoPath.StatusHolderdeleteAtomic(RepoPath repoPath)Deletes the specified repoPath.voiddeleteProperty(RepoPath repoPath, java.lang.String propertyName)Deletes the property from the item.StatusHolderdeploy(RepoPath repoPath, java.io.InputStream inputStream)Deploy an artifactbooleanexists(RepoPath repoPath)RepoPathgetArtifactRepoPath(FileLayoutInfo layoutInfo, java.lang.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.longgetArtifactsCount(RepoPath repoPath)Returns the total number of file artifacts under the provided directory repo path.longgetArtifactsSize(RepoPath repoPath)Returns the total storage size of the file artifacts under the given directory repo path.java.util.List<ItemInfo>getChildren(RepoPath repoPath)ResourceStreamHandlegetContent(RepoPath repoPath)Get a stream handle for the file contentRepoPathgetDescriptorRepoPath(FileLayoutInfo layoutInfo, java.lang.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.FileInfogetFileInfo(RepoPath repoPath)ItemInfogetItemInfo(RepoPath repoPath)FileLayoutInfogetLayoutInfo(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.java.util.List<java.lang.String>getLocalRepositories()Returns a list of keys of local repositoriesPropertiesgetProperties(RepoPath repoPath)java.lang.StringgetProperty(RepoPath repoPath, java.lang.String propertyName)java.util.Set<java.lang.String>getPropertyValues(RepoPath repoPath, java.lang.String propertyName)java.util.List<java.lang.String>getRemoteRepositories()Returns a list of keys of remote repositoriesRepositoryConfigurationgetRepositoryConfiguration(java.lang.String repoKey)StatsInfogetStats(RepoPath repoPath)Returns statistics for therepoPath, which include downloads count, last download time and last downloader's name.java.lang.StringgetStringContent(FileInfo fileInfo)Deprecated.UsegetStringContent(RepoPath)()}java.lang.StringgetStringContent(RepoPath repoPath)Get the content of a file as a stringjava.util.List<java.lang.String>getVirtualRepositories()Returns a list of keys of virtual repositoriesbooleanhasProperty(RepoPath repoPath, java.lang.String propertyName)booleanisLcoalRepoPathHandled(RepoPath repoPath)Deprecated.UseisRepoPathHandled(RepoPath)()}booleanisLocalRepoPathAccepted(RepoPath repoPath)Deprecated.UseisRepoPathAccepted(RepoPath)()}booleanisRepoPathAccepted(RepoPath repoPath)Checks if the specified repoPath is accepted by the include/exclude rules of the repoPath's repository.booleanisRepoPathHandled(RepoPath repoPath)Checks if the specified repoPath is handled by the snapshot(integration)/release policy of the repoPath's repository.StatusHoldermove(RepoPath source, RepoPath target)Moves the source repoPath to the targetRepoPathStatusHoldermoveAtomic(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.PropertiessetProperty(RepoPath repoPath, java.lang.String propertyName, java.lang.String... values)PropertiessetPropertyRecursively(RepoPath repoPath, java.lang.String propertyName, java.lang.String... values)java.lang.StringtranslateFilePath(RepoPath source, java.lang.String targetRepoKey)Translates the path of a file from source repository layout to target's one.StatusHolderundeploy(RepoPath repoPath)Deprecated.UsedeleteAtomic(RepoPath)ordelete(RepoPath)instead
-
-
-
Method Detail
-
getLocalRepositories
@Nonnull java.util.List<java.lang.String> getLocalRepositories()
Returns a list of keys of local repositories- Returns:
- keys of local repositories
-
getRemoteRepositories
@Nonnull java.util.List<java.lang.String> getRemoteRepositories()
Returns a list of keys of remote repositories- Returns:
- keys of remote repositories
-
getVirtualRepositories
@Nonnull java.util.List<java.lang.String> getVirtualRepositories()
Returns a list of keys of virtual repositories- Returns:
- keys of virtual repositories
-
getRepositoryConfiguration
RepositoryConfiguration getRepositoryConfiguration(java.lang.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 java.lang.String getStringContent(FileInfo fileInfo)
Deprecated.UsegetStringContent(RepoPath)()}Get the content of a file as a string- Returns:
- The file's content as string
-
getStringContent
java.lang.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)
-
hasProperty
boolean hasProperty(RepoPath repoPath, java.lang.String propertyName)
-
getPropertyValues
java.util.Set<java.lang.String> getPropertyValues(RepoPath repoPath, java.lang.String propertyName)
-
getProperty
java.lang.String getProperty(RepoPath repoPath, java.lang.String propertyName)
-
setProperty
Properties setProperty(RepoPath repoPath, java.lang.String propertyName, java.lang.String... values)
-
setPropertyRecursively
Properties setPropertyRecursively(RepoPath repoPath, java.lang.String propertyName, java.lang.String... values)
-
deleteProperty
void deleteProperty(RepoPath repoPath, java.lang.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, java.io.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
java.lang.String translateFilePath(RepoPath source, java.lang.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, java.lang.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, java.lang.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
-
-