Package org.gradle.internal.resource

Examples of org.gradle.internal.resource.DefaultLocallyAvailableExternalResource


            return copyToCache(location, fileStore, delegate.getResource(location));
        }

        // We might be able to use a cached/locally available version
        if (cached != null && !externalResourceCachePolicy.mustRefreshExternalResource(getAgeMillis(timeProvider, cached))) {
            return new DefaultLocallyAvailableExternalResource(location, new DefaultLocallyAvailableResource(cached.getCachedFile()), cached.getExternalResourceMetaData());
        }

        // Get the metadata first to see if it's there
        final ExternalResourceMetaData remoteMetaData = delegate.getMetaData(location);
        if (remoteMetaData == null) {
            return null;
        }

        // Is the cached version still current?
        if (cached != null) {
            boolean isUnchanged = ExternalResourceMetaDataCompare.isDefinitelyUnchanged(
                    cached.getExternalResourceMetaData(),
                    new Factory<ExternalResourceMetaData>() {
                        public ExternalResourceMetaData create() {
                            return remoteMetaData;
                        }
                    }
            );

            if (isUnchanged) {
                LOGGER.info("Cached resource is up-to-date (lastModified: {}). [HTTP: {}]", cached.getExternalLastModified(), location);
                // TODO - update the index with the new remote meta-data
                return new DefaultLocallyAvailableExternalResource(location, new DefaultLocallyAvailableResource(cached.getCachedFile()), cached.getExternalResourceMetaData());
            }
        }

        // Either no cached, or it's changed. See if we can find something local with the same checksum
        boolean hasLocalCandidates = localCandidates != null && !localCandidates.isNone();
View Full Code Here


                public LocallyAvailableExternalResource create() {
                    LocallyAvailableResource cachedResource = fileStore.moveIntoCache(destination);
                    File fileInFileStore = cachedResource.getFile();
                    ExternalResourceMetaData metaData = resource.getMetaData();
                    cachedExternalResourceIndex.store(source.toString(), fileInFileStore, metaData);
                    return new DefaultLocallyAvailableExternalResource(source, cachedResource, metaData);
                }
            });
        } finally {
            destination.delete();
        }
View Full Code Here

    public LocallyAvailableExternalResource getResource(URI uri) throws IOException {
        File localFile = getFile(uri);
        if (!localFile.exists()) {
            return null;
        }
        return new DefaultLocallyAvailableExternalResource(uri, new DefaultLocallyAvailableResource(localFile));
    }
View Full Code Here

    }

    public LocallyAvailableExternalResource getMetaDataArtifact(ModuleVersionIdentifier moduleVersionIdentifier, ArtifactType artifactType) {
        File resolvedArtifactFile = resolveMetaDataArtifactFile(moduleVersionIdentifier, mainResolvers.getDependencyResolver(), mainResolvers.getArtifactResolver(), artifactType);
        LocallyAvailableResource localResource = new DefaultLocallyAvailableResource(resolvedArtifactFile);
        return new DefaultLocallyAvailableExternalResource(resolvedArtifactFile.toURI(), localResource);
    }
View Full Code Here

import java.io.File;

public abstract class AbstractModuleDescriptorParser implements MetaDataParser {
    public MutableModuleComponentResolveMetaData parseMetaData(DescriptorParseContext ivySettings, File descriptorFile, boolean validate) throws MetaDataParseException {
        LocallyAvailableResource localResource = new DefaultLocallyAvailableResource(descriptorFile);
        LocallyAvailableExternalResource resource = new DefaultLocallyAvailableExternalResource(descriptorFile.toURI(), localResource);
        return parseDescriptor(ivySettings, resource, validate);
    }
View Full Code Here

TOP

Related Classes of org.gradle.internal.resource.DefaultLocallyAvailableExternalResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.