1 17 18 package org.apache.geronimo.connector.deployment.dconfigbean; 19 20 import javax.enterprise.deploy.model.DDBean ; 21 import javax.enterprise.deploy.model.XpathListener ; 22 23 import org.apache.geronimo.deployment.plugin.XmlBeanSupport; 24 import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType; 25 import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType; 26 import org.apache.xmlbeans.SchemaTypeLoader; 27 import org.apache.xmlbeans.XmlBeans; 28 29 35 public class AdminObjectInstance extends XmlBeanSupport { 36 private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader(); 37 private AdminObjectDConfigBean parent; 38 private ConfigPropertySettings[] configs; 39 private XpathListener configListener; 40 41 public AdminObjectInstance() { 42 super(null); 43 } 44 45 void initialize(GerAdminobjectInstanceType xmlObject, AdminObjectDConfigBean parent) { 46 setXmlObject(xmlObject); 47 this.parent = parent; 48 DDBean parentDDBean = parent.getDDBean(); 49 configListener = ConfigPropertiesHelper.initialize(parentDDBean, new ConfigPropertiesHelper.ConfigPropertiesSource() { 50 public GerConfigPropertySettingType[] getConfigPropertySettingArray() { 51 return getAdminobjectInstance().getConfigPropertySettingArray(); 52 } 53 54 public GerConfigPropertySettingType addNewConfigPropertySetting() { 55 return getAdminobjectInstance().addNewConfigPropertySetting(); 56 } 57 58 public void removeConfigPropertySetting(int j) { 59 getAdminobjectInstance().removeConfigPropertySetting(j); 60 } 61 62 public ConfigPropertySettings[] getConfigPropertySettings() { 63 return configs; 64 } 65 66 public void setConfigPropertySettings(ConfigPropertySettings[] configs) { 67 setConfigProperty(configs); 68 } 69 70 }, "config-property", "config-property-name"); 71 } 72 73 boolean hasParent() { 74 return parent != null; 75 } 76 77 void dispose() { 78 if (configs != null) { 79 for (int i = 0; i < configs.length; i++) { 80 configs[i].dispose(); 81 } 82 } 83 if (parent != null) { 84 parent.getDDBean().removeXpathListener("config-property", configListener); 85 } 86 configs = null; 87 configListener = null; 88 parent = null; 89 } 90 91 GerAdminobjectInstanceType getAdminobjectInstance() { 93 return (GerAdminobjectInstanceType) getXmlObject(); 94 } 95 96 public ConfigPropertySettings[] getConfigProperty() { 97 return configs; 98 } 99 100 private void setConfigProperty(ConfigPropertySettings[] configs) { ConfigPropertySettings[] old = getConfigProperty(); 102 this.configs = configs; 103 pcs.firePropertyChange("configProperty", old, configs); 104 } 105 106 public String getMessageDestinationName() { 107 return getAdminobjectInstance().getMessageDestinationName(); 108 } 109 110 public void setMessageDestinationName(String messageDestinationName) { 111 getAdminobjectInstance().setMessageDestinationName(messageDestinationName); 112 } 113 114 } 115 | Popular Tags |