Package org.apache.ivy.plugins.resolver
Class BasicResolver
java.lang.Object
org.apache.ivy.plugins.resolver.AbstractResolver
org.apache.ivy.plugins.resolver.BasicResolver
- All Implemented Interfaces:
Validatable
,DependencyResolver
,HasLatestStrategy
- Direct Known Subclasses:
AbstractOSGiResolver
,AbstractPatternsBasedResolver
-
Field Summary
Modifier and TypeFieldDescriptionstatic final SimpleDateFormat
Deprecated.static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected void
checkModuleDescriptorRevision
(ModuleDescriptor systemMd, ModuleRevisionId systemMrid) protected void
protected void
doFindArtifactRef
(Artifact artifact, Date date) download
(ArtifactOrigin origin, DownloadOptions options) Default implementation downloads the artifact without taking advantage of its locationdownload
(Artifact[] artifacts, DownloadOptions options) Download artifacts with specified DownloadOptions.boolean
Returnstrue
if the given artifact can be located by this resolver and actually exist.protected Collection<String>
filterNames
(Collection<String> names) Filters names before returning them in the findXXXNames or findTokenValues method.protected abstract ResolvedResource
findArtifactRef
(Artifact artifact, Date date) protected ResolvedResource
findFirstArtifactRef
(ModuleDescriptor md, DependencyDescriptor dd, ResolveData data) protected abstract Collection<String>
findResource
(ResolvedResource[] rress, ResourceMDParser rmdparser, ModuleRevisionId mrid, Date date) When the resolver has many choices, this function helps choosing oneprotected abstract long
protected long
getAndCheck
(Resource resource, File dest) protected ResolvedResource
getArtifactRef
(Artifact artifact, Date date) String[]
protected ResourceMDParser
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.protected long
getPublicationDate
(ModuleDescriptor md, DependencyDescriptor dd, ResolveData data) protected abstract Resource
getResource
(String source) protected ResourceMDParser
getRMDParser
(DependencyDescriptor dd, ResolveData data) boolean
boolean
boolean
boolean
isForce()
listRevisions
(ModuleEntry mod) String[]
listTokenValues
(String token, Map<String, String> otherTokenValues) List all the values the given token can take if other tokens are set as described in the otherTokenValues map.Default implementation actually download the artifact Subclasses should overwrite this to avoid the downloadprotected void
logArtifactAttempt
(Artifact art, String attempt) protected void
logAttempt
(String attempt) protected void
logIvyAttempt
(String attempt) parse
(ResolvedResource mdRef, DependencyDescriptor dd, ResolveData data) void
Reports last resolve failure as Messagesvoid
reportFailure
(Artifact art) Reports last artifact download failure as Messagesvoid
setAllownomd
(boolean b) void
setCheckconsistency
(boolean checkConsistency) void
setChecksums
(String checksums) void
setDescriptor
(String descriptorRule) Sets the module descriptor presence rule.void
setEnvDependent
(boolean envDependent) void
setForce
(boolean force) void
setWorkspaceName
(String workspaceName) protected boolean
toString()
Methods inherited from class org.apache.ivy.plugins.resolver.AbstractResolver
abortPublishTransaction, beginPublishTransaction, checkInterrupted, checkLatest, commitPublishTransaction, doValidate, dumpSettings, findModuleInCache, findModuleInCache, fromSystem, fromSystem, getCacheDownloadOptions, getCacheOptions, getChangingMatcherName, getChangingPattern, getDownloadOptions, getEventManager, getLatest, getLatestStrategy, getName, getNamespace, getParserSettings, getRepositoryCacheManager, getSettings, getSystemNode, getTimeoutConstraint, getTypeName, hidePassword, isAfter, isValidate, listTokenValues, saveModuleRevisionIfNeeded, setCache, setChangingMatcher, setChangingPattern, setCheckmodified, setEventManager, setLatest, setLatestStrategy, setName, setNamespace, setRepositoryCacheManager, setSettings, setTimeoutConstraint, setValidate, toSystem, toSystem, toSystem, toSystem, toSystem, toSystem, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.ivy.plugins.resolver.DependencyResolver
findIvyFileRef, publish
-
Field Details
-
DESCRIPTOR_OPTIONAL
- See Also:
-
DESCRIPTOR_REQUIRED
- See Also:
-
DATE_FORMAT
Deprecated.
-
-
Constructor Details
-
BasicResolver
public BasicResolver()
-
-
Method Details
-
getWorkspaceName
-
setWorkspaceName
-
isEnvDependent
public boolean isEnvDependent() -
setEnvDependent
public void setEnvDependent(boolean envDependent) -
getDependency
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException Description copied from interface:DependencyResolver
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 uniquely the revision of the module outside of the current environment, then the resolved revision must begin by ##)- Parameters:
dd
- DependencyDescriptordata
- ResolveData- Returns:
- ResolvedModuleRevision
- Throws:
ParseException
- if something goes wrong
-
shouldReturnResolvedModule
-
checkModuleDescriptorRevision
protected void checkModuleDescriptorRevision(ModuleDescriptor systemMd, ModuleRevisionId systemMrid) -
parse
public ResolvedModuleRevision parse(ResolvedResource mdRef, DependencyDescriptor dd, ResolveData data) throws ParseException - Throws:
ParseException
-
getRMDParser
-
getDefaultRMDParser
-
findResource
public ResolvedResource findResource(ResolvedResource[] rress, ResourceMDParser rmdparser, ModuleRevisionId mrid, Date date) When the resolver has many choices, this function helps choosing one- Parameters:
rress
- the list of resolved resource which the resolver found to fit the requirementrmdparser
- the parser of module descriptormrid
- the module being resolveddate
- the current date- Returns:
- the selected resource
-
filterNames
Filters names before returning them in the findXXXNames or findTokenValues method.Remember to call the super implementation when overriding this method.
- Parameters:
names
- the list to filter.- Returns:
- the filtered list
-
clearIvyAttempts
protected void clearIvyAttempts() -
logIvyAttempt
-
logArtifactAttempt
-
logAttempt
-
reportFailure
public void reportFailure()Description copied from interface:DependencyResolver
Reports last resolve failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
- Overrides:
reportFailure
in classAbstractResolver
-
reportFailure
Description copied from interface:DependencyResolver
Reports last artifact download failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
- Overrides:
reportFailure
in classAbstractResolver
- Parameters:
art
- Artifact
-
acceptLatest
protected boolean acceptLatest() -
download
Description copied from interface:DependencyResolver
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 anArtifactDownloadReport
for each requested Artifact.- Parameters:
artifacts
- an array of artifacts to download. Must not benull
.options
- options to apply for this download. Must not benull
.- Returns:
- a DownloadReport with details about each Artifact download.
-
clearArtifactAttempts
protected void clearArtifactAttempts() -
download
Description copied from class:AbstractResolver
Default implementation downloads the artifact without taking advantage of its location- Specified by:
download
in interfaceDependencyResolver
- Overrides:
download
in classAbstractResolver
- Parameters:
origin
- ArtifactOriginoptions
- DownloadOptions- Returns:
- ArtifactDownloadReport
-
getResource
- Throws:
IOException
-
exists
Description copied from interface:DependencyResolver
Returnstrue
if the given artifact can be located by this resolver and actually exist.- Specified by:
exists
in interfaceDependencyResolver
- Overrides:
exists
in classAbstractResolver
- Parameters:
artifact
- the artifact which should be tested.- Returns:
true
if the given artifact can be located by this resolver and actually exist.
-
locate
Description copied from class:AbstractResolver
Default implementation actually download the artifact Subclasses should overwrite this to avoid the download- Specified by:
locate
in interfaceDependencyResolver
- Overrides:
locate
in classAbstractResolver
- Parameters:
artifact
- ArtifactOrigin- Returns:
- ArtifactOrigin
-
getPublicationDate
-
toString
- Overrides:
toString
in classAbstractResolver
-
listTokenValues
Description copied from interface:DependencyResolver
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
DependencyResolver.getNamespace()
.- Specified by:
listTokenValues
in interfaceDependencyResolver
- Overrides:
listTokenValues
in classAbstractResolver
- Parameters:
token
- StringotherTokenValues
- Map- Returns:
- String[]
-
listOrganisations
- Specified by:
listOrganisations
in interfaceDependencyResolver
- Overrides:
listOrganisations
in classAbstractResolver
-
listModules
- Specified by:
listModules
in interfaceDependencyResolver
- Overrides:
listModules
in classAbstractResolver
-
listRevisions
- Specified by:
listRevisions
in interfaceDependencyResolver
- Overrides:
listRevisions
in classAbstractResolver
-
findNames
-
findFirstArtifactRef
protected ResolvedResource findFirstArtifactRef(ModuleDescriptor md, DependencyDescriptor dd, ResolveData data) -
getAndCheck
- Throws:
IOException
-
getArtifactRef
-
doFindArtifactRef
-
findArtifactRef
-
get
- Throws:
IOException
-
isCheckconsistency
public boolean isCheckconsistency() -
setCheckconsistency
public void setCheckconsistency(boolean checkConsistency) -
setForce
public void setForce(boolean force) -
isForce
public boolean isForce() -
isAllownomd
public boolean isAllownomd() -
setAllownomd
public void setAllownomd(boolean b) -
setDescriptor
Sets the module descriptor presence rule. Should be one ofDESCRIPTOR_REQUIRED
orDESCRIPTOR_OPTIONAL
.- Parameters:
descriptorRule
- the descriptor rule to use with this resolver.
-
getChecksumAlgorithms
-
setChecksums
-