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 voidabortPublishTransaction()voidbeginPublishTransaction(ModuleRevisionId module, boolean overwrite)protected voidcheckInterrupted()protected ResolvedModuleRevisioncheckLatest(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound, ResolveData data)voidcommitPublishTransaction()protected booleandoValidate(ResolveData data)ArtifactDownloadReportdownload(ArtifactOrigin artifact, DownloadOptions options)Default implementation downloads the artifact without taking advantage of its locationvoiddumpSettings()booleanexists(Artifact artifact)Returnstrueif the given artifact can be located by this resolver and actually exist.protected ResolvedModuleRevisionfindModuleInCache(DependencyDescriptor dd, ResolveData data)protected ResolvedModuleRevisionfindModuleInCache(DependencyDescriptor dd, ResolveData data, boolean anyResolver)protected ArtifactfromSystem(Artifact artifact)protected DependencyDescriptorfromSystem(DependencyDescriptor dd)protected CacheDownloadOptionsgetCacheDownloadOptions(DownloadOptions options)protected CacheMetadataOptionsgetCacheOptions(ResolveData data)protected java.lang.StringgetChangingMatcherName()protected java.lang.StringgetChangingPattern()protected DownloadOptionsgetDownloadOptions(ResolveOptions options)EventManagergetEventManager()java.lang.StringgetLatest()LatestStrategygetLatestStrategy()java.lang.StringgetName()NamespacegetNamespace()Returns the namespace associated with this resolver.ParserSettingsgetParserSettings()RepositoryCacheManagergetRepositoryCacheManager()Returns theRepositoryCacheManagerused to manage the repository cache associated with this dependency resolver.ResolverSettingsgetSettings()protected IvyNodegetSystemNode(ResolveData data, ModuleRevisionId resolvedMrid)TimeoutConstraintgetTimeoutConstraint()java.lang.StringgetTypeName()java.lang.StringhidePassword(java.lang.String name)this method should remove sensitive information from a location to be displayed in a logprotected booleanisAfter(ResolvedModuleRevision rmr1, ResolvedModuleRevision rmr2, java.util.Date date)Returns true if rmr1 is after rmr2, using the latest strategy to determine which is the latestbooleanisValidate()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.ArtifactOriginlocate(Artifact artifact)Default implementation actually download the artifact Subclasses should overwrite this to avoid the downloadvoidreportFailure()Reports last resolve failure as MessagesvoidreportFailure(Artifact art)Reports last artifact download failure as Messagesprotected voidsaveModuleRevisionIfNeeded(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound)voidsetCache(java.lang.String cacheName)voidsetChangingMatcher(java.lang.String changingMatcherName)voidsetChangingPattern(java.lang.String changingPattern)voidsetCheckmodified(boolean check)voidsetEventManager(EventManager eventManager)voidsetLatest(java.lang.String strategyName)voidsetLatestStrategy(LatestStrategy latestStrategy)voidsetName(java.lang.String name)Should only be used by configuratorvoidsetNamespace(java.lang.String namespaceName)voidsetRepositoryCacheManager(RepositoryCacheManager repositoryCacheManager)voidsetSettings(ResolverSettings ivy)voidsetTimeoutConstraint(java.lang.String name)voidsetValidate(boolean validate)java.lang.StringtoString()protected ArtifacttoSystem(Artifact artifact)protected DependencyDescriptortoSystem(DependencyDescriptor dd)protected ModuleDescriptortoSystem(ModuleDescriptor md)protected ModuleRevisionIdtoSystem(ModuleRevisionId resolvedMrid)protected MetadataArtifactDownloadReporttoSystem(MetadataArtifactDownloadReport report)protected ResolvedModuleRevisiontoSystem(ResolvedModuleRevision rmr)voidvalidate()Validates the Validatable, throwing anIllegalStateExceptionif 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:
setSettingsin interfaceDependencyResolver
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceDependencyResolver
-
setName
public void setName(java.lang.String name)
Description copied from interface:DependencyResolverShould only be used by configurator- Specified by:
setNamein 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:DependencyResolverReports last resolve failure as Messages- Specified by:
reportFailurein interfaceDependencyResolver
-
reportFailure
public void reportFailure(Artifact art)
Description copied from interface:DependencyResolverReports last artifact download failure as Messages- Specified by:
reportFailurein 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:DependencyResolverList 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:
listTokenValuesin 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:DependencyResolverSame asDependencyResolver.listTokenValues(String, Map)but more generic.- Specified by:
listTokenValuesin 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:
listOrganisationsin interfaceDependencyResolver
-
listModules
public ModuleEntry[] listModules(OrganisationEntry org)
- Specified by:
listModulesin interfaceDependencyResolver
-
listRevisions
public RevisionEntry[] listRevisions(ModuleEntry module)
- Specified by:
listRevisionsin interfaceDependencyResolver
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
dumpSettings
public void dumpSettings()
- Specified by:
dumpSettingsin 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:
downloadin interfaceDependencyResolver- Parameters:
artifact- ArtifactOriginoptions- DownloadOptions- Returns:
- ArtifactDownloadReport
-
exists
public boolean exists(Artifact artifact)
Description copied from interface:DependencyResolverReturnstrueif the given artifact can be located by this resolver and actually exist.- Specified by:
existsin interfaceDependencyResolver- Parameters:
artifact- the artifact which should be tested.- Returns:
trueif 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:
locatein interfaceDependencyResolver- Parameters:
artifact- ArtifactOrigin- Returns:
- ArtifactOrigin
-
getLatestStrategy
public LatestStrategy getLatestStrategy()
- Specified by:
getLatestStrategyin interfaceHasLatestStrategy
-
setLatestStrategy
public void setLatestStrategy(LatestStrategy latestStrategy)
- Specified by:
setLatestStrategyin interfaceHasLatestStrategy
-
setLatest
public void setLatest(java.lang.String strategyName)
-
getLatest
public java.lang.String getLatest()
- Specified by:
getLatestin interfaceHasLatestStrategy
-
getNamespace
public Namespace getNamespace()
Description copied from interface:DependencyResolverReturns the namespace associated with this resolver.- Specified by:
getNamespacein 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:DependencyResolverReturns theRepositoryCacheManagerused to manage the repository cache associated with this dependency resolver.- Specified by:
getRepositoryCacheManagerin interfaceDependencyResolver- Returns:
- the
RepositoryCacheManagerused 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:ValidatableValidates the Validatable, throwing anIllegalStateExceptionif the current state is not valid.- Specified by:
validatein 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:
abortPublishTransactionin interfaceDependencyResolver- Throws:
java.io.IOException
-
commitPublishTransaction
public void commitPublishTransaction() throws java.io.IOException- Specified by:
commitPublishTransactionin interfaceDependencyResolver- Throws:
java.io.IOException
-
beginPublishTransaction
public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite) throws java.io.IOException
- Specified by:
beginPublishTransactionin 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)
-
-