001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018: package org.apache.ivy.core.resolve;
019:
020: import java.util.Date;
021:
022: import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
023: import org.apache.ivy.core.module.id.ModuleRevisionId;
024: import org.apache.ivy.core.report.MetadataArtifactDownloadReport;
025: import org.apache.ivy.plugins.resolver.DependencyResolver;
026:
027: /**
028: * Represents a module revision provisioned on the local filesystem.
029: */
030: public class ResolvedModuleRevision {
031:
032: private DependencyResolver resolver;
033:
034: private DependencyResolver artifactResolver;
035:
036: private ModuleDescriptor descriptor;
037:
038: private MetadataArtifactDownloadReport report;
039:
040: public ResolvedModuleRevision(DependencyResolver resolver,
041: DependencyResolver artifactResolver,
042: ModuleDescriptor descriptor,
043: MetadataArtifactDownloadReport report) {
044: this .resolver = resolver;
045: this .artifactResolver = artifactResolver;
046: this .descriptor = descriptor;
047: this .report = report;
048: }
049:
050: /**
051: * Returns the identifier of the resolved module.
052: *
053: * @return the identifier of the resolved module.
054: */
055: public ModuleRevisionId getId() {
056: return descriptor.getResolvedModuleRevisionId();
057: }
058:
059: /**
060: * Returns the date of publication of the resolved module.
061: *
062: * @return the date of publication of the resolved module.
063: */
064: public Date getPublicationDate() {
065: return descriptor.getResolvedPublicationDate();
066: }
067:
068: /**
069: * Returns the descriptor of the resolved module.
070: *
071: * @return the descriptor of the resolved module.
072: */
073: public ModuleDescriptor getDescriptor() {
074: return descriptor;
075: }
076:
077: /**
078: * The resolver which resolved this ResolvedModuleRevision
079: *
080: * @return The resolver which resolved this ResolvedModuleRevision
081: */
082: public DependencyResolver getResolver() {
083: return resolver;
084: }
085:
086: /**
087: * The resolver to use to download artifacts
088: *
089: * @return The resolver to use to download artifacts
090: */
091: public DependencyResolver getArtifactResolver() {
092: return artifactResolver;
093: }
094:
095: /**
096: * Returns a report of the resolved module metadata artifact provisioning.
097: *
098: * @return a report of the resolved module metadata artifact provisioning.
099: */
100: public MetadataArtifactDownloadReport getReport() {
101: return report;
102: }
103:
104: public boolean equals(Object obj) {
105: if (!(obj instanceof ResolvedModuleRevision)) {
106: return false;
107: }
108: return ((ResolvedModuleRevision) obj).getId().equals(getId());
109: }
110:
111: public int hashCode() {
112: return getId().hashCode();
113: }
114:
115: public String toString() {
116: return getId().toString();
117: }
118:
119: }
|