1 6 package fr.jayasoft.ivy; 7 8 import java.net.URL ; 9 import java.util.ArrayList ; 10 import java.util.Date ; 11 import java.util.List ; 12 import java.util.Map ; 13 14 18 public class MDArtifact extends AbstractArtifact { 19 20 public static Artifact newIvyArtifact(ModuleDescriptor md) { 21 return new MDArtifact(md, "ivy", "ivy", "xml"); 22 } 23 24 private ModuleDescriptor _md; 25 private String _name; 26 private String _type; 27 private String _ext; 28 private List _confs = new ArrayList (); 29 private ArtifactRevisionId _arid; 30 private Map _extraAttributes = null; 31 private URL _url; 32 33 public MDArtifact(ModuleDescriptor md, String name, String type, String ext) { 34 this(md, name, type, ext, null, null); 35 } 36 public MDArtifact(ModuleDescriptor md, String name, String type, String ext, URL url, Map extraAttributes) { 37 if (md == null) { 38 throw new NullPointerException ("null module descriptor not allowed"); 39 } 40 if (name == null) { 41 throw new NullPointerException ("null name not allowed"); 42 } 43 if (type == null) { 44 throw new NullPointerException ("null type not allowed"); 45 } 46 if (ext == null) { 47 throw new NullPointerException ("null ext not allowed"); 48 } 49 _md = md; 50 _name = name; 51 _type = type; 52 _ext = ext; 53 _url = url; 54 _extraAttributes = extraAttributes; 55 } 56 57 public ModuleRevisionId getModuleRevisionId() { 58 return _md.getResolvedModuleRevisionId(); 59 } 60 61 public Date getPublicationDate() { 62 return _md.getResolvedPublicationDate(); 63 } 64 public ArtifactRevisionId getId() { 65 if (_arid == null) { 66 _arid = ArtifactRevisionId.newInstance(_md.getResolvedModuleRevisionId(), _name, _type, _ext, _extraAttributes); 67 } 68 return _arid; 69 } 70 71 public String getName() { 72 return _name; 73 } 74 75 public String getType() { 76 return _type; 77 } 78 79 public String getExt() { 80 return _ext; 81 } 82 83 public String [] getConfigurations() { 84 return (String [])_confs.toArray(new String [_confs.size()]); 85 } 86 87 public void addConfiguration(String conf) { 88 _confs.add(conf); 89 } 90 91 public URL getUrl() { 92 return _url; 93 } 94 95 } 96 | Popular Tags |