Package org.apache.ivy.plugins.resolver
Class ChainResolver
- java.lang.Object
-
- org.apache.ivy.plugins.resolver.AbstractResolver
-
- org.apache.ivy.plugins.resolver.ChainResolver
-
- All Implemented Interfaces:
Validatable,DependencyResolver,HasLatestStrategy
- Direct Known Subclasses:
WorkspaceChainResolver
public class ChainResolver extends AbstractResolver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChainResolver.ResolvedModuleRevisionArtifactInfo
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<DependencyResolver>chainprivate booleandualprivate booleanreturnFirst
-
Constructor Summary
Constructors Constructor Description ChainResolver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortPublishTransaction()voidadd(DependencyResolver resolver)voidbeginPublishTransaction(ModuleRevisionId module, boolean overwrite)voidcommitPublishTransaction()ArtifactDownloadReportdownload(ArtifactOrigin artifact, DownloadOptions options)Default implementation downloads the artifact without taking advantage of its locationDownloadReportdownload(Artifact[] artifacts, DownloadOptions options)Download artifacts with specified DownloadOptions.voiddumpSettings()booleanexists(Artifact artifact)Returnstrueif 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.private ResolvedModuleRevisionforcedRevision(ResolvedModuleRevision rmr)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.private DependencyResolvergetFirstResolver()private static LatestStrategygetLatest(DependencyResolver resolver)private static java.lang.StringgetLatestStrategyName(DependencyResolver resolver)java.util.List<DependencyResolver>getResolvers()booleanisDual()booleanisReturnFirst()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.ArtifactOriginlocate(Artifact artifact)Default implementation actually download the artifact Subclasses should overwrite this to avoid the downloadvoidpublish(Artifact artifact, java.io.File src, boolean overwrite)voidreportFailure()Reports last resolve failure as MessagesvoidreportFailure(Artifact art)Reports last artifact download failure as Messagesprivate ResolvedModuleRevisionresolvedRevision(ResolvedModuleRevision mr)voidsetDual(boolean b)private static voidsetLatest(DependencyResolver resolver, LatestStrategy latest)private LatestStrategysetLatestIfRequired(DependencyResolver resolver, LatestStrategy latestStrategy)voidsetReturnFirst(boolean returnFirst)-
Methods inherited from class org.apache.ivy.plugins.resolver.AbstractResolver
checkInterrupted, checkLatest, doValidate, findModuleInCache, findModuleInCache, fromSystem, fromSystem, getCacheDownloadOptions, getCacheOptions, getChangingMatcherName, getChangingPattern, getDownloadOptions, getEventManager, getLatest, getLatestStrategy, getName, getNamespace, getParserSettings, getRepositoryCacheManager, getSettings, getSystemNode, getTimeoutConstraint, getTypeName, hidePassword, isAfter, isValidate, listModules, listOrganisations, listRevisions, listTokenValues, saveModuleRevisionIfNeeded, setCache, setChangingMatcher, setChangingPattern, setCheckmodified, setEventManager, setLatest, setLatestStrategy, setName, setNamespace, setRepositoryCacheManager, setSettings, setTimeoutConstraint, setValidate, toString, toSystem, toSystem, toSystem, toSystem, toSystem, toSystem, validate
-
-
-
-
Field Detail
-
returnFirst
private boolean returnFirst
-
chain
private java.util.List<DependencyResolver> chain
-
dual
private boolean dual
-
-
Method Detail
-
add
public void add(DependencyResolver resolver)
-
getDependency
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws java.text.ParseException
Description copied from interface:DependencyResolverResolve 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:
java.text.ParseException- if something goes wrong
-
resolvedRevision
private ResolvedModuleRevision resolvedRevision(ResolvedModuleRevision mr)
-
forcedRevision
private ResolvedModuleRevision forcedRevision(ResolvedModuleRevision rmr)
-
setLatestIfRequired
private LatestStrategy setLatestIfRequired(DependencyResolver resolver, LatestStrategy latestStrategy)
-
findIvyFileRef
public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data)
Description copied from interface:DependencyResolverFinds the module descriptor for the specified DependencyDescriptor. If this resolver can't find the module descriptor, null is returned.- Parameters:
dd- the dependency descriptordata- the resolve data- Returns:
- the module descriptor, or null
-
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- Overrides:
listTokenValuesin classAbstractResolver- Parameters:
tokens- the tokens of the querycriteria- the token which have values- Returns:
- the list of token values, must not be
null
-
reportFailure
public void reportFailure()
Description copied from interface:DependencyResolverReports last resolve failure as Messages- Specified by:
reportFailurein interfaceDependencyResolver- Overrides:
reportFailurein classAbstractResolver
-
reportFailure
public void reportFailure(Artifact art)
Description copied from interface:DependencyResolverReports last artifact download failure as Messages- Specified by:
reportFailurein interfaceDependencyResolver- Overrides:
reportFailurein classAbstractResolver- Parameters:
art- Artifact
-
download
public DownloadReport download(Artifact[] artifacts, DownloadOptions options)
Description copied from interface:DependencyResolverDownload 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 anArtifactDownloadReportfor 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.
-
getResolvers
public java.util.List<DependencyResolver> getResolvers()
-
publish
public void publish(Artifact artifact, java.io.File src, boolean overwrite) throws java.io.IOException
- Throws:
java.io.IOException
-
abortPublishTransaction
public void abortPublishTransaction() throws java.io.IOException- Specified by:
abortPublishTransactionin interfaceDependencyResolver- Overrides:
abortPublishTransactionin classAbstractResolver- Throws:
java.io.IOException
-
beginPublishTransaction
public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite) throws java.io.IOException
- Specified by:
beginPublishTransactionin interfaceDependencyResolver- Overrides:
beginPublishTransactionin classAbstractResolver- Throws:
java.io.IOException
-
commitPublishTransaction
public void commitPublishTransaction() throws java.io.IOException- Specified by:
commitPublishTransactionin interfaceDependencyResolver- Overrides:
commitPublishTransactionin classAbstractResolver- Throws:
java.io.IOException
-
getFirstResolver
private DependencyResolver getFirstResolver()
-
isReturnFirst
public boolean isReturnFirst()
-
setReturnFirst
public void setReturnFirst(boolean returnFirst)
-
dumpSettings
public void dumpSettings()
- Specified by:
dumpSettingsin interfaceDependencyResolver- Overrides:
dumpSettingsin classAbstractResolver
-
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- Overrides:
existsin classAbstractResolver- 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)
Description copied from class:AbstractResolverDefault implementation actually download the artifact Subclasses should overwrite this to avoid the download- Specified by:
locatein interfaceDependencyResolver- Overrides:
locatein classAbstractResolver- Parameters:
artifact- ArtifactOrigin- Returns:
- ArtifactOrigin
-
download
public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options)
Description copied from class:AbstractResolverDefault implementation downloads the artifact without taking advantage of its location- Specified by:
downloadin interfaceDependencyResolver- Overrides:
downloadin classAbstractResolver- Parameters:
artifact- ArtifactOriginoptions- DownloadOptions- Returns:
- ArtifactDownloadReport
-
setLatest
private static void setLatest(DependencyResolver resolver, LatestStrategy latest)
-
getLatest
private static LatestStrategy getLatest(DependencyResolver resolver)
-
getLatestStrategyName
private static java.lang.String getLatestStrategyName(DependencyResolver resolver)
-
setDual
public void setDual(boolean b)
-
isDual
public boolean isDual()
-
-