1 19 20 package org.netbeans.tests.j2eeserver.plugin.jsr88; 21 22 import javax.enterprise.deploy.spi.exceptions.*; 23 import javax.enterprise.deploy.spi.*; 24 import java.beans.*; 25 import javax.enterprise.deploy.model.*; 26 27 import java.util.*; 28 29 33 public class EjbModuleConfigBean implements DConfigBeanRoot { 34 35 DDBean bean; 36 DepConfig config; 37 Collection children = new HashSet(); 38 String SESSION = "ejb-jar/enterprise-beans/session"; 39 String ENTITY = "ejb-jar/enterprise-beans/entity"; 40 41 public EjbModuleConfigBean(DDBean bean, DepConfig config) { 42 this.bean = bean; this.config = config; 43 } 44 45 public DConfigBean getDConfigBean(DDBean dDBean) throws ConfigurationException { 46 DConfigBean ret = null; 47 if(dDBean.getXpath().endsWith(SESSION) || dDBean.getXpath().endsWith(ENTITY)) 48 ret = new EjbConfigBean(dDBean, this, config); 49 if(ret != null) children.add(ret); 50 return ret; 51 } 52 53 public DDBean getDDBean() { 54 return bean; 55 } 56 57 public String [] getXpaths() { 58 return new String [] { SESSION, ENTITY }; 59 } 60 61 public void notifyDDChange(XpathEvent xpathEvent) { 62 } 63 64 public void removeDConfigBean(DConfigBean dConfigBean) throws BeanNotFoundException { 65 children.remove(dConfigBean); 66 propertyChangeSupport.firePropertyChange(dConfigBean.getClass().toString(),dConfigBean,null); 67 } 68 69 70 private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); 71 72 73 private String secure; 74 75 76 private String securityDomain; 77 78 79 private ResourceManager[] resourceManager; 80 81 public void addPropertyChangeListener(PropertyChangeListener listener) { 82 propertyChangeSupport.addPropertyChangeListener(listener); 83 } 84 85 public void removePropertyChangeListener(PropertyChangeListener listener) { 86 propertyChangeSupport.removePropertyChangeListener(listener); 87 } 88 89 92 public String getSecure() { 93 return this.secure; 94 } 95 96 99 public void setSecure(String secure) { 100 String oldSecure = this.secure; 101 this.secure = secure; 102 propertyChangeSupport.firePropertyChange("secure", oldSecure, secure); 103 } 104 105 108 public String getSecurityDomain() { 109 return this.securityDomain; 110 } 111 112 115 public void setSecurityDomain(String securityDomain) { 116 String oldSecurityDomain = this.securityDomain; 117 this.securityDomain = securityDomain; 118 propertyChangeSupport.firePropertyChange("securityDomain", oldSecurityDomain, securityDomain); 119 } 120 121 125 public ResourceManager getResourceManager(int index) { 126 return this.resourceManager[index]; 127 } 128 129 132 public ResourceManager[] getResourceManager() { 133 return this.resourceManager; 134 } 135 136 140 public void setResourceManager(int index, ResourceManager resourceManager) { 141 this.resourceManager[index] = resourceManager; 142 propertyChangeSupport.firePropertyChange("resourceManager", null, null ); 143 } 144 145 149 public void setResourceManager(ResourceManager[] resourceManager) { 150 ResourceManager[] oldResourceManager = this.resourceManager; 151 this.resourceManager = resourceManager; 152 propertyChangeSupport.firePropertyChange("resourceManager", oldResourceManager, resourceManager); 153 } 154 155 void addResource(String resource) { 157 for(int i = 0; i < resourceManager.length; i++) 158 if(resourceManager[i].getResourceName().equals(resource)) return; 159 ResourceManager[] newManagers = new ResourceManager[resourceManager.length + 1]; 160 for(int i = 0; i < resourceManager.length; i++) 161 newManagers[i] = resourceManager[i]; 162 ResourceManager manager = new ResourceManager(resource); 163 newManagers[resourceManager.length] = manager; 164 setResourceManager(newManagers); 165 } 166 167 public DConfigBean getDConfigBean(DDBeanRoot dDBeanRoot) { 168 return null; 169 } 170 171 } 172 | Popular Tags |