1 7 8 10 package org.jboss.net.axis; 11 12 import org.jboss.axis.AxisEngine; 13 import org.jboss.axis.ConfigurationException; 14 import org.jboss.axis.configuration.FileProvider; 15 import org.jboss.axis.deployment.wsdd.WSDDGlobalConfiguration; 16 import org.jboss.axis.utils.XMLUtils; 17 18 import java.io.InputStream ; 19 import java.net.URL ; 20 21 30 31 public class XMLResourceProvider extends FileProvider 32 { 33 34 38 39 final protected URL resource; 40 41 42 protected InputStream is; 43 44 45 protected ClassLoader contextLoader; 46 47 51 55 public XMLResourceProvider(URL resource, ClassLoader loader) 56 { 57 super((InputStream )null); 58 this.contextLoader = loader; 59 this.resource = resource; 60 } 61 62 66 67 public void setInputStream(InputStream stream) 68 { 69 super.setInputStream(stream); 70 is = stream; 71 } 72 73 74 public void configureEngine(AxisEngine engine) throws ConfigurationException 75 { 76 buildDeployment().configureEngine(engine); 77 engine.refreshGlobalOptions(); 78 } 79 80 81 public synchronized Deployment buildDeployment() 82 throws ConfigurationException 83 { 84 if (getDeployment() == null) 85 { 86 try 87 { 88 if (is == null) 89 { 90 setInputStream(resource.openStream()); 91 } 92 93 setDeployment(Deployment.makeSafeDeployment(XMLUtils.newDocument(is).getDocumentElement(), 94 contextLoader)); 95 96 setInputStream(null); 97 98 if (getDeployment().getGlobalConfiguration() == null) 99 { 100 WSDDGlobalConfiguration config = new WSDDGlobalConfiguration(); 101 config.setOptionsHashtable(new java.util.Hashtable ()); 102 getDeployment().setGlobalConfiguration(config); 103 } 104 105 } 106 catch (Exception e) 107 { 108 throw new ConfigurationException(e); 109 } 110 } 111 return getMyDeployment(); 112 } 113 114 115 public Deployment getMyDeployment() 116 { 117 return (Deployment)getDeployment(); 118 } 119 120 121 public void writeEngineConfig(AxisEngine engine) 122 { 123 } 125 126 } 127 | Popular Tags |