ChainResolver
Date: 2014-12-13

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

      public class ChainResolver
      extends AbstractResolver

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ChainResolver.ResolvedModuleRevisionArtifactInfo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChainResolver()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abortPublishTransaction()`
    `void` | `add(DependencyResolver resolver)`
    `void` | `beginPublishTransaction(ModuleRevisionId module, boolean overwrite)`
    `void` | `commitPublishTransaction()`
    `DownloadReport` | `download(Artifact[] artifacts, DownloadOptions options)` Download artifacts with specified DownloadOptions.
    `ArtifactDownloadReport` | `download(ArtifactOrigin artifact, DownloadOptions options)` Default implementation downloads the artifact without taking advantage of its location
    `void` | `dumpSettings()`
    `boolean` | `exists(Artifact artifact)` Returns `true` if the given artifact can be located by this resolver and actually exist.
    `ResolvedResource` | `findIvyFileRef(DependencyDescriptor dd, ResolveData data)` Finds the module descriptor for the specified `DependencyDescriptor`.
    `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 uniquely the revision of the module outside of the current environment, then the resolved revision must begin by ##)
    `java.util.List` | `getResolvers()`
    `boolean` | `isDual()`
    `boolean` | `isReturnFirst()`
    `java.util.Map[]` | `listTokenValues(java.lang.String[] tokens, java.util.Map criteria)` Same as `DependencyResolver.listTokenValues(String, Map)` but more generic.
    `ArtifactOrigin` | `locate(Artifact artifact)` Default implementation actually download the artifact Subclasses should overwrite this to avoid the download
    `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` | `setDual(boolean b)`
    `void` | `setReturnFirst(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, getTypeName, hidePassword, isAfter, isValidate, listModules, listOrganisations, listRevisions, listTokenValues, saveModuleRevisionIfNeeded, setCache, setChangingMatcher, setChangingPattern, setCheckmodified, setEventManager, setLatest, setLatestStrategy, setName, setNamespace, setRepositoryCacheManager, setSettings, setValidate, toString, toSystem, toSystem, toSystem, toSystem, toSystem, toSystem, validate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ChainResolver

          public ChainResolver()

  - ### 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 uniquely 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`

    - #### listTokenValues

          public java.util.Map[] listTokenValues(java.lang.String[] tokens,
                                        java.util.Map criteria)

      Description copied from interface: `DependencyResolver`
      Same as `DependencyResolver.listTokenValues(String, Map)` but more generic.
      Specified by:
        `listTokenValues` in interface `DependencyResolver`
      Overrides:
        `listTokenValues` in class `AbstractResolver`
      Parameters:
        `tokens` - the tokens of the query
        `criteria` - the token which have values
      Returns:
        the list of token values (Map[]), must not be `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)

      Description copied from interface: `DependencyResolver`
      Download 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 an `ArtifactDownloadReport` for each requested Artifact.

      Parameters:
        `artifacts` - an array of artifacts to download. Must not be `null`.
        `options` - options to apply for this download. Must not be `null`.
      Returns:
        a DownloadReport with details about each Artifact download.

    - #### getResolvers

          public java.util.List 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:
        `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`

    - #### isReturnFirst

          public boolean isReturnFirst()

    - #### setReturnFirst

          public void setReturnFirst(boolean returnFirst)

    - #### dumpSettings

          public void dumpSettings()

      Specified by:
        `dumpSettings` in interface `DependencyResolver`
      Overrides:
        `dumpSettings` in class `AbstractResolver`

    - #### exists

          public boolean exists(Artifact artifact)

      Description copied from interface: `DependencyResolver`
      Returns `true` if the given artifact can be located by this resolver and actually exist.
      Specified by:
        `exists` in interface `DependencyResolver`
      Overrides:
        `exists` in class `AbstractResolver`
      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)

      Description copied from class: `AbstractResolver`
      Default implementation actually download the artifact Subclasses should overwrite this to avoid the download
      Specified by:
        `locate` in interface `DependencyResolver`
      Overrides:
        `locate` in class `AbstractResolver`
      Parameters:
        `artifact` - the artifact which should be located
      Returns:
        the artifact location, or `null` if it can't be located by this resolver or doesn't exist.

    - #### download

          public ArtifactDownloadReport download(ArtifactOrigin artifact,
                                        DownloadOptions options)

      Description copied from class: `AbstractResolver`
      Default implementation downloads the artifact without taking advantage of its location
      Specified by:
        `download` in interface `DependencyResolver`
      Overrides:
        `download` in class `AbstractResolver`
      Parameters:
        `artifact` - the location of the artifact to download. Must not be `null`.
        `options` - options to apply for this download. Must not be `null`.
      Returns:
        a report detailing how the download has gone, is never `null`.

    - #### setDual

          public void setDual(boolean b)

    - #### isDual

          public boolean isDual()