use of com.sun.enterprise.deploy.shared.FileArchive in project Payara by payara.
the class WebServicesDeployer method populateWsdlFilesForPublish.
/**
* Populate the wsdl files entries to download (if any) (Only for webservices which
* use file publishing).
*
* TODO File publishing currently works only for wsdls packaged in the application for jax-ws.
* Need to publish the dynamically generated wsdls as well. Lazy creation of WSEndpoint objects prohibits it now.
*/
private Set<String> populateWsdlFilesForPublish(DeploymentContext dc, Set<WebService> webservices) throws IOException {
Set<String> publishedFiles = new HashSet<String>();
for (WebService webService : webservices) {
if (!webService.hasFilePublishing()) {
continue;
}
copyExtraFilesToGeneratedFolder(dc);
BundleDescriptor bundle = webService.getBundleDescriptor();
ArchiveType moduleType = bundle.getModuleType();
// only EAR, WAR and EJB archives could contain wsdl files for publish
if (moduleType == null || !(moduleType.equals(DOLUtils.earType()) || moduleType.equals(DOLUtils.warType()) || moduleType.equals(DOLUtils.ejbType()))) {
return publishedFiles;
}
File sourceDir = dc.getScratchDir("xml");
File parent;
try {
URI clientPublishURI = webService.getClientPublishUrl().toURI();
if (!clientPublishURI.isOpaque()) {
parent = new File(clientPublishURI);
} else {
parent = new File(webService.getClientPublishUrl().getPath());
}
} catch (URISyntaxException e) {
logger.log(Level.WARNING, LogUtils.EXCEPTION_THROWN, e);
parent = new File(webService.getClientPublishUrl().getPath());
}
// Collect the names of all entries in or below the
// dedicated wsdl directory.
FileArchive archive = new FileArchive();
archive.open(sourceDir.toURI());
Enumeration entries = archive.entries(bundle.getWsdlDir());
while (entries.hasMoreElements()) {
String name = (String) entries.nextElement();
String wsdlName = stripWsdlDir(name, bundle);
File clientwsdl = new File(parent, wsdlName);
File fulluriFile = new File(sourceDir, name);
if (!fulluriFile.isDirectory()) {
publishFile(fulluriFile, clientwsdl);
publishedFiles.add(clientwsdl.getAbsolutePath());
}
}
}
return publishedFiles;
}
Aggregations