org.apache.ivy.plugins.resolver

Interface DependencyResolver

public interface DependencyResolver

Method Summary
voidabortPublishTransaction()
voidbeginPublishTransaction(ModuleRevisionId module, boolean overwrite)
voidcommitPublishTransaction()
DownloadReportdownload(Artifact[] artifacts, DownloadOptions options)
Download artifacts with specified DownloadOptions.
ArtifactDownloadReportdownload(ArtifactOrigin artifact, DownloadOptions options)
Download an artifact according to the given DownloadOptions.
voiddumpSettings()
booleanexists(Artifact artifact)
Returns true if the given artifact can be located by this resolver and actually exist.
ResolvedResourcefindIvyFileRef(DependencyDescriptor dd, ResolveData data)
Finds the module descriptor for the specified DependencyDescriptor.
ResolvedModuleRevisiongetDependency(DependencyDescriptor dd, ResolveData data)
Resolve a module by id, getting its module descriptor and resolving the revision if it's a latest one (i.e. a revision uniquely identifying the revision of a module in the current environment - If this revision is not able to identify uniquelely the revision of the module outside of the current environment, then the resolved revision must begin by ##)
StringgetName()
NamespacegetNamespace()
Returns the namespace associated with this resolver.
RepositoryCacheManagergetRepositoryCacheManager()
Returns the RepositoryCacheManager used to manage the repository cache associated with this dependency resolver.
ModuleEntry[]listModules(OrganisationEntry org)
OrganisationEntry[]listOrganisations()
RevisionEntry[]listRevisions(ModuleEntry module)
String[]listTokenValues(String token, Map otherTokenValues)
List all the values the given token can take if other tokens are set as described in the otherTokenValues map.
Map[]listTokenValues(String[] tokens, Map criteria)
Same as DependencyResolver but more generic.
ArtifactOriginlocate(Artifact artifact)
Locates the given artifact and returns its location if it can be located by this resolver and if it actually exists, or null in other cases.
voidpublish(Artifact artifact, File src, boolean overwrite)
voidreportFailure()
Reports last resolve failure as Messages
voidreportFailure(Artifact art)
Reports last artifact download failure as Messages
voidsetName(String name)
Should only be used by configurator
voidsetSettings(ResolverSettings settings)

Method Detail

abortPublishTransaction

public void abortPublishTransaction()

beginPublishTransaction

public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite)

commitPublishTransaction

public void commitPublishTransaction()

download

public DownloadReport download(Artifact[] artifacts, DownloadOptions options)
Download artifacts with specified DownloadOptions.

The resolver will always make a best effort, and do not stop when an artifact is not available. It rather continue to attempt to download other requested artifacts, and report what has been done in the returned DownloadReport.

The returned DownloadReport is never null, and always contain an ArtifactDownloadReport for each requested Artifact.

Parameters: artifacts an array of artifacts to download. Must not be null. options options to apply for this download. Must not be null.

Returns: a DownloadReport with details about each Artifact download.

download

public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options)
Download an artifact according to the given DownloadOptions.

This methods is an alternative to (Artifact[], DownloadOptions), which locates and downloads a set of artifacts. This method uses an ArtifactOrigin, and as such is only used to materialize an already located Artifact.

Parameters: artifact the location of the artifact to download. Must not be null. options options to apply for this download. Must not be null.

Returns: a report detailing how the download has gone, is never null.

dumpSettings

public void dumpSettings()

exists

public boolean exists(Artifact artifact)
Returns true if the given artifact can be located by this resolver and actually exist.

Parameters: artifact the artifact which should be tested.

Returns: true if the given artifact can be located by this resolver and actually exist.

findIvyFileRef

public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data)
Finds the module descriptor for the specified DependencyDescriptor. If this resolver can't find the module descriptor, null is returned.

Parameters: dd the dependency descriptor data the resolve data

Returns: the module descriptor, or null

getDependency

public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
Resolve a module by id, getting its module descriptor and resolving the revision if it's a latest one (i.e. a revision uniquely identifying the revision of a module in the current environment - If this revision is not able to identify uniquelely the revision of the module outside of the current environment, then the resolved revision must begin by ##)

Throws: ParseException

getName

public String getName()

getNamespace

public Namespace getNamespace()
Returns the namespace associated with this resolver.

Returns: the namespace associated with this resolver.

getRepositoryCacheManager

public RepositoryCacheManager getRepositoryCacheManager()
Returns the RepositoryCacheManager used to manage the repository cache associated with this dependency resolver.

Returns: the RepositoryCacheManager used to manage the repository cache associated with this dependency resolver.

listModules

public ModuleEntry[] listModules(OrganisationEntry org)

listOrganisations

public OrganisationEntry[] listOrganisations()

listRevisions

public RevisionEntry[] listRevisions(ModuleEntry module)

listTokenValues

public String[] listTokenValues(String token, Map otherTokenValues)
List all the values the given token can take if other tokens are set as described in the otherTokenValues map. For instance, if token = "revision" and the map contains "organisation"->"foo" "module"->"bar" The results will be the list of revisions of the module bar from the org foo.

Note that listing does not take into account namespaces, and return raw information without any namespace transformation. The caller is responsible for calling namespace transformation with the Namespace returned by getNamespace.

listTokenValues

public Map[] listTokenValues(String[] tokens, Map criteria)
Same as DependencyResolver but more generic.

Parameters: tokens the tokens of the query criteria the token which have values

Returns: the list of token values (Map[]), must not be null

locate

public ArtifactOrigin locate(Artifact artifact)
Locates the given artifact and returns its location if it can be located by this resolver and if it actually exists, or null in other cases.

Parameters: artifact the artifact which should be located

Returns: the artifact location, or null if it can't be located by this resolver or doesn't exist.

publish

public void publish(Artifact artifact, File src, boolean overwrite)

reportFailure

public void reportFailure()
Reports last resolve failure as Messages

reportFailure

public void reportFailure(Artifact art)
Reports last artifact download failure as Messages

Parameters: art

setName

public void setName(String name)
Should only be used by configurator

Parameters: name the new name of the resolver

setSettings

public void setSettings(ResolverSettings settings)