1 17 package org.apache.geronimo.deployment.service.jsr88; 18 19 import org.apache.geronimo.deployment.plugin.XmlBeanSupport; 20 import org.apache.geronimo.deployment.xbeans.ArtifactType; 21 import org.apache.xmlbeans.SchemaTypeLoader; 22 import org.apache.xmlbeans.XmlBeans; 23 24 30 public class Artifact extends XmlBeanSupport { 31 static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderForClassLoader(ArtifactType.class.getClassLoader()); 32 33 public Artifact() { 34 super(null); 35 } 36 37 public Artifact(ArtifactType dependency) { 38 super(null); 39 configure(dependency); 40 } 41 42 protected ArtifactType getArtifactType() { 43 return (ArtifactType) getXmlObject(); 44 } 45 46 void configure(ArtifactType dependency) { 47 setXmlObject(dependency); 48 } 49 50 52 public String getGroupId() { 53 return getArtifactType().getGroupId(); 54 } 55 56 public void setGroupId(String groupId) { 57 String old = getGroupId(); 58 if(groupId == null) { 59 getArtifactType().unsetGroupId(); 60 } else { 61 getArtifactType().setGroupId(groupId); 62 } 63 pcs.firePropertyChange("groupId", old, groupId); 64 } 65 66 public String getArtifactId() { 67 return getArtifactType().getArtifactId(); 68 } 69 70 public void setArtifactId(String artifact) { 71 String old = getArtifactId(); 72 getArtifactType().setArtifactId(artifact); 73 pcs.firePropertyChange("artifactId", old, artifact); 74 } 75 76 public String getType() { 77 return getArtifactType().getType(); 78 } 79 80 public void setType(String type) { 81 String old = getArtifactType().getType(); 82 if(type == null) { 83 getArtifactType().unsetType(); 84 } else { 85 getArtifactType().setType(type); 86 } 87 pcs.firePropertyChange("type", old, type); 88 } 89 90 public String getVersion() { 91 return getArtifactType().getVersion(); 92 } 93 94 public void setVersion(String version) { 95 String old = getVersion(); 96 if(version == null) { 97 getArtifactType().unsetVersion(); 98 } else { 99 getArtifactType().setVersion(version); 100 } 101 pcs.firePropertyChange("version", old, version); 102 } 103 104 106 protected SchemaTypeLoader getSchemaTypeLoader() { 107 return SCHEMA_TYPE_LOADER; 108 } 109 } 110 | Popular Tags |