@Service(value="metadataTools#default") public class MetadataTools extends Object implements org.apache.archiva.redback.components.registry.RegistryListener
Modifier and Type | Field and Description |
---|---|
private ChecksumAlgorithm[] |
algorithms |
private List<String> |
artifactPatterns |
private ArchivaConfiguration |
configuration |
private FileTypes |
filetypes |
private static char |
GROUP_SEPARATOR |
private SimpleDateFormat |
lastUpdatedFormat |
private org.slf4j.Logger |
log |
static String |
MAVEN_ARCHETYPE_CATALOG |
static String |
MAVEN_METADATA |
private static char[] |
NUMS |
private static char |
PATH_SEPARATOR |
private Map<String,Set<String>> |
proxies |
Constructor and Description |
---|
MetadataTools() |
Modifier and Type | Method and Description |
---|---|
void |
afterConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry,
String propertyName,
Object propertyValue) |
void |
beforeConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry,
String propertyName,
Object propertyValue) |
private Set<String> |
findPossibleVersions(Set<String> versions,
File metadataParentDirectory)
Skims the parent directory of a metadata in vain hope of finding
subdirectories that contain poms.
|
private String |
formatAsDirectory(String directory) |
Set<String> |
gatherSnapshotVersions(ManagedRepositoryContent managedRepository,
VersionedReference reference)
Gather the set of snapshot versions found in a particular versioned reference.
|
ArchivaConfiguration |
getConfiguration() |
private long |
getExistingLastUpdated(File metadataFile) |
FileTypes |
getFiletypes() |
ArtifactReference |
getFirstArtifact(ManagedRepositoryContent managedRepository,
VersionedReference reference)
Get the first Artifact found in the provided VersionedReference location.
|
private long |
getLastUpdated(ArchivaRepositoryMetadata metadata) |
private List<ArchivaRepositoryMetadata> |
getMetadatasForManagedRepository(ManagedRepositoryContent managedRepository,
String logicalResource) |
String |
getRepositorySpecificName(RemoteRepositoryContent repository,
String path)
Adjusts a path for a metadata.xml file to its repository specific path.
|
String |
getRepositorySpecificName(String proxyId,
String path)
Adjusts a path for a metadata.xml file to its repository specific path.
|
private boolean |
hasNumberAnywhere(String version) |
private void |
initConfigVariables() |
void |
initialize() |
ArchivaRepositoryMetadata |
readProxyMetadata(ManagedRepositoryContent managedRepository,
ProjectReference reference,
String proxyId) |
ArchivaRepositoryMetadata |
readProxyMetadata(ManagedRepositoryContent managedRepository,
String logicalResource,
String proxyId) |
ArchivaRepositoryMetadata |
readProxyMetadata(ManagedRepositoryContent managedRepository,
VersionedReference reference,
String proxyId) |
void |
setConfiguration(ArchivaConfiguration configuration) |
void |
setFiletypes(FileTypes filetypes) |
private Date |
toLastUpdatedDate(long lastUpdated) |
private long |
toLastUpdatedLong(String timestampString) |
String |
toPath(ProjectReference reference) |
String |
toPath(VersionedReference reference) |
ProjectReference |
toProjectReference(String path) |
VersionedReference |
toVersionedReference(String path)
Take a path to a maven-metadata.xml, and attempt to translate it to a VersionedReference.
|
void |
updateMetadata(ManagedRepositoryContent managedRepository,
ProjectReference reference)
Deprecated.
|
void |
updateMetadata(ManagedRepositoryContent managedRepository,
String logicalResource) |
void |
updateMetadata(ManagedRepositoryContent managedRepository,
VersionedReference reference)
Deprecated.
|
private void |
updateMetadataVersions(Collection<String> allVersions,
ArchivaRepositoryMetadata metadata) |
private org.slf4j.Logger log
public static final String MAVEN_METADATA
public static final String MAVEN_ARCHETYPE_CATALOG
private static final char PATH_SEPARATOR
private static final char GROUP_SEPARATOR
@Inject @Named(value="archivaConfiguration#default") private ArchivaConfiguration configuration
private ChecksumAlgorithm[] algorithms
private List<String> artifactPatterns
private static final char[] NUMS
private SimpleDateFormat lastUpdatedFormat
public MetadataTools()
public void afterConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry, String propertyName, Object propertyValue)
afterConfigurationChange
in interface org.apache.archiva.redback.components.registry.RegistryListener
public void beforeConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry, String propertyName, Object propertyValue)
beforeConfigurationChange
in interface org.apache.archiva.redback.components.registry.RegistryListener
public Set<String> gatherSnapshotVersions(ManagedRepositoryContent managedRepository, VersionedReference reference) throws LayoutException, IOException, ContentNotFoundException
LayoutException
ContentNotFoundException
IOException
public VersionedReference toVersionedReference(String path) throws RepositoryMetadataException
path
- RepositoryMetadataException
private boolean hasNumberAnywhere(String version)
public ProjectReference toProjectReference(String path) throws RepositoryMetadataException
RepositoryMetadataException
public String toPath(ProjectReference reference)
public String toPath(VersionedReference reference)
private String formatAsDirectory(String directory)
public String getRepositorySpecificName(RemoteRepositoryContent repository, String path)
repository
- the repository to base new path off of.path
- the path to the metadata.xml file to adjust the name of.public String getRepositorySpecificName(String proxyId, String path)
proxyId
- the repository id to base new path off of.path
- the path to the metadata.xml file to adjust the name of.@PostConstruct public void initialize()
public ArchivaRepositoryMetadata readProxyMetadata(ManagedRepositoryContent managedRepository, ProjectReference reference, String proxyId)
public ArchivaRepositoryMetadata readProxyMetadata(ManagedRepositoryContent managedRepository, String logicalResource, String proxyId)
public ArchivaRepositoryMetadata readProxyMetadata(ManagedRepositoryContent managedRepository, VersionedReference reference, String proxyId)
public void updateMetadata(ManagedRepositoryContent managedRepository, String logicalResource) throws RepositoryMetadataException
RepositoryMetadataException
private Set<String> findPossibleVersions(Set<String> versions, File metadataParentDirectory)
metadataParentDirectory
- private List<ArchivaRepositoryMetadata> getMetadatasForManagedRepository(ManagedRepositoryContent managedRepository, String logicalResource)
public void updateMetadata(ManagedRepositoryContent managedRepository, ProjectReference reference) throws LayoutException, RepositoryMetadataException, IOException, ContentNotFoundException
We must treat this as a group or a project metadata file as there is no way to know in advance
managedRepository
- the managed repository where the metadata is kept.reference
- the reference to update.LayoutException
RepositoryMetadataException
IOException
ContentNotFoundException
private void updateMetadataVersions(Collection<String> allVersions, ArchivaRepositoryMetadata metadata)
private Date toLastUpdatedDate(long lastUpdated)
private long toLastUpdatedLong(String timestampString)
private long getLastUpdated(ArchivaRepositoryMetadata metadata)
private long getExistingLastUpdated(File metadataFile)
public void updateMetadata(ManagedRepositoryContent managedRepository, VersionedReference reference) throws LayoutException, RepositoryMetadataException, IOException, ContentNotFoundException
1) If this is a SNAPSHOT reference, then utilize the proxy/repository specific metadata files to represent the current / latest SNAPSHOT available. 2) If this is a RELEASE reference, and the metadata file does not exist, then create the metadata file with contents required of the VersionedReference
managedRepository
- the managed repository where the metadata is kept.reference
- the versioned reference to updateLayoutException
RepositoryMetadataException
IOException
ContentNotFoundException
private void initConfigVariables()
public ArtifactReference getFirstArtifact(ManagedRepositoryContent managedRepository, VersionedReference reference) throws LayoutException, IOException
managedRepository
- the repository to search within.reference
- the reference to the versioned reference to search withinIOException
- if the versioned reference is invalid (example: doesn't exist, or isn't a directory)LayoutException
public ArchivaConfiguration getConfiguration()
public void setConfiguration(ArchivaConfiguration configuration)
public FileTypes getFiletypes()
public void setFiletypes(FileTypes filetypes)
Copyright © 2006–2023 The Apache Software Foundation. All rights reserved.