this.append = append;
}
public void generateWSXMLDescriptor(File wsXmlFile) throws IOException
{
WebservicesMetaData webservices = constructWSMetaData();
// handle append flag
if (append && wsXmlFile.exists())
{
WebservicesMetaData existingWebservices;
// parse existing webservices descriptor
InputStream wsXmlStream = new FileInputStream(wsXmlFile);
try
{
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
ObjectModelFactory factory = new WebservicesFactory(wsXmlFile.toURL());
existingWebservices = (WebservicesMetaData)unmarshaller.unmarshal(wsXmlStream, factory, null);
}
catch (JBossXBException e)
{
throw new WSException("Could not unmarshal existing webservices descriptor: " + wsXmlFile, e);
}
finally
{
wsXmlStream.close();
}
// append generated webservice-descriptions to existing descriptor
for (WebserviceDescriptionMetaData webserviceDescription : webservices.getWebserviceDescriptions())
existingWebservices.addWebserviceDescription(webserviceDescription);
webservices = existingWebservices;
}
// (re-)write generated webservices descriptor to file