1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.geronimo.deployment.service.jsr88;
19
20 import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
21 import org.apache.geronimo.deployment.xbeans.ArtifactType;
22 import org.apache.xmlbeans.SchemaTypeLoader;
23 import org.apache.xmlbeans.XmlBeans;
24
25 /**
26 * Represents an artifactType (e.g. a dependency or configId element) in a
27 * Geronimo deployment plan.
28 *
29 * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $
30 */
31 public class Artifact extends XmlBeanSupport {
32 static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderForClassLoader(ArtifactType.class.getClassLoader());
33
34 public Artifact() {
35 super(null);
36 }
37
38 public Artifact(ArtifactType dependency) {
39 super(null);
40 configure(dependency);
41 }
42
43 protected ArtifactType getArtifactType() {
44 return (ArtifactType) getXmlObject();
45 }
46
47 void configure(ArtifactType dependency) {
48 setXmlObject(dependency);
49 }
50
51
52
53 public String getGroupId() {
54 return getArtifactType().getGroupId();
55 }
56
57 public void setGroupId(String groupId) {
58 String old = getGroupId();
59 if(groupId == null) {
60 getArtifactType().unsetGroupId();
61 } else {
62 getArtifactType().setGroupId(groupId);
63 }
64 pcs.firePropertyChange("groupId", old, groupId);
65 }
66
67 public String getArtifactId() {
68 return getArtifactType().getArtifactId();
69 }
70
71 public void setArtifactId(String artifact) {
72 String old = getArtifactId();
73 getArtifactType().setArtifactId(artifact);
74 pcs.firePropertyChange("artifactId", old, artifact);
75 }
76
77 public String getType() {
78 return getArtifactType().getType();
79 }
80
81 public void setType(String type) {
82 String old = getArtifactType().getType();
83 if(type == null) {
84 getArtifactType().unsetType();
85 } else {
86 getArtifactType().setType(type);
87 }
88 pcs.firePropertyChange("type", old, type);
89 }
90
91 public String getVersion() {
92 return getArtifactType().getVersion();
93 }
94
95 public void setVersion(String version) {
96 String old = getVersion();
97 if(version == null) {
98 getArtifactType().unsetVersion();
99 } else {
100 getArtifactType().setVersion(version);
101 }
102 pcs.firePropertyChange("version", old, version);
103 }
104
105
106
107 protected SchemaTypeLoader getSchemaTypeLoader() {
108 return SCHEMA_TYPE_LOADER;
109 }
110 }