package org.jboss.net.axis;
import org.jboss.axis.AxisEngine;
import org.jboss.axis.ConfigurationException;
import org.jboss.axis.configuration.FileProvider;
import org.jboss.axis.deployment.wsdd.WSDDGlobalConfiguration;
import org.jboss.axis.utils.XMLUtils;
import java.io.InputStream;
import java.net.URL;
public class XMLResourceProvider extends FileProvider
{
final protected URL resource;
protected InputStream is;
protected ClassLoader contextLoader;
public XMLResourceProvider(URL resource, ClassLoader loader)
{
super((InputStream)null);
this.contextLoader = loader;
this.resource = resource;
}
public void setInputStream(InputStream stream)
{
super.setInputStream(stream);
is = stream;
}
public void configureEngine(AxisEngine engine) throws ConfigurationException
{
buildDeployment().configureEngine(engine);
engine.refreshGlobalOptions();
}
public synchronized Deployment buildDeployment()
throws ConfigurationException
{
if (getDeployment() == null)
{
try
{
if (is == null)
{
setInputStream(resource.openStream());
}
setDeployment(Deployment.makeSafeDeployment(XMLUtils.newDocument(is).getDocumentElement(),
contextLoader));
setInputStream(null);
if (getDeployment().getGlobalConfiguration() == null)
{
WSDDGlobalConfiguration config = new WSDDGlobalConfiguration();
config.setOptionsHashtable(new java.util.Hashtable());
getDeployment().setGlobalConfiguration(config);
}
}
catch (Exception e)
{
throw new ConfigurationException(e);
}
}
return getMyDeployment();
}
public Deployment getMyDeployment()
{
return (Deployment)getDeployment();
}
public void writeEngineConfig(AxisEngine engine)
{
}
}