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 package org.apache.geronimo.deployment.service.jsr88;
018
019 import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
020 import org.apache.geronimo.deployment.xbeans.ArtifactType;
021 import org.apache.xmlbeans.SchemaTypeLoader;
022 import org.apache.xmlbeans.XmlBeans;
023
024 /**
025 * Represents an artifactType (e.g. a dependency or configId element) in a
026 * Geronimo deployment plan.
027 *
028 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
029 */
030 public class Artifact extends XmlBeanSupport {
031 static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderForClassLoader(ArtifactType.class.getClassLoader());
032
033 public Artifact() {
034 super(null);
035 }
036
037 public Artifact(ArtifactType dependency) {
038 super(null);
039 configure(dependency);
040 }
041
042 protected ArtifactType getArtifactType() {
043 return (ArtifactType) getXmlObject();
044 }
045
046 void configure(ArtifactType dependency) {
047 setXmlObject(dependency);
048 }
049
050 // ----------------------- JavaBean Properties for artifactType ----------------------
051
052 public String getGroupId() {
053 return getArtifactType().getGroupId();
054 }
055
056 public void setGroupId(String groupId) {
057 String old = getGroupId();
058 if(groupId == null) {
059 getArtifactType().unsetGroupId();
060 } else {
061 getArtifactType().setGroupId(groupId);
062 }
063 pcs.firePropertyChange("groupId", old, groupId);
064 }
065
066 public String getArtifactId() {
067 return getArtifactType().getArtifactId();
068 }
069
070 public void setArtifactId(String artifact) {
071 String old = getArtifactId();
072 getArtifactType().setArtifactId(artifact);
073 pcs.firePropertyChange("artifactId", old, artifact);
074 }
075
076 public String getType() {
077 return getArtifactType().getType();
078 }
079
080 public void setType(String type) {
081 String old = getArtifactType().getType();
082 if(type == null) {
083 getArtifactType().unsetType();
084 } else {
085 getArtifactType().setType(type);
086 }
087 pcs.firePropertyChange("type", old, type);
088 }
089
090 public String getVersion() {
091 return getArtifactType().getVersion();
092 }
093
094 public void setVersion(String version) {
095 String old = getVersion();
096 if(version == null) {
097 getArtifactType().unsetVersion();
098 } else {
099 getArtifactType().setVersion(version);
100 }
101 pcs.firePropertyChange("version", old, version);
102 }
103
104 // ----------------------- End of JavaBean Properties ----------------------
105
106 protected SchemaTypeLoader getSchemaTypeLoader() {
107 return SCHEMA_TYPE_LOADER;
108 }
109 }