Examples of PropertiesFile


Examples of org.apache.ivy.util.PropertiesFile

        return cdf.getProperty("resolver");
    }

    private String getSavedArtResolverName(ModuleDescriptor md) {
        // should always be called with a lock on module metadata artifact
        PropertiesFile cdf = getCachedDataFile(md);
        return cdf.getProperty("artifact.resolver");
    }
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

        return cdf.getProperty("artifact.resolver");
    }

    void saveArtifactOrigin(Artifact artifact, ArtifactOrigin origin) {
        // should always be called with a lock on module metadata artifact
        PropertiesFile cdf = getCachedDataFile(artifact.getModuleRevisionId());
        cdf.setProperty(getIsLocalKey(artifact), String.valueOf(origin.isLocal()));
        cdf.setProperty(getLocationKey(artifact), origin.getLocation());
        cdf.setProperty(getOriginalKey(artifact), getPrefixKey(origin.getArtifact()));
        if (origin.getLastChecked() != null) {
            cdf.setProperty(getLastCheckedKey(artifact), origin.getLastChecked().toString());
        }
        cdf.setProperty(getExistsKey(artifact), Boolean.toString(origin.isExists()));
        cdf.save();
    }
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

        cdf.save();
    }

    private void removeSavedArtifactOrigin(Artifact artifact) {
        // should always be called with a lock on module metadata artifact
        PropertiesFile cdf = getCachedDataFile(artifact.getModuleRevisionId());
        cdf.remove(getLocationKey(artifact));
        cdf.remove(getIsLocalKey(artifact));
        cdf.remove(getLastCheckedKey(artifact));
        cdf.remove(getOriginalKey(artifact));
        cdf.save();
    }
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

        if (!lockMetadataArtifact(mrid)) {
            Message.error("impossible to acquire lock for " + mrid);
            return ArtifactOrigin.unkwnown(artifact);
        }
        try {
            PropertiesFile cdf = getCachedDataFile(artifact.getModuleRevisionId());
            String location = cdf.getProperty(getLocationKey(artifact));
            String local = cdf.getProperty(getIsLocalKey(artifact));
            String lastChecked = cdf.getProperty(getLastCheckedKey(artifact));
            String exists = cdf.getProperty(getExistsKey(artifact));
            String original = cdf.getProperty(getOriginalKey(artifact));

            boolean isLocal = Boolean.valueOf(local).booleanValue();

            if (location == null) {
                // origin has not been specified, return null
                return ArtifactOrigin.unkwnown(artifact);
            }

            if (original != null) {
                // original artifact key artifact:[name]#[type]#[ext]#[hashcode]
                java.util.regex.Matcher m = ARTIFACT_KEY_PATTERN.matcher(original);
                if (m.matches()) {
                    String origName = m.group(1);
                    String origType = m.group(2);
                    String origExt = m.group(3);

                    ArtifactRevisionId originArtifactId = ArtifactRevisionId.newInstance(
                        artifact.getModuleRevisionId(), origName, origType, origExt);
                    // second check: verify the hashcode of the cached artifact
                    if (m.group(4).equals("" + originArtifactId.hashCode())) {
                        try {
                            artifact = new DefaultArtifact(originArtifactId,
                                    artifact.getPublicationDate(), new URL(location), true);
                        } catch (MalformedURLException e) {
                            Message.debug(e);
                        }
                    }
                }
            } else {
                // Fallback if cached with old version:

                // if the origin artifact has another extension (e.g. .pom) then make a synthetic
                // origin artifact for it
                if (!location.endsWith("." + artifact.getExt())) {
                    // try to find other cached artifact info with same location. This must be the
                    // origin. We must parse the key as we do not know for sure what the original
                    // artifact is named.
                    Iterator it = cdf.entrySet().iterator();
                    String ownLocationKey = getLocationKey(artifact);
                    while (it.hasNext()) {
                        Map.Entry entry = (Map.Entry) it.next();
                        if (entry.getValue().equals(location)
                                && !ownLocationKey.equals(entry.getKey())) {
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

    private PropertiesFile getCachedDataFile(ModuleDescriptor md) {
        return getCachedDataFile(md.getResolvedModuleRevisionId());
    }

    private PropertiesFile getCachedDataFile(ModuleRevisionId mRevId) {
        return new PropertiesFile(new File(getRepositoryCacheRoot(), IvyPatternHelper.substitute(
            getDataFilePattern(), mRevId)), "ivy cached data file for " + mRevId);
    }
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

            String resolvedRevision = null;
            if (options.isForce()) {
                Message.verbose("refresh mode: no check for cached resolved revision for " + mrid);
                return null;
            }
            PropertiesFile cachedResolvedRevision = getCachedDataFile(mrid);
            resolvedRevision = cachedResolvedRevision.getProperty("resolved.revision");
            if (resolvedRevision == null) {
                Message.verbose(getName() + ": no cached resolved revision for " + mrid);
                return null;
            }

            String resolvedTime = cachedResolvedRevision.getProperty("resolved.time");
            if (resolvedTime == null) {
                Message.verbose(getName()
                        + ": inconsistent or old cache: no cached resolved time for " + mrid);
                saveResolvedRevision(mrid, resolvedRevision);
                return resolvedRevision;
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

        if (!lockMetadataArtifact(mrid)) {
            Message.error("impossible to acquire lock for " + mrid);
            return;
        }
        try {
            PropertiesFile cachedResolvedRevision = getCachedDataFile(mrid);
            cachedResolvedRevision.setProperty("resolved.time",
                String.valueOf(System.currentTimeMillis()));
            cachedResolvedRevision.setProperty("resolved.revision", revision);
            cachedResolvedRevision.save();
        } finally {
            unlockMetadataArtifact(mrid);
        }
    }
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

        if (!lockMetadataArtifact(mrid)) {
            Message.error("impossible to acquire lock for " + mrid);
            return ArtifactOrigin.unkwnown(artifact);
        }
        try {
            PropertiesFile cdf = getCachedDataFile(artifact.getModuleRevisionId());
            String location = cdf.getProperty(getLocationKey(artifact));
            String local = cdf.getProperty(getIsLocalKey(artifact));
            boolean isLocal = Boolean.valueOf(local).booleanValue();

            if (location == null) {
                // origin has not been specified, return null
                return ArtifactOrigin.unkwnown(artifact);
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

    private PropertiesFile getCachedDataFile(ModuleDescriptor md) {
        return getCachedDataFile(md.getResolvedModuleRevisionId());
    }

    private PropertiesFile getCachedDataFile(ModuleRevisionId mRevId) {
        return new PropertiesFile(new File(getRepositoryCacheRoot(),
            IvyPatternHelper.substitute(
                getDataFilePattern(), mRevId)), "ivy cached data file for " + mRevId);
    }
View Full Code Here

Examples of org.apache.ivy.util.PropertiesFile

            String resolvedRevision = null;
            if (options.isForce()) {
                Message.verbose("refresh mode: no check for cached resolved revision for " + mrid);
                return null;
            }
            PropertiesFile cachedResolvedRevision = getCachedDataFile(mrid);
            resolvedRevision = cachedResolvedRevision.getProperty("resolved.revision");
            if (resolvedRevision == null) {
                Message.verbose(getName() + ": no cached resolved revision for " + mrid);
                return null;
            }
           
            String resolvedTime = cachedResolvedRevision.getProperty("resolved.time");
            if (resolvedTime == null) {
                Message.verbose(getName()
                    + ": inconsistent or old cache: no cached resolved time for " + mrid);
                saveResolvedRevision(mrid, resolvedRevision);
                return resolvedRevision;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.