Class RepositoryPolicy


  • public final class RepositoryPolicy
    extends java.lang.Object
    A policy controlling access to a repository.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CHECKSUM_POLICY_FAIL
      Enforce presence of checksums and fail the resolution if they do not match or are absent.
      static java.lang.String CHECKSUM_POLICY_IGNORE
      Ignore presence and verification of checksums.
      static java.lang.String CHECKSUM_POLICY_WARN
      Expect presence of checksums and warn if they do not match or are absent.
      static java.lang.String UPDATE_POLICY_ALWAYS
      Always update locally cached data.
      static java.lang.String UPDATE_POLICY_DAILY
      Update locally cached data once a day.
      static java.lang.String UPDATE_POLICY_INTERVAL
      Update locally cached data every X minutes as given by "interval:X".
      static java.lang.String UPDATE_POLICY_NEVER
      Never update locally cached data.
    • Constructor Summary

      Constructors 
      Constructor Description
      RepositoryPolicy()
      Creates a new policy with checksum warnings and daily update checks.
      RepositoryPolicy​(boolean enabled, java.lang.String updatePolicy, java.lang.String checksumPolicy)
      Creates a new policy with the specified settings (uses same update policy for data and metadata, retains old resolver behaviour).
      RepositoryPolicy​(boolean enabled, java.lang.String artifactUpdatePolicy, java.lang.String metadataUpdatePolicy, java.lang.String checksumPolicy)
      Creates a new policy with the specified settings.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getArtifactUpdatePolicy()
      Gets the update policy for locally cached artifacts from the repository.
      java.lang.String getChecksumPolicy()
      Gets the policy for checksum validation.
      java.lang.String getMetadataUpdatePolicy()
      Gets the update policy for locally cached metadata from the repository.
      java.lang.String getUpdatePolicy()
      Deprecated.
      This method should not be used.
      int hashCode()  
      boolean isEnabled()
      Indicates whether the associated repository should be contacted or not.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RepositoryPolicy

        public RepositoryPolicy()
        Creates a new policy with checksum warnings and daily update checks.
      • RepositoryPolicy

        public RepositoryPolicy​(boolean enabled,
                                java.lang.String updatePolicy,
                                java.lang.String checksumPolicy)
        Creates a new policy with the specified settings (uses same update policy for data and metadata, retains old resolver behaviour).
      • RepositoryPolicy

        public RepositoryPolicy​(boolean enabled,
                                java.lang.String artifactUpdatePolicy,
                                java.lang.String metadataUpdatePolicy,
                                java.lang.String checksumPolicy)
        Creates a new policy with the specified settings.
        Parameters:
        enabled - A flag whether the associated repository should be accessed or not.
        artifactUpdatePolicy - The update interval after which locally cached data from the repository is considered stale and should be re-fetched, may be null.
        metadataUpdatePolicy - The update interval after which locally cached metadata from the repository is considered stale and should be re-fetched, may be null.
        checksumPolicy - The way checksum verification should be handled, may be null.
        Since:
        2.0.0
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Indicates whether the associated repository should be contacted or not.
        Returns:
        true if the repository should be contacted, false otherwise.
      • getUpdatePolicy

        @Deprecated
        public java.lang.String getUpdatePolicy()
        Deprecated.
        This method should not be used. Since version 2 Resolver internally distinguishes between artifact update policy and metadata update policy. This method was left only to preserve binary compatibility, and in reality invokes getArtifactUpdatePolicy().
        This method is not used in Resolver, as resolver internally strictly distinguishes between artifact and metadata update policies.
        See Also:
        getArtifactUpdatePolicy(), getMetadataUpdatePolicy()
      • getArtifactUpdatePolicy

        public java.lang.String getArtifactUpdatePolicy()
        Gets the update policy for locally cached artifacts from the repository.
        Returns:
        The update policy, never null.
        Since:
        2.0.0
      • getMetadataUpdatePolicy

        public java.lang.String getMetadataUpdatePolicy()
        Gets the update policy for locally cached metadata from the repository.
        Returns:
        The update policy, never null.
        Since:
        2.0.0
      • getChecksumPolicy

        public java.lang.String getChecksumPolicy()
        Gets the policy for checksum validation.
        Returns:
        The checksum policy, never null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object