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 java.lang.Object implements DependencyResolver, HasLatestStrategy, Validatable
This abstract resolver only provides handling for resolver name
-
-
Constructor Summary
Constructors Constructor Description AbstractResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abortPublishTransaction()
void
beginPublishTransaction(ModuleRevisionId module, boolean overwrite)
protected void
checkInterrupted()
protected ResolvedModuleRevision
checkLatest(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound, ResolveData data)
void
commitPublishTransaction()
protected boolean
doValidate(ResolveData data)
ArtifactDownloadReport
download(ArtifactOrigin artifact, DownloadOptions options)
Default implementation downloads the artifact without taking advantage of its locationvoid
dumpSettings()
boolean
exists(Artifact artifact)
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
fromSystem(DependencyDescriptor dd)
protected CacheDownloadOptions
getCacheDownloadOptions(DownloadOptions options)
protected CacheMetadataOptions
getCacheOptions(ResolveData data)
protected java.lang.String
getChangingMatcherName()
protected java.lang.String
getChangingPattern()
protected DownloadOptions
getDownloadOptions(ResolveOptions options)
EventManager
getEventManager()
java.lang.String
getLatest()
LatestStrategy
getLatestStrategy()
java.lang.String
getName()
Namespace
getNamespace()
Returns the namespace associated with this resolver.ParserSettings
getParserSettings()
RepositoryCacheManager
getRepositoryCacheManager()
Returns theRepositoryCacheManager
used to manage the repository cache associated with this dependency resolver.ResolverSettings
getSettings()
protected IvyNode
getSystemNode(ResolveData data, ModuleRevisionId resolvedMrid)
TimeoutConstraint
getTimeoutConstraint()
java.lang.String
getTypeName()
java.lang.String
hidePassword(java.lang.String name)
this method should remove sensitive information from a location to be displayed in a logprotected boolean
isAfter(ResolvedModuleRevision rmr1, ResolvedModuleRevision rmr2, java.util.Date date)
Returns true if rmr1 is after rmr2, using the latest strategy to determine which is the latestboolean
isValidate()
ModuleEntry[]
listModules(OrganisationEntry org)
OrganisationEntry[]
listOrganisations()
RevisionEntry[]
listRevisions(ModuleEntry module)
java.util.Map<java.lang.String,java.lang.String>[]
listTokenValues(java.lang.String[] tokens, java.util.Map<java.lang.String,java.lang.Object> criteria)
Same asDependencyResolver.listTokenValues(String, Map)
but more generic.java.lang.String[]
listTokenValues(java.lang.String token, java.util.Map<java.lang.String,java.lang.String> otherTokenValues)
List all the values the given token can take if other tokens are set as described in the otherTokenValues map.ArtifactOrigin
locate(Artifact artifact)
Default implementation actually download the artifact Subclasses should overwrite this to avoid the downloadvoid
reportFailure()
Reports last resolve failure as Messagesvoid
reportFailure(Artifact art)
Reports last artifact download failure as Messagesprotected void
saveModuleRevisionIfNeeded(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound)
void
setCache(java.lang.String cacheName)
void
setChangingMatcher(java.lang.String changingMatcherName)
void
setChangingPattern(java.lang.String changingPattern)
void
setCheckmodified(boolean check)
void
setEventManager(EventManager eventManager)
void
setLatest(java.lang.String strategyName)
void
setLatestStrategy(LatestStrategy latestStrategy)
void
setName(java.lang.String name)
Should only be used by configuratorvoid
setNamespace(java.lang.String namespaceName)
void
setRepositoryCacheManager(RepositoryCacheManager repositoryCacheManager)
void
setSettings(ResolverSettings ivy)
void
setTimeoutConstraint(java.lang.String name)
void
setValidate(boolean validate)
java.lang.String
toString()
protected Artifact
toSystem(Artifact artifact)
protected DependencyDescriptor
toSystem(DependencyDescriptor dd)
protected ModuleDescriptor
toSystem(ModuleDescriptor md)
protected ModuleRevisionId
toSystem(ModuleRevisionId resolvedMrid)
protected MetadataArtifactDownloadReport
toSystem(MetadataArtifactDownloadReport report)
protected ResolvedModuleRevision
toSystem(ResolvedModuleRevision rmr)
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
-
-
-
-
Method Detail
-
getSettings
public ResolverSettings getSettings()
-
getParserSettings
public ParserSettings getParserSettings()
-
setSettings
public void setSettings(ResolverSettings ivy)
- Specified by:
setSettings
in interfaceDependencyResolver
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceDependencyResolver
-
setName
public void setName(java.lang.String name)
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
public java.lang.String hidePassword(java.lang.String name)
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
protected boolean doValidate(ResolveData data)
-
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
public void reportFailure(Artifact art)
Description copied from interface:DependencyResolver
Reports last artifact download failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
- Parameters:
art
- Artifact
-
listTokenValues
public java.lang.String[] listTokenValues(java.lang.String token, java.util.Map<java.lang.String,java.lang.String> otherTokenValues)
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
public java.util.Map<java.lang.String,java.lang.String>[] listTokenValues(java.lang.String[] tokens, java.util.Map<java.lang.String,java.lang.Object> criteria)
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
public OrganisationEntry[] listOrganisations()
- Specified by:
listOrganisations
in interfaceDependencyResolver
-
listModules
public ModuleEntry[] listModules(OrganisationEntry org)
- Specified by:
listModules
in interfaceDependencyResolver
-
listRevisions
public RevisionEntry[] listRevisions(ModuleEntry module)
- Specified by:
listRevisions
in interfaceDependencyResolver
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
dumpSettings
public void dumpSettings()
- Specified by:
dumpSettings
in interfaceDependencyResolver
-
getTypeName
public java.lang.String getTypeName()
-
getTimeoutConstraint
public TimeoutConstraint getTimeoutConstraint()
-
setTimeoutConstraint
public void setTimeoutConstraint(java.lang.String name)
-
download
public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options)
Default implementation downloads the artifact without taking advantage of its location- Specified by:
download
in interfaceDependencyResolver
- Parameters:
artifact
- ArtifactOriginoptions
- DownloadOptions- Returns:
- ArtifactDownloadReport
-
exists
public boolean exists(Artifact artifact)
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
public ArtifactOrigin locate(Artifact artifact)
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
public LatestStrategy getLatestStrategy()
- Specified by:
getLatestStrategy
in interfaceHasLatestStrategy
-
setLatestStrategy
public void setLatestStrategy(LatestStrategy latestStrategy)
- Specified by:
setLatestStrategy
in interfaceHasLatestStrategy
-
setLatest
public void setLatest(java.lang.String strategyName)
-
getLatest
public java.lang.String getLatest()
- Specified by:
getLatest
in interfaceHasLatestStrategy
-
getNamespace
public Namespace 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
public void setNamespace(java.lang.String namespaceName)
-
toSystem
protected ModuleDescriptor toSystem(ModuleDescriptor md)
-
toSystem
protected MetadataArtifactDownloadReport toSystem(MetadataArtifactDownloadReport report)
-
toSystem
protected ResolvedModuleRevision toSystem(ResolvedModuleRevision rmr)
-
toSystem
protected ModuleRevisionId toSystem(ModuleRevisionId resolvedMrid)
-
fromSystem
protected DependencyDescriptor fromSystem(DependencyDescriptor dd)
-
toSystem
protected DependencyDescriptor toSystem(DependencyDescriptor dd)
-
getSystemNode
protected IvyNode getSystemNode(ResolveData data, ModuleRevisionId resolvedMrid)
-
findModuleInCache
protected ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd, ResolveData data)
-
findModuleInCache
protected ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd, ResolveData data, boolean anyResolver)
-
setChangingMatcher
public void setChangingMatcher(java.lang.String changingMatcherName)
-
getChangingMatcherName
protected java.lang.String getChangingMatcherName()
-
setChangingPattern
public void setChangingPattern(java.lang.String changingPattern)
-
getChangingPattern
protected java.lang.String getChangingPattern()
-
setCheckmodified
public void setCheckmodified(boolean check)
-
getRepositoryCacheManager
public RepositoryCacheManager 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
public void setRepositoryCacheManager(RepositoryCacheManager repositoryCacheManager)
-
setCache
public void setCache(java.lang.String cacheName)
-
setEventManager
public void setEventManager(EventManager eventManager)
-
getEventManager
public EventManager 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
protected CacheMetadataOptions getCacheOptions(ResolveData data)
-
getCacheDownloadOptions
protected CacheDownloadOptions getCacheDownloadOptions(DownloadOptions options)
-
getDownloadOptions
protected DownloadOptions getDownloadOptions(ResolveOptions options)
-
abortPublishTransaction
public void abortPublishTransaction() throws java.io.IOException
- Specified by:
abortPublishTransaction
in interfaceDependencyResolver
- Throws:
java.io.IOException
-
commitPublishTransaction
public void commitPublishTransaction() throws java.io.IOException
- Specified by:
commitPublishTransaction
in interfaceDependencyResolver
- Throws:
java.io.IOException
-
beginPublishTransaction
public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite) throws java.io.IOException
- Specified by:
beginPublishTransaction
in interfaceDependencyResolver
- Throws:
java.io.IOException
-
isAfter
protected boolean isAfter(ResolvedModuleRevision rmr1, ResolvedModuleRevision rmr2, java.util.Date date)
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)
-
-