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