org.sonatype.aether.repository
Class RepositoryPolicy

java.lang.Object
  extended by org.sonatype.aether.repository.RepositoryPolicy

public final class RepositoryPolicy
extends java.lang.Object

A policy controlling access to a repository. Note: Instances of this class are immutable and the exposed mutators return new objects rather than changing the current instance.

Author:
Benjamin Bentmann

Field Summary
static java.lang.String CHECKSUM_POLICY_FAIL
          Verify checksums and fail the resolution if they do not match.
static java.lang.String CHECKSUM_POLICY_IGNORE
          Do not verify checksums.
static java.lang.String CHECKSUM_POLICY_WARN
          Verify checksums and warn if they do not match.
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
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.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getChecksumPolicy()
          Gets the policy for checksum validation.
 java.lang.String getUpdatePolicy()
          Gets the update policy for locally cached data from the repository.
 int hashCode()
           
 boolean isEnabled()
          Indicates whether the associated repository should be contacted or not.
 RepositoryPolicy setChecksumPolicy(java.lang.String checksumPolicy)
          Sets the policy for checksum validation.
 RepositoryPolicy setEnabled(boolean enabled)
          Sets the enabled flag for the associated repository.
 RepositoryPolicy setUpdatePolicy(java.lang.String updatePolicy)
          Sets the update policy for locally cached data from the repository.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UPDATE_POLICY_NEVER

public static final java.lang.String UPDATE_POLICY_NEVER
Never update locally cached data.

See Also:
Constant Field Values

UPDATE_POLICY_ALWAYS

public static final java.lang.String UPDATE_POLICY_ALWAYS
Always update locally cached data.

See Also:
Constant Field Values

UPDATE_POLICY_DAILY

public static final java.lang.String UPDATE_POLICY_DAILY
Update locally cached data once a day.

See Also:
Constant Field Values

UPDATE_POLICY_INTERVAL

public static final java.lang.String UPDATE_POLICY_INTERVAL
Update locally cached data every X minutes as given by "interval:X".

See Also:
Constant Field Values

CHECKSUM_POLICY_FAIL

public static final java.lang.String CHECKSUM_POLICY_FAIL
Verify checksums and fail the resolution if they do not match.

See Also:
Constant Field Values

CHECKSUM_POLICY_WARN

public static final java.lang.String CHECKSUM_POLICY_WARN
Verify checksums and warn if they do not match.

See Also:
Constant Field Values

CHECKSUM_POLICY_IGNORE

public static final java.lang.String CHECKSUM_POLICY_IGNORE
Do not verify checksums.

See Also:
Constant Field Values
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.

Parameters:
enabled - A flag whether the associated repository should be accessed or not.
updatePolicy - The update interval after which locally cached data from the repository is considered stale and should be refetched, may be null.
checksumPolicy - The way checksum verification should be handled, may be null.
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.

setEnabled

public RepositoryPolicy setEnabled(boolean enabled)
Sets the enabled flag for the associated repository.

Parameters:
enabled - true if the repository should be contacted, false otherwise.
Returns:
The new policy, never null.

getUpdatePolicy

public java.lang.String getUpdatePolicy()
Gets the update policy for locally cached data from the repository.

Returns:
The update policy, never null.

setUpdatePolicy

public RepositoryPolicy setUpdatePolicy(java.lang.String updatePolicy)
Sets the update policy for locally cached data from the repository. Well-known policies are UPDATE_POLICY_NEVER, UPDATE_POLICY_ALWAYS, UPDATE_POLICY_DAILY and UPDATE_POLICY_INTERVAL

Parameters:
updatePolicy - The update policy, may be null.
Returns:
The new policy, never null.

getChecksumPolicy

public java.lang.String getChecksumPolicy()
Gets the policy for checksum validation.

Returns:
The checksum policy, never null.

setChecksumPolicy

public RepositoryPolicy setChecksumPolicy(java.lang.String checksumPolicy)
Sets the policy for checksum validation. Well-known policies are CHECKSUM_POLICY_FAIL, CHECKSUM_POLICY_WARN and CHECKSUM_POLICY_IGNORE.

Parameters:
checksumPolicy - The checksum policy, may be null.
Returns:
The new 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


Copyright © 2010 Sonatype, Inc.. All Rights Reserved.