org.artifactory.repo
Interface Repositories


public interface Repositories

Public API for working with repositories


Method Summary
 StatusHolder copy(RepoPath source, RepoPath target)
          Copies the source repoPath to the targetRepoPath
 StatusHolder delete(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 artifact
 boolean 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.
 List<ItemInfo> getChildren(RepoPath repoPath)
           
 ResourceStreamHandle getContent(RepoPath repoPath)
          Get a stream handle for the file content
 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.
 FileInfo 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 repositories
 MetadataInfo getMetadataInfo(RepoPath repoPath, String metadataName)
           
 List<String> getMetadataNames(RepoPath repoPath)
          Returns the available metadata names which are not internal
 Properties 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 repositories
 RepositoryConfiguration getRepositoryConfiguration(String repoKey)
           
 String getStringContent(FileInfo fileInfo)
          Deprecated. Use getStringContent(RepoPath) ()}
 String getStringContent(RepoPath repoPath)
          Get the content of a file as a string
 List<String> getVirtualRepositories()
          Returns a list of keys of virtual repositories
 String getXmlMetadata(RepoPath repoPath, String metadataName)
          Returns the metadata of the given name.
 boolean hasMetadata(RepoPath repoPath, String metadataName)
          Indicates whether this item adorns the given metadata
 boolean hasProperty(RepoPath repoPath, String propertyName)
           
 boolean isLcoalRepoPathHandled(RepoPath repoPath)
          Deprecated. Use isRepoPathHandled(RepoPath) ()}
 boolean isLocalRepoPathAccepted(RepoPath repoPath)
          Deprecated. Use isRepoPathAccepted(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 targetRepoPath
 void removeMetadata(RepoPath repoPath, String metadataName)
          Removes the metadata of the given name
 Properties setProperty(RepoPath repoPath, String propertyName, String... values)
           
 Properties setPropertyRecursively(RepoPath repoPath, String propertyName, String... values)
           
 void setXmlMetadata(RepoPath repoPath, String metadataName, String metadataContent)
          Sets the given metadata on the supplied repo path.
 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. Use delete(RepoPath) instead
 

Method Detail

getLocalRepositories

List<String> getLocalRepositories()
Returns a list of keys of local repositories

Returns:
keys of local repositories

getRemoteRepositories

List<String> getRemoteRepositories()
Returns a list of keys of remote repositories

Returns:
keys of remote repositories

getVirtualRepositories

List<String> getVirtualRepositories()
Returns a list of keys of virtual repositories

Returns:
keys of virtual repositories

getRepositoryConfiguration

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. Use getStringContent(RepoPath) ()}

Get the content of a file as a string

Parameters:
fileInfo -
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

getMetadataInfo

@Nullable
MetadataInfo getMetadataInfo(RepoPath repoPath,
                                      String metadataName)
Parameters:
repoPath - Repository path of the metadata aware item
metadataName - The metadata name
Returns:
The metadata info. Returns null if not found.

getMetadataNames

List<String> getMetadataNames(RepoPath repoPath)
Returns the available metadata names which are not internal

Parameters:
repoPath - The full path of the object having metadata
Returns:
A list of metadata names that exists on this element

getXmlMetadata

String getXmlMetadata(RepoPath repoPath,
                      String metadataName)
Returns the metadata of the given name.

Parameters:
repoPath - A repo path (usually pointing to an JcrFsItem)
metadataName - Name of metadata to return. Cannot be null
Returns:
Requested metadata if found. Null if not
Throws:
IllegalArgumentException - If given a blank metadata name

hasMetadata

boolean hasMetadata(RepoPath repoPath,
                    String metadataName)
Indicates whether this item adorns the given metadata

Parameters:
repoPath - A repo path (usually pointing to an JcrFsItem)
metadataName - Name of metadata to locate
Returns:
True if annotated by the given metadata. False if not
Throws:
IllegalArgumentException - If given a blank metadata name

setXmlMetadata

void setXmlMetadata(RepoPath repoPath,
                    String metadataName,
                    @Nonnull
                    String metadataContent)
Sets the given metadata on the supplied repo path.

Parameters:
repoPath - Path to targeted item
metadataName - The metadata name to set under
metadataContent - The metadata content to add. Cannot be null
Throws:
IllegalArgumentException - When given a null metadata value

removeMetadata

void removeMetadata(RepoPath repoPath,
                    String metadataName)
Removes the metadata of the given name

Parameters:
repoPath - Path to targeted item
metadataName - Name of metadata to remove

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

Parameters:
repoPath -
inputStream -
Returns:
The result status for the deploy operation

delete

StatusHolder delete(RepoPath repoPath)
Deletes the specified repoPath

Parameters:
repoPath - The repository path to delete
Returns:
Deletion status
Since:
2.4.0

undeploy

@Deprecated
StatusHolder undeploy(RepoPath repoPath)
Deprecated. Use delete(RepoPath) instead

Parameters:
repoPath -
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.

Parameters:
repoPath -
Returns:
True if repoPath is handled by the snapshot(integration)/release policy of the repoPath's repository

isLcoalRepoPathHandled

@Deprecated
boolean isLcoalRepoPathHandled(RepoPath repoPath)
Deprecated. Use isRepoPathHandled(RepoPath) ()}


isRepoPathAccepted

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

Parameters:
repoPath -
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. Use isRepoPathAccepted(RepoPath) ()}


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

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

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


Copyright © 2012. All Rights Reserved.