Package org.apache.ivy.core.module.id

Examples of org.apache.ivy.core.module.id.ArtifactRevisionId


                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())) {
                            // found a match, key is
                            // artifact:[name]#[type]#[ext]#[hashcode].location
                            java.util.regex.Matcher m = ARTIFACT_KEY_PATTERN.matcher((String) entry
                                    .getKey());
                            if (m.matches()) {
                                String origName = m.group(1);
                                String origType = m.group(2);
                                String origExt = m.group(3);

                                // first check: the type should end in .original
                                if (!origType.endsWith(".original")) {
                                    continue;
                                }

                                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) {
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.module.id.ArtifactRevisionId

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.