001 /** 002 * 003 * Licensed to the Apache Software Foundation (ASF) under one or more 004 * contributor license agreements. See the NOTICE file distributed with 005 * this work for additional information regarding copyright ownership. 006 * The ASF licenses this file to You under the Apache License, Version 2.0 007 * (the "License"); you may not use this file except in compliance with 008 * the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 package org.apache.geronimo.deployment.service.jsr88; 019 020 import org.apache.geronimo.deployment.plugin.XmlBeanSupport; 021 import org.apache.geronimo.deployment.xbeans.ArtifactType; 022 import org.apache.xmlbeans.SchemaTypeLoader; 023 import org.apache.xmlbeans.XmlBeans; 024 025 /** 026 * Represents an artifactType (e.g. a dependency or configId element) in a 027 * Geronimo deployment plan. 028 * 029 * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $ 030 */ 031 public class Artifact extends XmlBeanSupport { 032 static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderForClassLoader(ArtifactType.class.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 }