1 17 package org.apache.geronimo.connector.deployment.jsr88; 18 19 import org.apache.geronimo.xbeans.geronimo.GerResourceadapterInstanceType; 20 import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType; 21 import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator; 22 import org.apache.xmlbeans.SchemaTypeLoader; 23 import javax.enterprise.deploy.model.DDBean ; 24 25 34 public class ResourceAdapterInstance extends ConfigHolder { 35 private DDBean resourceAdapter; 36 private GBeanLocator workManager; 37 38 41 public ResourceAdapterInstance() { 42 } 43 44 public ResourceAdapterInstance(DDBean resourceAdapter, GerResourceadapterInstanceType instance) { 45 configure(resourceAdapter, instance); 46 } 47 48 protected GerResourceadapterInstanceType getResourceAdapterInstance() { 49 return (GerResourceadapterInstanceType) getXmlObject(); 50 } 51 52 public void reconfigure() { 53 configure(resourceAdapter, getResourceAdapterInstance()); 54 } 55 56 void configure(DDBean resourceAdapter, GerResourceadapterInstanceType xml) { 57 this.resourceAdapter = resourceAdapter; 58 super.configure(resourceAdapter, xml); 59 } 60 61 protected GerConfigPropertySettingType createConfigProperty() { 62 return getResourceAdapterInstance().addNewConfigPropertySetting(); 63 } 64 65 protected GerConfigPropertySettingType[] getConfigProperties() { 66 return getResourceAdapterInstance().getConfigPropertySettingArray(); 67 } 68 69 protected void removeConfigProperty(int index) { 70 getResourceAdapterInstance().removeConfigPropertySetting(index); 71 } 72 73 75 public String getResourceAdapterName() { 76 return getResourceAdapterInstance().getResourceadapterName(); 77 } 78 79 public void setResourceAdapterName(String name) { 80 String old = getResourceAdapterName(); 81 getResourceAdapterInstance().setResourceadapterName(name); 82 pcs.firePropertyChange("resourceAdapterName", old, name); 83 } 84 85 public GBeanLocator getWorkManager() { 86 return workManager; 87 } 88 89 public void setWorkManager(GBeanLocator locator) { 90 GBeanLocator old = getWorkManager(); 91 if(locator != null && !locator.configured()) { 92 if(getResourceAdapterInstance().getWorkmanager() != null) { 93 locator.configure(getResourceAdapterInstance().getWorkmanager()); 94 } else { 95 locator.configure(getResourceAdapterInstance().addNewWorkmanager()); 96 } 97 } 98 workManager = locator; 99 pcs.firePropertyChange("workManager", old, workManager); 100 } 101 102 104 protected SchemaTypeLoader getSchemaTypeLoader() { 105 return Connector15DCBRoot.SCHEMA_TYPE_LOADER; 106 } 107 } 108 | Popular Tags |