Package org.eclipse.aether.impl
Class UpdateCheck<T,E extends org.eclipse.aether.RepositoryException>
- java.lang.Object
-
- org.eclipse.aether.impl.UpdateCheck<T,E>
-
- Type Parameters:
T-E-
public final class UpdateCheck<T,E extends org.eclipse.aether.RepositoryException> extends java.lang.Object
A request to check if an update of an artifact/metadata from a remote repository is needed.- See Also:
UpdateCheckManager
-
-
Constructor Summary
Constructors Constructor Description UpdateCheck()Creates an uninitialized update check request.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetArtifactPolicy()Gets the policy to use for the artifact check.org.eclipse.aether.repository.RemoteRepositorygetAuthoritativeRepository()Gets the repository which ultimately hosts the metadata to update.EgetException()Gets the exception that occurred during the update check.java.io.FilegetFile()Deprecated.UsegetPath()instead.TgetItem()Gets the item of the check.longgetLocalLastUpdated()Gets the last-modified timestamp of the corresponding item produced by a local installation.java.lang.StringgetMetadataPolicy()Gets the policy to use for the metadata check.java.nio.file.PathgetPath()Returns the local file of the item.org.eclipse.aether.repository.RemoteRepositorygetRepository()Gets the repository from which a potential update/download will performed.booleanisFileValid()Indicates whether the local file given bygetFile(), if existent, should be considered valid or not.booleanisRequired()Gets the result of a check, denoting whether the remote repository should be checked for updates.UpdateCheck<T,E>setArtifactPolicy(java.lang.String artifactPolicy)Sets the artifact policy to use for the check.UpdateCheck<T,E>setAuthoritativeRepository(org.eclipse.aether.repository.RemoteRepository authoritativeRepository)Sets the repository which ultimately hosts the metadata to update.UpdateCheck<T,E>setException(E exception)Sets the exception for this update check.UpdateCheck<T,E>setFile(java.io.File file)Deprecated.UsesetPath(Path)instead.UpdateCheck<T,E>setFileValid(boolean fileValid)Controls whether the local file given bygetFile(), if existent, should be considered valid or not.UpdateCheck<T,E>setItem(T item)Sets the item of the check.UpdateCheck<T,E>setLocalLastUpdated(long localLastUpdated)Sets the last-modified timestamp of the corresponding item produced by a local installation.UpdateCheck<T,E>setMetadataPolicy(java.lang.String metadataPolicy)Sets the metadata policy to use for the check.UpdateCheck<T,E>setPath(java.nio.file.Path path)Sets the local file of the item.UpdateCheck<T,E>setRepository(org.eclipse.aether.repository.RemoteRepository repository)Sets the repository from which a potential update/download will performed.UpdateCheck<T,E>setRequired(boolean required)Sets the result of an update check.java.lang.StringtoString()
-
-
-
Constructor Detail
-
UpdateCheck
public UpdateCheck()
Creates an uninitialized update check request.
-
-
Method Detail
-
getLocalLastUpdated
public long getLocalLastUpdated()
Gets the last-modified timestamp of the corresponding item produced by a local installation. If non-zero, a remote update will be surpressed if the local item is up-to-date, even if the remote item has not been cached locally.- Returns:
- The last-modified timestamp of the corresponding item produced by a local installation or
0to ignore any local item.
-
setLocalLastUpdated
public UpdateCheck<T,E> setLocalLastUpdated(long localLastUpdated)
Sets the last-modified timestamp of the corresponding item produced by a local installation. If non-zero, a remote update will be surpressed if the local item is up-to-date, even if the remote item has not been cached locally.- Parameters:
localLastUpdated- The last-modified timestamp of the corresponding item produced by a local installation or0to ignore any local item.- Returns:
- This object for chaining.
-
setItem
public UpdateCheck<T,E> setItem(T item)
Sets the item of the check.- Parameters:
item- The item of the check, must not benull.- Returns:
- This object for chaining.
-
getFile
@Deprecated public java.io.File getFile()
Deprecated.UsegetPath()instead.Returns the local file of the item.- Returns:
- The local file of the item.
-
getPath
public java.nio.file.Path getPath()
Returns the local file of the item.- Returns:
- The local file of the item.
- Since:
- 2.0.0
-
setFile
@Deprecated public UpdateCheck<T,E> setFile(java.io.File file)
Deprecated.UsesetPath(Path)instead.Sets the local file of the item.- Parameters:
file- The file of the item, nevernull.- Returns:
- This object for chaining.
-
setPath
public UpdateCheck<T,E> setPath(java.nio.file.Path path)
Sets the local file of the item.- Parameters:
path- The file of the item, nevernull.- Returns:
- This object for chaining.
- Since:
- 2.0.0
-
isFileValid
public boolean isFileValid()
Indicates whether the local file given bygetFile(), if existent, should be considered valid or not. An invalid file is equivalent to a physically missing file.- Returns:
trueif the file should be considered valid if existent,falseif the file should be treated as if it was missing.
-
setFileValid
public UpdateCheck<T,E> setFileValid(boolean fileValid)
Controls whether the local file given bygetFile(), if existent, should be considered valid or not. An invalid file is equivalent to a physically missing file.- Parameters:
fileValid-trueif the file should be considered valid if existent,falseif the file should be treated as if it was missing.- Returns:
- This object for chaining.
-
getArtifactPolicy
public java.lang.String getArtifactPolicy()
Gets the policy to use for the artifact check.- Returns:
- The policy to use for the artifact check.
- Since:
- 2.0.0
- See Also:
RepositoryPolicy
-
getMetadataPolicy
public java.lang.String getMetadataPolicy()
Gets the policy to use for the metadata check.- Returns:
- The policy to use for the metadata check.
- Since:
- 2.0.0
- See Also:
RepositoryPolicy
-
setArtifactPolicy
public UpdateCheck<T,E> setArtifactPolicy(java.lang.String artifactPolicy)
Sets the artifact policy to use for the check.- Parameters:
artifactPolicy- The policy to use for the artifact check, may benull.- Returns:
- This object for chaining.
- Since:
- 2.0.0
- See Also:
RepositoryPolicy
-
setMetadataPolicy
public UpdateCheck<T,E> setMetadataPolicy(java.lang.String metadataPolicy)
Sets the metadata policy to use for the check.- Parameters:
metadataPolicy- The policy to use for the metadata check, may benull.- Returns:
- This object for chaining.
- Since:
- 2.0.0
- See Also:
RepositoryPolicy
-
getRepository
public org.eclipse.aether.repository.RemoteRepository getRepository()
Gets the repository from which a potential update/download will performed.- Returns:
- The repository to use for the check.
-
setRepository
public UpdateCheck<T,E> setRepository(org.eclipse.aether.repository.RemoteRepository repository)
Sets the repository from which a potential update/download will performed.- Parameters:
repository- The repository to use for the check, must not benull.- Returns:
- This object for chaining.
-
getAuthoritativeRepository
public org.eclipse.aether.repository.RemoteRepository getAuthoritativeRepository()
Gets the repository which ultimately hosts the metadata to update. This will be different from the repository given bygetRepository()in case the latter denotes a repository manager.- Returns:
- The actual repository hosting the authoritative copy of the metadata to update, never
nullfor a metadata update check.
-
setAuthoritativeRepository
public UpdateCheck<T,E> setAuthoritativeRepository(org.eclipse.aether.repository.RemoteRepository authoritativeRepository)
Sets the repository which ultimately hosts the metadata to update. This will be different from the repository given bygetRepository()in case the latter denotes a repository manager.- Parameters:
authoritativeRepository- The actual repository hosting the authoritative copy of the metadata to update, must not benullfor a metadata update check.- Returns:
- This object for chaining.
-
isRequired
public boolean isRequired()
Gets the result of a check, denoting whether the remote repository should be checked for updates.- Returns:
- The result of a check.
-
setRequired
public UpdateCheck<T,E> setRequired(boolean required)
Sets the result of an update check.- Parameters:
required- The result of an update check. In case offalseand the local file given bygetFile()does actually not exist,setException(RepositoryException)should be used to provide the previous/cached failure that explains the absence of the file.- Returns:
- This object for chaining.
-
getException
public E getException()
Gets the exception that occurred during the update check.- Returns:
- The occurred exception or
nullif the update check was successful.
-
setException
public UpdateCheck<T,E> setException(E exception)
Sets the exception for this update check.- Parameters:
exception- The exception for this update check, may benullif the check was successful.- Returns:
- This object for chaining.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-