Interface Repository
- All Known Implementing Classes:
AbstractRepository, AbstractSshBasedRepository, ChainedRepository, FileRepository, JarRepository, RelativeURLRepository, SFTPRepository, SshRepository, URLRepository, VfsRepository, VsftpRepository
public interface Repository
Represents a collection of resources available to Ivy. Ivy uses one or more repositories as both
a source of resources for Ivy enabled build systems and as a distribution center for resources
generated by Ivy enabled build systems.
A repository supports the following fundamental operations
- retrieving a resource from the repository.
- transferring a resource to the repository.
- retrieving a listing of resources.
Resource Retrieval
get(String, File) retrieves a resource specified by a provided identifier creating a new file.
Resource Publication
put(Artifact, File, String, boolean) transfers a file to the repository.
resource Listing
list(String) returns a listing of file like objects belonging to a specified parent directory.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransferListener(TransferListener listener) Add a listener to the repository.voidFetch a resource from the repository.Get the repository's file separator string.getName()Return the name of the repositorygetResource(String source) Return the resource associated with a specified identifier.booleanhasTransferListener(TransferListener listener) Determine if a given listener is attached to the repository.Return a listing of resources namesvoidTransfer a resource to the repositoryvoidremoveTransferListener(TransferListener listener) Remove a listener on the repositorystandardize(String source) Normalize a string.
-
Method Details
-
getResource
Return the resource associated with a specified identifier. If the resource does not exist, it should return a Resource with exists() returning false. An IOException should only be thrown when a real IO problem occurs, like the impossibility to connect to a server.- Parameters:
source- A string identifying the resource.- Returns:
- The resource associated with the resource identifier.
- Throws:
IOException- On error while trying to get resource.
-
get
Fetch a resource from the repository.- Parameters:
source- A string identifying the resource to be fetched.destination- Where to place the fetched resource.- Throws:
IOException- On retrieval failure.
-
put
Transfer a resource to the repository- Parameters:
artifact- The artifact to be transferred.source- The local file to be transferred.destination- Where to transfer the resource.overwrite- Whether the transfer should overwrite an existing resource.- Throws:
IOException- On publication failure.
-
list
Return a listing of resources names- Parameters:
parent- The parent directory from which to generate the listing.- Returns:
- A listing of the parent directory's file content
- Throws:
IOException- On listing failure.
-
addTransferListener
Add a listener to the repository.- Parameters:
listener- The listener to attach to the repository.
-
removeTransferListener
Remove a listener on the repository- Parameters:
listener- The listener to remove
-
hasTransferListener
Determine if a given listener is attached to the repository.- Parameters:
listener- The listener being queried- Returns:
trueif the provided listener is attached to the repository,falseif not.
-
getFileSeparator
String getFileSeparator()Get the repository's file separator string.- Returns:
- The repository's file separator delimiter
-
standardize
-
getName
-