KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > deployment > service > jsr88 > Artifact


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

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 /**
25  * Represents an artifactType (e.g. a dependency or configId element) in a
26  * Geronimo deployment plan.
27  *
28  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
29  */

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     // ----------------------- JavaBean Properties for artifactType ----------------------
51

52     public String JavaDoc getGroupId() {
53         return getArtifactType().getGroupId();
54     }
55
56     public void setGroupId(String JavaDoc groupId) {
57         String JavaDoc 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 JavaDoc getArtifactId() {
67         return getArtifactType().getArtifactId();
68     }
69
70     public void setArtifactId(String JavaDoc artifact) {
71         String JavaDoc old = getArtifactId();
72         getArtifactType().setArtifactId(artifact);
73         pcs.firePropertyChange("artifactId", old, artifact);
74     }
75
76     public String JavaDoc getType() {
77         return getArtifactType().getType();
78     }
79
80     public void setType(String JavaDoc type) {
81         String JavaDoc 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 JavaDoc getVersion() {
91         return getArtifactType().getVersion();
92     }
93
94     public void setVersion(String JavaDoc version) {
95         String JavaDoc 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     // ----------------------- End of JavaBean Properties ----------------------
105

106     protected SchemaTypeLoader getSchemaTypeLoader() {
107         return SCHEMA_TYPE_LOADER;
108     }
109 }
110
Popular Tags