Class BasicResolver

    • Field Detail

      • DESCRIPTOR_OPTIONAL

        public static final java.lang.String DESCRIPTOR_OPTIONAL
        See Also:
        Constant Field Values
      • DESCRIPTOR_REQUIRED

        public static final java.lang.String DESCRIPTOR_REQUIRED
        See Also:
        Constant Field Values
      • DATE_FORMAT

        @Deprecated
        public static final java.text.SimpleDateFormat DATE_FORMAT
        Deprecated.
    • Constructor Detail

      • BasicResolver

        public BasicResolver()
    • Method Detail

      • getWorkspaceName

        public java.lang.String getWorkspaceName()
      • setWorkspaceName

        public void setWorkspaceName​(java.lang.String workspaceName)
      • isEnvDependent

        public boolean isEnvDependent()
      • setEnvDependent

        public void setEnvDependent​(boolean envDependent)
      • 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 ##)
        Parameters:
        dd - DependencyDescriptor
        data - ResolveData
        Returns:
        ResolvedModuleRevision
        Throws:
        java.text.ParseException - if something goes wrong
      • findResource

        public ResolvedResource findResource​(ResolvedResource[] rress,
                                             ResourceMDParser rmdparser,
                                             ModuleRevisionId mrid,
                                             java.util.Date date)
        When the resolver has many choices, this function helps choosing one
        Parameters:
        rress - the list of resolved resource which the resolver found to fit the requirement
        rmdparser - the parser of module descriptor
        mrid - the module being resolved
        date - the current date
        Returns:
        the selected resource
      • filterNames

        protected java.util.Collection<java.lang.String> filterNames​(java.util.Collection<java.lang.String> names)
        Filters names before returning them in the findXXXNames or findTokenValues method.

        Remember to call the super implementation when overriding this method.

        Parameters:
        names - the list to filter.
        Returns:
        the filtered list
      • clearIvyAttempts

        protected void clearIvyAttempts()
      • logIvyAttempt

        protected void logIvyAttempt​(java.lang.String attempt)
      • logArtifactAttempt

        protected void logArtifactAttempt​(Artifact art,
                                          java.lang.String attempt)
      • logAttempt

        protected void logAttempt​(java.lang.String attempt)
      • acceptLatest

        protected boolean acceptLatest()
      • 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.
      • clearArtifactAttempts

        protected void clearArtifactAttempts()
      • getResource

        protected abstract Resource getResource​(java.lang.String source)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • 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.
      • 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 interface DependencyResolver
        Overrides:
        listTokenValues in class AbstractResolver
        Parameters:
        token - String
        otherTokenValues - Map
        Returns:
        String[]
      • findNames

        protected abstract java.util.Collection<java.lang.String> findNames​(java.util.Map<java.lang.String,​java.lang.String> tokenValues,
                                                                            java.lang.String token)
      • getAndCheck

        protected long getAndCheck​(Resource resource,
                                   java.io.File dest)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • get

        protected abstract long get​(Resource resource,
                                    java.io.File dest)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • isCheckconsistency

        public boolean isCheckconsistency()
      • setCheckconsistency

        public void setCheckconsistency​(boolean checkConsistency)
      • setForce

        public void setForce​(boolean force)
      • isForce

        public boolean isForce()
      • isAllownomd

        public boolean isAllownomd()
      • setAllownomd

        public void setAllownomd​(boolean b)
      • setDescriptor

        public void setDescriptor​(java.lang.String descriptorRule)
        Sets the module descriptor presence rule. Should be one of DESCRIPTOR_REQUIRED or DESCRIPTOR_OPTIONAL.
        Parameters:
        descriptorRule - the descriptor rule to use with this resolver.
      • getChecksumAlgorithms

        public java.lang.String[] getChecksumAlgorithms()
      • setChecksums

        public void setChecksums​(java.lang.String checksums)