org.sonatype.aether.impl.internal
Class DefaultUpdateCheckManager

java.lang.Object
  extended by org.sonatype.aether.impl.internal.DefaultUpdateCheckManager
All Implemented Interfaces:
UpdateCheckManager, Service

@Component(role=UpdateCheckManager.class)
public class DefaultUpdateCheckManager
extends java.lang.Object
implements UpdateCheckManager, Service

Author:
Benjamin Bentmann

Constructor Summary
DefaultUpdateCheckManager()
           
DefaultUpdateCheckManager(Logger logger)
           
 
Method Summary
 void checkArtifact(RepositorySystemSession session, UpdateCheck<Artifact,ArtifactTransferException> check)
          Checks whether an artifact has to be updated from a remote repository.
 void checkMetadata(RepositorySystemSession session, UpdateCheck<Metadata,MetadataTransferException> check)
          Checks whether metadata has to be updated from a remote repository.
 java.lang.String getEffectiveUpdatePolicy(RepositorySystemSession session, java.lang.String policy1, java.lang.String policy2)
          Returns the policy with the shorter update interval.
 void initService(ServiceLocator locator)
          Provides the opportunity to initialize this service and to acquire other services for its operation from the locator.
 boolean isUpdatedRequired(RepositorySystemSession session, long lastModified, java.lang.String policy)
          Determines whether the specified modification timestamp satisfies the freshness constraint expressed by the given update policy.
 DefaultUpdateCheckManager setLogger(Logger logger)
           
 void touchArtifact(RepositorySystemSession session, UpdateCheck<Artifact,ArtifactTransferException> check)
          Updates the timestamp for the artifact contained in the update check.
 void touchMetadata(RepositorySystemSession session, UpdateCheck<Metadata,MetadataTransferException> check)
          Updates the timestamp for the metadata contained in the update check.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUpdateCheckManager

public DefaultUpdateCheckManager()

DefaultUpdateCheckManager

public DefaultUpdateCheckManager(Logger logger)
Method Detail

initService

public void initService(ServiceLocator locator)
Description copied from interface: Service
Provides the opportunity to initialize this service and to acquire other services for its operation from the locator. A service must not save the reference to the provided service locator.

Specified by:
initService in interface Service
Parameters:
locator - The service locator, must not be null.

setLogger

public DefaultUpdateCheckManager setLogger(Logger logger)

getEffectiveUpdatePolicy

public java.lang.String getEffectiveUpdatePolicy(RepositorySystemSession session,
                                                 java.lang.String policy1,
                                                 java.lang.String policy2)
Description copied from interface: UpdateCheckManager
Returns the policy with the shorter update interval.

Specified by:
getEffectiveUpdatePolicy in interface UpdateCheckManager
Parameters:
session - The repository system session during which the request is made, must not be null.
policy1 - A policy to compare, may be null.
policy2 - A policy to compare, may be null.
Returns:
The policy with the shorter update interval.

checkArtifact

public void checkArtifact(RepositorySystemSession session,
                          UpdateCheck<Artifact,ArtifactTransferException> check)
Description copied from interface: UpdateCheckManager
Checks whether an artifact has to be updated from a remote repository.

Specified by:
checkArtifact in interface UpdateCheckManager
Parameters:
session - The repository system session during which the request is made, must not be null.
check - The update check request, must not be null.

checkMetadata

public void checkMetadata(RepositorySystemSession session,
                          UpdateCheck<Metadata,MetadataTransferException> check)
Description copied from interface: UpdateCheckManager
Checks whether metadata has to be updated from a remote repository.

Specified by:
checkMetadata in interface UpdateCheckManager
Parameters:
session - The repository system session during which the request is made, must not be null.
check - The update check request, must not be null.

isUpdatedRequired

public boolean isUpdatedRequired(RepositorySystemSession session,
                                 long lastModified,
                                 java.lang.String policy)
Description copied from interface: UpdateCheckManager
Determines whether the specified modification timestamp satisfies the freshness constraint expressed by the given update policy.

Specified by:
isUpdatedRequired in interface UpdateCheckManager
Parameters:
session - The repository system session during which the check is made, must not be null.
lastModified - The timestamp to check against the update policy.
policy - The update policy, may be null.
Returns:
true if the specified timestamp is older than acceptable by the update policy, false otherwise.

touchArtifact

public void touchArtifact(RepositorySystemSession session,
                          UpdateCheck<Artifact,ArtifactTransferException> check)
Description copied from interface: UpdateCheckManager
Updates the timestamp for the artifact contained in the update check.

Specified by:
touchArtifact in interface UpdateCheckManager
Parameters:
session - The repository system session during which the request is made, must not be null.
check - The update check request, must not be null.

touchMetadata

public void touchMetadata(RepositorySystemSession session,
                          UpdateCheck<Metadata,MetadataTransferException> check)
Description copied from interface: UpdateCheckManager
Updates the timestamp for the metadata contained in the update check.

Specified by:
touchMetadata in interface UpdateCheckManager
Parameters:
session - The repository system session during which the request is made, must not be null.
check - The update check request, must not be null.


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