1 19 20 package org.netbeans.modules.websvc.wsdl.config; 21 22 import org.netbeans.modules.websvc.wsdl.config.api.Configuration; 23 24 28 public class ConfigurationProxy implements Configuration { 29 private Configuration configuration; 30 private String version; 31 private java.util.List listeners; 32 public boolean writing=false; 33 private OutputProvider outputProvider; 34 private org.xml.sax.SAXParseException error; 35 private int ddStatus; 36 37 public ConfigurationProxy(Configuration configuration) { 38 init(configuration, "1.1"); 39 } 40 41 private void init(Configuration configuration, String version) { 42 this.configuration=configuration; 43 this.version = version; 44 listeners = new java.util.ArrayList (); 45 } 46 47 public void setOriginal(Configuration configuration) { 48 if (this.configuration!=configuration) { 49 for (int i=0;i<listeners.size();i++) { 50 java.beans.PropertyChangeListener pcl = 51 (java.beans.PropertyChangeListener )listeners.get(i); 52 if (this.configuration!=null) { 53 this.configuration.removePropertyChangeListener(pcl); 54 } 55 if (configuration!=null) { 56 configuration.addPropertyChangeListener(pcl); 57 } 58 59 } 60 this.configuration=configuration; 61 } 66 } 67 68 public Configuration getOriginal() { 69 return configuration; 70 } 71 72 public void setProxyVersion(java.lang.String value) { 73 if ((version==null && value!=null) || !version.equals(value)) { 74 java.beans.PropertyChangeEvent evt = 75 new java.beans.PropertyChangeEvent (this, PROPERTY_VERSION, version, value); 76 version=value; 77 for (int i=0;i<listeners.size();i++) { 78 ((java.beans.PropertyChangeListener )listeners.get(i)).propertyChange(evt); 79 } 80 } 81 } 82 86 public java.lang.String getVersion() { 87 return version; 88 } 89 public org.xml.sax.SAXParseException getError() { 90 return error; 91 } 92 public void setError(org.xml.sax.SAXParseException error) { 93 this.error=error; 94 } 95 public int getStatus() { 96 return ddStatus; 97 } 98 public void setStatus(int value) { 99 if (ddStatus!=value) { 100 java.beans.PropertyChangeEvent evt = 101 new java.beans.PropertyChangeEvent (this, PROPERTY_STATUS, new Integer (ddStatus), new Integer (value)); 102 ddStatus=value; 103 for (int i=0;i<listeners.size();i++) { 104 ((java.beans.PropertyChangeListener )listeners.get(i)).propertyChange(evt); 105 } 106 } 107 } 108 109 public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl) { 110 if (configuration!=null) configuration.addPropertyChangeListener(pcl); 111 listeners.add(pcl); 112 } 113 114 public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl) { 115 if (configuration!=null) configuration.removePropertyChangeListener(pcl); 116 listeners.remove(pcl); 117 } 118 119 135 public org.netbeans.modules.websvc.wsdl.config.api.J2eeMappingFile getJ2eeMappingFile() { 136 return configuration == null ? null : configuration.getJ2eeMappingFile(); 137 } 138 139 public org.netbeans.modules.websvc.wsdl.config.api.Modelfile getModelfile() { 140 return configuration == null ? null : configuration.getModelfile(); 141 } 142 143 public org.netbeans.modules.websvc.wsdl.config.api.Service getService() { 144 return configuration == null ? null : configuration.getService(); 145 } 146 147 public org.netbeans.modules.websvc.wsdl.config.api.Wsdl getWsdl() { 148 return configuration == null ? null : configuration.getWsdl(); 149 } 150 151 public org.netbeans.modules.websvc.wsdl.config.api.J2eeMappingFile newJ2eeMappingFile() { 152 return configuration == null ? null : configuration.newJ2eeMappingFile(); 153 } 154 155 public org.netbeans.modules.websvc.wsdl.config.api.Modelfile newModelfile() { 156 return configuration == null ? null : configuration.newModelfile(); 157 } 158 159 public org.netbeans.modules.websvc.wsdl.config.api.Service newService() { 160 return configuration == null ? null : configuration.newService(); 161 } 162 163 public org.netbeans.modules.websvc.wsdl.config.api.Wsdl newWsdl() { 164 return configuration == null ? null : configuration.newWsdl(); 165 } 166 167 public void setJ2eeMappingFile(org.netbeans.modules.websvc.wsdl.config.api.J2eeMappingFile value) { 168 if(configuration != null) { 169 configuration.setJ2eeMappingFile(value); 170 } 171 } 172 173 public void setModelfile(org.netbeans.modules.websvc.wsdl.config.api.Modelfile value) { 174 if(configuration != null) { 175 configuration.setModelfile(value); 176 } 177 } 178 179 public void setService(org.netbeans.modules.websvc.wsdl.config.api.Service value) { 180 if(configuration != null) { 181 configuration.setService(value); 182 } 183 } 184 185 public void setWsdl(org.netbeans.modules.websvc.wsdl.config.api.Wsdl value) { 186 if(configuration != null) { 187 configuration.setWsdl(value); 188 } 189 } 190 191 public Object getValue(String name) { 192 return configuration==null?null:configuration.getValue(name); 193 } 194 195 public void merge(org.netbeans.modules.websvc.wsdl.config.api.RootInterface bean, int mode) { 196 if (configuration!=null) { 197 if (bean instanceof ConfigurationProxy) { 198 configuration.merge(((ConfigurationProxy)bean).getOriginal(), mode); 199 } else { 200 configuration.merge(bean, mode); 201 } 202 } 203 } 204 205 public void write(java.io.OutputStream os) throws java.io.IOException { 206 if (configuration!=null) { 207 writing=true; 208 configuration.write(os); 209 } 210 } 211 212 public void write(org.openide.filesystems.FileObject fo) throws java.io.IOException { 213 if (configuration!=null) { 214 try { 215 org.openide.filesystems.FileLock lock = fo.lock(); 216 try { 217 java.io.OutputStream os = fo.getOutputStream(lock); 218 try { 219 writing=true; 220 write(os); 221 } finally { 222 os.close(); 223 } 224 } 225 finally { 226 lock.releaseLock(); 227 } 228 } catch (org.openide.filesystems.FileAlreadyLockedException ex) { 229 org.openide.loaders.DataObject dobj = org.openide.loaders.DataObject.find(fo); 231 if (dobj!=null && dobj instanceof ConfigurationProxy.OutputProvider) 232 ((ConfigurationProxy.OutputProvider)dobj).write(this); 233 else throw ex; 234 } 235 } 236 } 237 238 public Object clone() { 239 ConfigurationProxy proxy = null; 240 if (configuration==null) { 241 proxy = new ConfigurationProxy(null); 242 } else { 243 Configuration clonedConfiguration=(Configuration)configuration.clone(); 244 proxy = new ConfigurationProxy(clonedConfiguration); 245 ((org.netbeans.modules.websvc.wsdl.config.impl.Configuration)clonedConfiguration)._setSchemaLocation 246 ("http://java.sun.com/xml/ns/jax-rpc/ri/config"); 247 } 248 proxy.setError(error); 249 proxy.setStatus(ddStatus); 250 return proxy; 251 } 252 253 public boolean isWriting() { 254 return writing; 255 } 256 257 public void setWriting(boolean writing) { 258 this.writing=writing; 259 } 260 261 public void setOutputProvider(OutputProvider iop) { 262 this.outputProvider=iop; 263 } 264 265 268 public static interface OutputProvider { 269 public void write(Configuration configuration) throws java.io.IOException ; 270 public org.openide.filesystems.FileObject getTarget(); 271 } 272 } 273 | Popular Tags |