1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans; 25 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.WS70ExternalJndiResource; 26 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.WS70Resources; 27 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.PropertyElement; 28 29 import java.util.Vector ; 30 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair; 31 32 36 public class WS70ExternalResourceBean extends WS70BaseResourceBean implements java.io.Serializable { 37 38 private String externalJndiName; 39 private String resType; 40 private String factoryClass; 41 42 45 public WS70ExternalResourceBean() { 46 } 47 public String getExternalJndiName() { 48 return externalJndiName; 49 } 50 public void setExternalJndiName(String value) { 51 String oldValue = externalJndiName; 52 this.externalJndiName = value; 53 initPropertyChangeSupport(); 54 propertySupport.firePropertyChange ("externalJndiName", oldValue, externalJndiName); } 56 public String getResType() { 57 return resType; 58 } 59 public void setResType(String value) { 60 String oldValue = resType; 61 this.resType = value; 62 initPropertyChangeSupport(); 63 propertySupport.firePropertyChange ("resType", oldValue, resType); } 65 public String getFactoryClass() { 66 return factoryClass; 67 } 68 public void setFactoryClass(String value) { 69 String oldValue = factoryClass; 70 this.factoryClass = value; 71 initPropertyChangeSupport(); 72 propertySupport.firePropertyChange ("factoryClass", oldValue, factoryClass); } 74 75 public static WS70ExternalResourceBean createBean(WS70ExternalJndiResource externaljndiresource) { 76 WS70ExternalResourceBean bean = new WS70ExternalResourceBean(); 77 bean.setName(externaljndiresource.getJndiName()); 80 bean.setDescription(externaljndiresource.getDescription()); 81 bean.setJndiName(externaljndiresource.getJndiName()); 82 bean.setExternalJndiName(externaljndiresource.getExternalJndiName()); 83 bean.setFactoryClass(externaljndiresource.getFactoryClass()); 84 bean.setResType(externaljndiresource.getResType()); 85 bean.setIsEnabled(externaljndiresource.getEnabled()); 86 87 PropertyElement[] extraProperties = externaljndiresource.getPropertyElement(); 88 Vector vec = new Vector (); 89 for (int i = 0; i < extraProperties.length; i++) { 90 NameValuePair pair = new NameValuePair(); 91 pair.setParamName(extraProperties[i].getName()); 92 pair.setParamValue(extraProperties[i].getValue()); 93 vec.add(pair); 94 } 95 96 if (vec != null && vec.size() > 0) { 97 NameValuePair[] props = new NameValuePair[vec.size()]; 98 bean.setExtraParams((NameValuePair[])vec.toArray(props)); 99 } 100 101 return bean; 102 } 103 104 public WS70Resources getGraph(){ 105 WS70Resources res = getResourceGraph(); 106 WS70ExternalJndiResource extresource = res.newWS70ExternalJndiResource(); 107 extresource.setDescription(getDescription()); 108 extresource.setJndiName(getJndiName()); 109 extresource.setExternalJndiName(getExternalJndiName()); 110 extresource.setResType(getResType()); 111 extresource.setFactoryClass(getFactoryClass()); 112 extresource.setEnabled(getIsEnabled()); 113 114 NameValuePair[] params = getExtraParams(); 116 if (params != null && params.length > 0) { 117 for (int i = 0; i < params.length; i++) { 118 NameValuePair pair = params[i]; 119 PropertyElement prop = extresource.newPropertyElement(); 120 prop = populatePropertyElement(prop, pair); 121 extresource.addPropertyElement(prop); 122 } 123 } 124 125 res.addWS70ExternalJndiResource(extresource); 126 return res; 127 } 128 } 129 | Popular Tags |