org.apache.ivy.plugins.resolver
Class DualResolver

java.lang.Object
  extended by org.apache.ivy.plugins.resolver.AbstractResolver
      extended by org.apache.ivy.plugins.resolver.DualResolver
All Implemented Interfaces:
DependencyResolver, HasLatestStrategy

public class DualResolver
extends AbstractResolver

DualResolver is used to resolve dependencies with one dependency revolver, called ivy resolver, and then download artifacts found in the resolved dependencies from a second dependency resolver, called artifact resolver. It is especially useful with resolvers using repository where there is a lot of artifact, but no ivy file, like the maven ibiblio repository. If no ivy file is found by the ivy resolver, the artifact resolver is used to check if there is artifact corresponding to the request (with default ivy file). For artifact download, however, only the artifact resolver is used. Exactly two resolvers should be added to this resolver for it to work properly. The first resolver added if the ivy resolver, the second is the artifact one.


Constructor Summary
DualResolver()
           
 
Method Summary
 void abortPublishTransaction()
           
 void add(DependencyResolver resolver)
           
 void beginPublishTransaction(ModuleRevisionId module, boolean overwrite)
           
 void commitPublishTransaction()
           
 DownloadReport download(Artifact[] artifacts, DownloadOptions options)
           
 void dumpSettings()
           
 boolean exists(Artifact artifact)
          Default implementation actually download the artifact Subclasses should overwrite this to avoid the download
 ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data)
          Finds the module descriptor for the specified DependencyDescriptor.
 DependencyResolver getArtifactResolver()
           
 ResolvedModuleRevision 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. a revision uniquely identifying the revision of a module in the current environment - If this revision is not able to identify uniquelely the revision of the module outside of the current environment, then the resolved revision must begin by ##)
 DependencyResolver getIvyResolver()
           
 boolean isAllownomd()
           
 void publish(Artifact artifact, java.io.File src, boolean overwrite)
           
 void reportFailure()
          Reports last resolve failure as Messages
 void reportFailure(Artifact art)
          Reports last artifact download failure as Messages
 void setAllownomd(boolean allownomd)
           
 void setArtifactResolver(DependencyResolver artifactResolver)
           
 void setIvyResolver(DependencyResolver ivyResolver)
           
 
Methods inherited from class org.apache.ivy.plugins.resolver.AbstractResolver
checkInterrupted, doValidate, findModuleInCache, fromSystem, fromSystem, getChangingMatcher, getChangingMatcherName, getChangingPattern, getLatest, getLatestStrategy, getName, getNamespace, getSettings, getSystemNode, getTypeName, hidePassword, isValidate, listModules, listOrganisations, listRevisions, listTokenValues, setChangingMatcher, setChangingPattern, setLatest, setLatestStrategy, setName, setNamespace, setSettings, setValidate, toString, toSystem, toSystem, toSystem, toSystem, toSystem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DualResolver

public DualResolver()
Method Detail

add

public void add(DependencyResolver resolver)

getDependency

public ResolvedModuleRevision getDependency(DependencyDescriptor dd,
                                            ResolveData data)
                                     throws java.text.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 uniquelely the revision of the module outside of the current environment, then the resolved revision must begin by ##)

Throws:
java.text.ParseException

findIvyFileRef

public ResolvedResource findIvyFileRef(DependencyDescriptor dd,
                                       ResolveData data)
Description copied from interface: DependencyResolver
Finds the module descriptor for the specified DependencyDescriptor. If this resolver can't find the module descriptor, null is returned.

Parameters:
dd - the dependency descriptor
data - the resolve data
Returns:
the module descriptor, or null

reportFailure

public void reportFailure()
Description copied from interface: DependencyResolver
Reports last resolve failure as Messages

Specified by:
reportFailure in interface DependencyResolver
Overrides:
reportFailure in class AbstractResolver

reportFailure

public void reportFailure(Artifact art)
Description copied from interface: DependencyResolver
Reports last artifact download failure as Messages

Specified by:
reportFailure in interface DependencyResolver
Overrides:
reportFailure in class AbstractResolver

download

public DownloadReport download(Artifact[] artifacts,
                               DownloadOptions options)

getArtifactResolver

public DependencyResolver getArtifactResolver()

setArtifactResolver

public void setArtifactResolver(DependencyResolver artifactResolver)

getIvyResolver

public DependencyResolver getIvyResolver()

setIvyResolver

public void setIvyResolver(DependencyResolver ivyResolver)

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:
abortPublishTransaction in interface DependencyResolver
Overrides:
abortPublishTransaction in class AbstractResolver
Throws:
java.io.IOException

beginPublishTransaction

public void beginPublishTransaction(ModuleRevisionId module,
                                    boolean overwrite)
                             throws java.io.IOException
Specified by:
beginPublishTransaction in interface DependencyResolver
Overrides:
beginPublishTransaction in class AbstractResolver
Throws:
java.io.IOException

commitPublishTransaction

public void commitPublishTransaction()
                              throws java.io.IOException
Specified by:
commitPublishTransaction in interface DependencyResolver
Overrides:
commitPublishTransaction in class AbstractResolver
Throws:
java.io.IOException

dumpSettings

public void dumpSettings()
Specified by:
dumpSettings in interface DependencyResolver
Overrides:
dumpSettings in class AbstractResolver

exists

public boolean exists(Artifact artifact)
Description copied from class: AbstractResolver
Default implementation actually download the artifact Subclasses should overwrite this to avoid the download

Specified by:
exists in interface DependencyResolver
Overrides:
exists in class AbstractResolver

isAllownomd

public boolean isAllownomd()

setAllownomd

public void setAllownomd(boolean allownomd)