1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans; 25 import java.beans.Beans ; 26 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.WS70JdbcResource; 27 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.WS70Resources; 28 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.PropertyElement; 29 30 import java.util.Vector ; 31 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair; 32 33 37 public class WS70JdbcResourceBean extends WS70BaseResourceBean implements java.io.Serializable { 38 private String dsClass; 39 private String minConnections; 40 private String maxConnections; 41 private String waitTimeout; 42 private String idleTimeout; 43 private String isolationLevel; 44 private String isolationLevelGuaranteed; 45 private String connectionValidation; 46 private String connectionValidationTablename; 47 private String failAllConnections; 48 49 public WS70JdbcResourceBean() { 50 } 51 public String getDsClass() { 52 return dsClass; 53 } 54 public void setDsClass(String value) { 55 String oldValue = dsClass; 56 this.dsClass = value; 57 initPropertyChangeSupport(); 58 propertySupport.firePropertyChange ("dsClass", oldValue, dsClass); } 60 public String getMinConnections() { 61 return minConnections; 62 } 63 public void setMinConnections(String value) { 64 String oldValue = minConnections; 65 this.minConnections = value; 66 initPropertyChangeSupport(); 67 propertySupport.firePropertyChange ("minConnections", oldValue, minConnections); } 69 public String getMaxConnections() { 70 return maxConnections; 71 } 72 public void setMaxConnections(String value) { 73 String oldValue = maxConnections; 74 this.maxConnections = value; 75 initPropertyChangeSupport(); 76 propertySupport.firePropertyChange ("maxConnections", oldValue, maxConnections); } 78 public String getIdleTimeout() { 79 return idleTimeout; 80 } 81 public void setIdleTimeout(String value) { 82 String oldValue = idleTimeout; 83 this.idleTimeout = value; 84 initPropertyChangeSupport(); 85 propertySupport.firePropertyChange ("idleTimeout", oldValue, idleTimeout); } 87 public String getWaitTimeout() { 88 return waitTimeout; 89 } 90 public void setWaitTimeout(String value) { 91 String oldValue = waitTimeout; 92 this.waitTimeout = value; 93 initPropertyChangeSupport(); 94 propertySupport.firePropertyChange ("waitTimeout", oldValue, waitTimeout); } 96 public String getIsolationLevel() { 97 return isolationLevel; 98 } 99 public void setIsolationLevel(String value) { 100 String oldValue = isolationLevel; 101 this.isolationLevel = value; 102 initPropertyChangeSupport(); 103 propertySupport.firePropertyChange ("isolationLevel", oldValue, isolationLevel); } 105 public String getIsolationLevelGuaranteed() { 106 return isolationLevelGuaranteed; 107 } 108 public void setIsolationLevelGuaranteed(String value) { 109 String oldValue = isolationLevelGuaranteed; 110 this.isolationLevelGuaranteed = value; 111 initPropertyChangeSupport(); 112 propertySupport.firePropertyChange ("isolationLevelGuaranteed", oldValue, isolationLevelGuaranteed); } 114 public String getConnectionValidation() { 115 return connectionValidation; 116 } 117 public void setConnectionValidation(String value) { 118 String oldValue = connectionValidation; 119 this.connectionValidation = value; 120 initPropertyChangeSupport(); 121 propertySupport.firePropertyChange ("connectionValidation", oldValue, connectionValidation); } 123 public String getConnectionValidationTablename() { 124 return connectionValidationTablename; 125 } 126 public void setConnectionValidationTablename(String value) { 127 String oldValue = connectionValidationTablename; 128 this.connectionValidationTablename = value; 129 initPropertyChangeSupport(); 130 propertySupport.firePropertyChange ("connectionValidationTablename", oldValue, connectionValidationTablename); } 132 public String getFailAllConnections() { 133 return failAllConnections; 134 } 135 public void setFailAllConnections(String value) { 136 String oldValue = failAllConnections; 137 this.failAllConnections = value; 138 initPropertyChangeSupport(); 139 propertySupport.firePropertyChange ("failAllConnections", oldValue, failAllConnections); } 141 public static WS70JdbcResourceBean createBean(WS70JdbcResource jdbcresource) { 142 WS70JdbcResourceBean bean = new WS70JdbcResourceBean(); 143 bean.setDsClass(jdbcresource.getDatasourceClass()); 146 bean.setName(jdbcresource.getJndiName()); 147 bean.setDescription(jdbcresource.getDescription()); 148 bean.setJndiName(jdbcresource.getJndiName()); 149 bean.setIsEnabled(jdbcresource.getEnabled()); 150 bean.setMinConnections(jdbcresource.getMinConnections()); 151 bean.setMaxConnections(jdbcresource.getMaxConnections()); 152 bean.setWaitTimeout(jdbcresource.getWaitTimeout()); 153 bean.setIdleTimeout(jdbcresource.getIdleTimeout()); 154 bean.setIsolationLevel(jdbcresource.getIsolationLevel()); 155 bean.setIsolationLevelGuaranteed(jdbcresource.getIsolationLevelGuaranteed()); 156 bean.setConnectionValidation(jdbcresource.getConnectionValidation()); 157 bean.setConnectionValidationTablename(jdbcresource.getConnectionValidationTableName()); 158 bean.setFailAllConnections(jdbcresource.getFailAllConnections()); 159 PropertyElement[] extraProperties = jdbcresource.getPropertyElement(); 160 Vector vec = new Vector (); 161 for (int i = 0; i < extraProperties.length; i++) { 162 NameValuePair pair = new NameValuePair(); 163 pair.setParamName(extraProperties[i].getName()); 164 pair.setParamValue(extraProperties[i].getValue()); 165 vec.add(pair); 166 } 167 168 if (vec != null && vec.size() > 0) { 169 NameValuePair[] props = new NameValuePair[vec.size()]; 170 bean.setExtraParams((NameValuePair[])vec.toArray(props)); 171 } 172 173 return bean; 174 } 175 public WS70Resources getGraph(){ 176 WS70Resources res = getResourceGraph(); 177 WS70JdbcResource jdbcresource = res.newWS70JdbcResource(); 178 jdbcresource.setDatasourceClass(getDsClass()); 179 jdbcresource.setDescription(getDescription()); 180 jdbcresource.setJndiName(getJndiName()); 181 jdbcresource.setMinConnections(getMinConnections()); 182 jdbcresource.setMaxConnections(getMaxConnections()); 183 jdbcresource.setIdleTimeout(getIdleTimeout()); 184 jdbcresource.setIsolationLevel(getIsolationLevel()); 185 jdbcresource.setIsolationLevelGuaranteed(getIsolationLevelGuaranteed()); 186 jdbcresource.setIdleTimeout(getIdleTimeout()); 187 jdbcresource.setWaitTimeout(getWaitTimeout()); 188 jdbcresource.setConnectionValidation(getConnectionValidation()); 189 jdbcresource.setConnectionValidationTableName(getConnectionValidationTablename()); 190 jdbcresource.setFailAllConnections(getFailAllConnections()); 191 jdbcresource.setEnabled(getIsEnabled()); 192 193 res.addWS70JdbcResource(jdbcresource); 194 return res; 195 } 196 197 } 198 | Popular Tags |