Package org.apache.ivy.plugins.resolver
Class AbstractResolver
java.lang.Object
org.apache.ivy.plugins.resolver.AbstractResolver
- All Implemented Interfaces:
Validatable
,DependencyResolver
,HasLatestStrategy
- Direct Known Subclasses:
AbstractWorkspaceResolver
,BasicResolver
,ChainResolver
,DualResolver
public abstract class AbstractResolver
extends Object
implements DependencyResolver, HasLatestStrategy, Validatable
This abstract resolver only provides handling for resolver name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
beginPublishTransaction
(ModuleRevisionId module, boolean overwrite) protected void
protected ResolvedModuleRevision
checkLatest
(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound, ResolveData data) void
protected boolean
doValidate
(ResolveData data) download
(ArtifactOrigin artifact, DownloadOptions options) Default implementation downloads the artifact without taking advantage of its locationvoid
boolean
Returnstrue
if the given artifact can be located by this resolver and actually exist.protected ResolvedModuleRevision
findModuleInCache
(DependencyDescriptor dd, ResolveData data) protected ResolvedModuleRevision
findModuleInCache
(DependencyDescriptor dd, ResolveData data, boolean anyResolver) protected Artifact
fromSystem
(Artifact artifact) protected DependencyDescriptor
protected CacheDownloadOptions
getCacheDownloadOptions
(DownloadOptions options) protected CacheMetadataOptions
getCacheOptions
(ResolveData data) protected String
protected String
protected DownloadOptions
getDownloadOptions
(ResolveOptions options) getName()
Returns the namespace associated with this resolver.Returns theRepositoryCacheManager
used to manage the repository cache associated with this dependency resolver.protected IvyNode
getSystemNode
(ResolveData data, ModuleRevisionId resolvedMrid) hidePassword
(String name) this method should remove sensitive information from a location to be displayed in a logprotected boolean
isAfter
(ResolvedModuleRevision rmr1, ResolvedModuleRevision rmr2, Date date) Returns true if rmr1 is after rmr2, using the latest strategy to determine which is the latestboolean
listRevisions
(ModuleEntry module) listTokenValues
(String[] tokens, Map<String, Object> criteria) Same asDependencyResolver.listTokenValues(String, Map)
but more generic.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 downloadvoid
Reports last resolve failure as Messagesvoid
reportFailure
(Artifact art) Reports last artifact download failure as Messagesprotected void
saveModuleRevisionIfNeeded
(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound) void
void
setChangingMatcher
(String changingMatcherName) void
setChangingPattern
(String changingPattern) void
setCheckmodified
(boolean check) void
setEventManager
(EventManager eventManager) void
void
setLatestStrategy
(LatestStrategy latestStrategy) void
Should only be used by configuratorvoid
setNamespace
(String namespaceName) void
setRepositoryCacheManager
(RepositoryCacheManager repositoryCacheManager) void
void
setTimeoutConstraint
(String name) void
setValidate
(boolean validate) toString()
protected Artifact
protected DependencyDescriptor
protected ModuleDescriptor
protected ModuleRevisionId
toSystem
(ModuleRevisionId resolvedMrid) protected MetadataArtifactDownloadReport
protected ResolvedModuleRevision
void
validate()
Validates the Validatable, throwing anIllegalStateException
if the current state is not valid.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
download, findIvyFileRef, getDependency, publish
-
Constructor Details
-
AbstractResolver
public AbstractResolver()
-
-
Method Details
-
getSettings
-
getParserSettings
-
setSettings
- Specified by:
setSettings
in interfaceDependencyResolver
-
getName
- Specified by:
getName
in interfaceDependencyResolver
-
setName
Description copied from interface:DependencyResolver
Should only be used by configurator- Specified by:
setName
in interfaceDependencyResolver
- Parameters:
name
- the new name of the resolver
-
hidePassword
this method should remove sensitive information from a location to be displayed in a log- Parameters:
name
- location- Returns:
- location with sensitive data replaced by stars
-
doValidate
-
isValidate
public boolean isValidate() -
setValidate
public void setValidate(boolean validate) -
checkInterrupted
protected void checkInterrupted() -
reportFailure
public void reportFailure()Description copied from interface:DependencyResolver
Reports last resolve failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
-
reportFailure
Description copied from interface:DependencyResolver
Reports last artifact download failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
- Parameters:
art
- Artifact
-
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
- Parameters:
token
- StringotherTokenValues
- Map- Returns:
- String[]
-
listTokenValues
Description copied from interface:DependencyResolver
Same asDependencyResolver.listTokenValues(String, Map)
but more generic.- Specified by:
listTokenValues
in interfaceDependencyResolver
- Parameters:
tokens
- the tokens of the querycriteria
- the token which have values- Returns:
- the list of token values, must not be
null
-
listOrganisations
- Specified by:
listOrganisations
in interfaceDependencyResolver
-
listModules
- Specified by:
listModules
in interfaceDependencyResolver
-
listRevisions
- Specified by:
listRevisions
in interfaceDependencyResolver
-
toString
-
dumpSettings
public void dumpSettings()- Specified by:
dumpSettings
in interfaceDependencyResolver
-
getTypeName
-
getTimeoutConstraint
-
setTimeoutConstraint
-
download
Default implementation downloads the artifact without taking advantage of its location- Specified by:
download
in interfaceDependencyResolver
- Parameters:
artifact
- ArtifactOriginoptions
- DownloadOptions- Returns:
- ArtifactDownloadReport
-
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
- Parameters:
artifact
- the artifact which should be tested.- Returns:
true
if the given artifact can be located by this resolver and actually exist.
-
locate
Default implementation actually download the artifact Subclasses should overwrite this to avoid the download- Specified by:
locate
in interfaceDependencyResolver
- Parameters:
artifact
- ArtifactOrigin- Returns:
- ArtifactOrigin
-
getLatestStrategy
- Specified by:
getLatestStrategy
in interfaceHasLatestStrategy
-
setLatestStrategy
- Specified by:
setLatestStrategy
in interfaceHasLatestStrategy
-
setLatest
-
getLatest
- Specified by:
getLatest
in interfaceHasLatestStrategy
-
getNamespace
Description copied from interface:DependencyResolver
Returns the namespace associated with this resolver.- Specified by:
getNamespace
in interfaceDependencyResolver
- Returns:
- the namespace associated with this resolver.
-
setNamespace
-
toSystem
-
fromSystem
-
toSystem
-
toSystem
-
toSystem
-
toSystem
-
fromSystem
-
toSystem
-
getSystemNode
-
findModuleInCache
-
findModuleInCache
protected ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd, ResolveData data, boolean anyResolver) -
setChangingMatcher
-
getChangingMatcherName
-
setChangingPattern
-
getChangingPattern
-
setCheckmodified
public void setCheckmodified(boolean check) -
getRepositoryCacheManager
Description copied from interface:DependencyResolver
Returns theRepositoryCacheManager
used to manage the repository cache associated with this dependency resolver.- Specified by:
getRepositoryCacheManager
in interfaceDependencyResolver
- Returns:
- the
RepositoryCacheManager
used to manage the repository cache associated with this dependency resolver.
-
setRepositoryCacheManager
-
setCache
-
setEventManager
-
getEventManager
-
validate
public void validate()Description copied from interface:Validatable
Validates the Validatable, throwing anIllegalStateException
if the current state is not valid.- Specified by:
validate
in interfaceValidatable
-
getCacheOptions
-
getCacheDownloadOptions
-
getDownloadOptions
-
abortPublishTransaction
- Specified by:
abortPublishTransaction
in interfaceDependencyResolver
- Throws:
IOException
-
commitPublishTransaction
- Specified by:
commitPublishTransaction
in interfaceDependencyResolver
- Throws:
IOException
-
beginPublishTransaction
- Specified by:
beginPublishTransaction
in interfaceDependencyResolver
- Throws:
IOException
-
isAfter
Returns true if rmr1 is after rmr2, using the latest strategy to determine which is the latest- Parameters:
rmr1
- ResolvedModuleRevisionrmr2
- ResolvedModuleRevisiondate
- Date- Returns:
- boolean
-
checkLatest
protected ResolvedModuleRevision checkLatest(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound, ResolveData data) -
saveModuleRevisionIfNeeded
protected void saveModuleRevisionIfNeeded(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound)
-