Search in sources :

Example 1 with HTTP_METADATA_EXT

use of org.commonjava.maven.galley.io.SpecialPathConstants.HTTP_METADATA_EXT in project indy by Commonjava.

the class DefaultContentManager method doRetrieve.

private Transfer doRetrieve(final ArtifactStore store, final String path, final EventMetadata eventMetadata) throws IndyWorkflowException {
    logger.trace("Attempting to retrieve: {} from: {}", path, store.getKey());
    if (store.isDisabled()) {
        logger.debug("Content not available in repository due to store disabled for {}, path is {}", store, path);
        return null;
    }
    Transfer item = null;
    try {
        item = downloadManager.retrieve(store, path, eventMetadata);
        if (item == null) {
            item = contentGeneratorManager.generateFileContentAnd(store, path, eventMetadata, transfer -> {
                logger.debug("Resource generated for {}, clean NFC and delete obsolete http-metadata.json", transfer.getResource());
                nfc.clearMissing(transfer.getResource());
                Transfer httpMeta = transfer.getSiblingMeta(HTTP_METADATA_EXT);
                try {
                    httpMeta.delete();
                } catch (IOException e) {
                    logger.warn("Failed to delete {}", httpMeta.getResource());
                }
            });
        }
    } catch (IndyWorkflowException e) {
        e.filterLocationErrors();
    }
    return item;
}
Also used : Arrays(java.util.Arrays) HTTP_METADATA_EXT(org.commonjava.maven.galley.io.SpecialPathConstants.HTTP_METADATA_EXT) ContentDigester(org.commonjava.indy.content.ContentDigester) GroupRepositoryFilterManager(org.commonjava.indy.core.content.group.GroupRepositoryFilterManager) KeyedLocation(org.commonjava.indy.model.galley.KeyedLocation) CHECK_CACHE_ONLY(org.commonjava.indy.IndyContentConstants.CHECK_CACHE_ONLY) LoggerFactory(org.slf4j.LoggerFactory) ContentUtils.dedupeListing(org.commonjava.indy.util.ContentUtils.dedupeListing) StringUtils(org.apache.commons.lang3.StringUtils) SpecialPathInfo(org.commonjava.maven.galley.model.SpecialPathInfo) Group(org.commonjava.indy.model.core.Group) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Transfer(org.commonjava.maven.galley.model.Transfer) Measure(org.commonjava.o11yphant.metrics.annotation.Measure) IndyWorkflowException(org.commonjava.indy.IndyWorkflowException) TransferOperation(org.commonjava.maven.galley.model.TransferOperation) TransferManager(org.commonjava.maven.galley.TransferManager) CASCADE(org.commonjava.indy.IndyContentConstants.CASCADE) DownloadManager(org.commonjava.indy.content.DownloadManager) ApplicationStatus(org.commonjava.indy.util.ApplicationStatus) StoreKey(org.commonjava.indy.model.core.StoreKey) StoreType.group(org.commonjava.indy.model.core.StoreType.group) LocationUtils(org.commonjava.indy.util.LocationUtils) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) Logger(org.slf4j.Logger) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) Set(java.util.Set) SpecialPathManager(org.commonjava.maven.galley.spi.io.SpecialPathManager) IOException(java.io.IOException) NotFoundCache(org.commonjava.maven.galley.spi.nfc.NotFoundCache) Collectors(java.util.stream.Collectors) ContentManager(org.commonjava.indy.content.ContentManager) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) IGNORE_READONLY(org.commonjava.indy.data.StoreDataManager.IGNORE_READONLY) IndyConfiguration(org.commonjava.indy.conf.IndyConfiguration) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) StoreResource(org.commonjava.indy.content.StoreResource) StoreType.hosted(org.commonjava.indy.model.core.StoreType.hosted) IndyDataException(org.commonjava.indy.data.IndyDataException) StoreDataManager(org.commonjava.indy.data.StoreDataManager) HttpExchangeMetadata(org.commonjava.maven.galley.transport.htcli.model.HttpExchangeMetadata) InputStream(java.io.InputStream) IndyWorkflowException(org.commonjava.indy.IndyWorkflowException) Transfer(org.commonjava.maven.galley.model.Transfer) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 IOUtils (org.apache.commons.io.IOUtils)1 StringUtils (org.apache.commons.lang3.StringUtils)1 CASCADE (org.commonjava.indy.IndyContentConstants.CASCADE)1 CHECK_CACHE_ONLY (org.commonjava.indy.IndyContentConstants.CHECK_CACHE_ONLY)1 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)1 IndyConfiguration (org.commonjava.indy.conf.IndyConfiguration)1 ContentDigester (org.commonjava.indy.content.ContentDigester)1 ContentManager (org.commonjava.indy.content.ContentManager)1 DownloadManager (org.commonjava.indy.content.DownloadManager)1 StoreResource (org.commonjava.indy.content.StoreResource)1 GroupRepositoryFilterManager (org.commonjava.indy.core.content.group.GroupRepositoryFilterManager)1 IndyDataException (org.commonjava.indy.data.IndyDataException)1