Package org.eclipse.aether.internal.impl
Class DefaultUpdateCheckManager
- java.lang.Object
-
- org.eclipse.aether.internal.impl.DefaultUpdateCheckManager
-
- All Implemented Interfaces:
UpdateCheckManager
,Service
@Named public class DefaultUpdateCheckManager extends java.lang.Object implements UpdateCheckManager, Service
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
CONFIG_PROP_SESSION_STATE
private static java.lang.String
ERROR_KEY_SUFFIX
private static org.slf4j.Logger
LOGGER
private static java.lang.String
NOT_FOUND
private static java.lang.String
SESSION_CHECKS
private static int
STATE_BYPASS
private static int
STATE_DISABLED
private static int
STATE_ENABLED
private static java.lang.String
UPDATED_KEY_SUFFIX
private UpdatePolicyAnalyzer
updatePolicyAnalyzer
-
Constructor Summary
Constructors Constructor Description DefaultUpdateCheckManager()
DefaultUpdateCheckManager(UpdatePolicyAnalyzer updatePolicyAnalyzer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.private static int
getCacheFlag(java.lang.String error)
private java.lang.String
getDataKey(Artifact artifact, java.io.File artifactFile, RemoteRepository repository)
private java.lang.String
getDataKey(Metadata metadata, java.io.File metadataFile, RemoteRepository repository)
private java.lang.String
getError(java.util.Properties props, java.lang.String key)
private long
getLastUpdated(java.util.Properties props, java.lang.String key)
private java.lang.String
getRepoKey(RepositorySystemSession session, RemoteRepository repository)
private int
getSessionState(RepositorySystemSession session)
private java.io.File
getTouchFile(Artifact artifact, java.io.File artifactFile)
private java.io.File
getTouchFile(Metadata metadata, java.io.File metadataFile)
private java.lang.String
getTransferKey(RepositorySystemSession session, Artifact artifact, java.io.File artifactFile, RemoteRepository repository)
private java.lang.String
getTransferKey(RepositorySystemSession session, Metadata metadata, java.io.File metadataFile, RemoteRepository repository)
private java.lang.String
getUpdateKey(RepositorySystemSession session, java.io.File file, RemoteRepository repository)
private boolean
hasErrors(java.util.Properties props)
void
initService(ServiceLocator locator)
Provides the opportunity to initialize this service and to acquire other services for its operation from the locator.private boolean
isAlreadyUpdated(RepositorySystemSession session, java.lang.Object updateKey)
private boolean
isUpdatedRequired(RepositorySystemSession session, long lastModified, java.lang.String policy)
private ArtifactTransferException
newException(java.lang.String error, Artifact artifact, RemoteRepository repository)
private MetadataTransferException
newException(java.lang.String error, Metadata metadata, RemoteRepository repository)
private java.lang.String
normalizeRepoUrl(java.lang.String url)
private java.util.Properties
read(java.io.File touchFile)
private void
setUpdated(RepositorySystemSession session, java.lang.Object updateKey)
DefaultUpdateCheckManager
setUpdatePolicyAnalyzer(UpdatePolicyAnalyzer updatePolicyAnalyzer)
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.private java.util.Properties
write(java.io.File touchFile, java.lang.String dataKey, java.lang.String transferKey, java.lang.Exception error)
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
updatePolicyAnalyzer
private UpdatePolicyAnalyzer updatePolicyAnalyzer
-
UPDATED_KEY_SUFFIX
private static final java.lang.String UPDATED_KEY_SUFFIX
- See Also:
- Constant Field Values
-
ERROR_KEY_SUFFIX
private static final java.lang.String ERROR_KEY_SUFFIX
- See Also:
- Constant Field Values
-
NOT_FOUND
private static final java.lang.String NOT_FOUND
- See Also:
- Constant Field Values
-
SESSION_CHECKS
private static final java.lang.String SESSION_CHECKS
- See Also:
- Constant Field Values
-
CONFIG_PROP_SESSION_STATE
static final java.lang.String CONFIG_PROP_SESSION_STATE
- See Also:
- Constant Field Values
-
STATE_ENABLED
private static final int STATE_ENABLED
- See Also:
- Constant Field Values
-
STATE_BYPASS
private static final int STATE_BYPASS
- See Also:
- Constant Field Values
-
STATE_DISABLED
private static final int STATE_DISABLED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultUpdateCheckManager
public DefaultUpdateCheckManager()
-
DefaultUpdateCheckManager
@Inject DefaultUpdateCheckManager(UpdatePolicyAnalyzer updatePolicyAnalyzer)
-
-
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 interfaceService
- Parameters:
locator
- The service locator, must not benull
.
-
setUpdatePolicyAnalyzer
public DefaultUpdateCheckManager setUpdatePolicyAnalyzer(UpdatePolicyAnalyzer updatePolicyAnalyzer)
-
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 interfaceUpdateCheckManager
- Parameters:
session
- The repository system session during which the request is made, must not benull
.check
- The update check request, must not benull
.
-
getCacheFlag
private static int getCacheFlag(java.lang.String error)
-
newException
private ArtifactTransferException newException(java.lang.String error, Artifact artifact, RemoteRepository repository)
-
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 interfaceUpdateCheckManager
- Parameters:
session
- The repository system session during which the request is made, must not benull
.check
- The update check request, must not benull
.
-
newException
private MetadataTransferException newException(java.lang.String error, Metadata metadata, RemoteRepository repository)
-
getLastUpdated
private long getLastUpdated(java.util.Properties props, java.lang.String key)
-
getError
private java.lang.String getError(java.util.Properties props, java.lang.String key)
-
getTouchFile
private java.io.File getTouchFile(Artifact artifact, java.io.File artifactFile)
-
getTouchFile
private java.io.File getTouchFile(Metadata metadata, java.io.File metadataFile)
-
getDataKey
private java.lang.String getDataKey(Artifact artifact, java.io.File artifactFile, RemoteRepository repository)
-
getTransferKey
private java.lang.String getTransferKey(RepositorySystemSession session, Artifact artifact, java.io.File artifactFile, RemoteRepository repository)
-
getDataKey
private java.lang.String getDataKey(Metadata metadata, java.io.File metadataFile, RemoteRepository repository)
-
getTransferKey
private java.lang.String getTransferKey(RepositorySystemSession session, Metadata metadata, java.io.File metadataFile, RemoteRepository repository)
-
getRepoKey
private java.lang.String getRepoKey(RepositorySystemSession session, RemoteRepository repository)
-
normalizeRepoUrl
private java.lang.String normalizeRepoUrl(java.lang.String url)
-
getUpdateKey
private java.lang.String getUpdateKey(RepositorySystemSession session, java.io.File file, RemoteRepository repository)
-
getSessionState
private int getSessionState(RepositorySystemSession session)
-
isAlreadyUpdated
private boolean isAlreadyUpdated(RepositorySystemSession session, java.lang.Object updateKey)
-
setUpdated
private void setUpdated(RepositorySystemSession session, java.lang.Object updateKey)
-
isUpdatedRequired
private boolean isUpdatedRequired(RepositorySystemSession session, long lastModified, java.lang.String policy)
-
read
private java.util.Properties read(java.io.File touchFile)
-
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 interfaceUpdateCheckManager
- Parameters:
session
- The repository system session during which the request is made, must not benull
.check
- The update check request, must not benull
.
-
hasErrors
private boolean hasErrors(java.util.Properties props)
-
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 interfaceUpdateCheckManager
- Parameters:
session
- The repository system session during which the request is made, must not benull
.check
- The update check request, must not benull
.
-
write
private java.util.Properties write(java.io.File touchFile, java.lang.String dataKey, java.lang.String transferKey, java.lang.Exception error)
-
-