Author: rsearls
Date: 2013-12-09 13:43:51 -0500 (Mon, 09 Dec 2013)
New Revision: 18156
Modified:
stack/cxf/branches/jbossws-cxf-4.2.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
Log:
bz-1032593: added method to remove app's wsdl directory
Modified:
stack/cxf/branches/jbossws-cxf-4.2.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-4.2.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java 2013-12-09
11:35:52 UTC (rev 18155)
+++
stack/cxf/branches/jbossws-cxf-4.2.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java 2013-12-09
18:43:51 UTC (rev 18156)
@@ -208,4 +208,20 @@
@LogMessage(level = WARN)
@Message(id = 24095, value = "Unknown strategy '%s' requested for
selecting the Apache CXF Bus to be used for building JAXWS clients; default strategy will
be used.")
void unknownJAXWSClientBusStrategy(String strategy);
+
+ @LogMessage(level = WARN)
+ @Message(id = 24097, value = "Could not delete wsdl file %s")
+ void couldNotDeleteWsdlFile(String filename);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 24098, value = "Deleted wsdl file %s")
+ void deletedWsdlFile(String filename);
+
+ @LogMessage(level = WARN)
+ @Message(id = 24099, value = "Could not create wsdl data path.")
+ void couldNotCreateWsdlDataPath();
+
+ @LogMessage(level = WARN)
+ @Message(id = 24100, value = "Could not delete wsdl directory %s")
+ void couldNotDeleteWsdlDirectory(String filename);
}
Modified:
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java 2013-12-09
11:35:52 UTC (rev 18155)
+++
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java 2013-12-09
18:43:51 UTC (rev 18156)
@@ -90,6 +90,8 @@
// Publish XMLSchema imports
publishSchemaImports(wsdlPublishURL, doc.getDocumentElement(), published,
expLocation);
+
+ dep.addAttachment(WSDLFilePublisher.class, this);
}
else
{
@@ -105,7 +107,48 @@
throw Messages.MESSAGES.cannotPublishWSDLTo(serviceName, wsdlFile, e);
}
}
-
+
+ public void unpublishWsdlFiles()
+ {
+ String deploymentName = dep.getCanonicalName();
+
+ if (deploymentName.startsWith("http://"))
+ {
+ deploymentName = deploymentName.replace("http://",
"http-");
+ }
+
+ try {
+
+ File publishDir = new File(serverConfig.getServerDataDir().getCanonicalPath()
+ + "/wsdl/" + deploymentName);
+ if (publishDir.exists())
+ {
+ File[] wsdlFileList = publishDir.listFiles();
+ if (wsdlFileList != null)
+ {
+ for (int i = 0; i < wsdlFileList.length; i++)
+ {
+ File f = wsdlFileList[i];
+ if (f.delete())
+ {
+
Loggers.DEPLOYMENT_LOGGER.deletedWsdlFile(f.getAbsolutePath());
+ } else {
+
Loggers.DEPLOYMENT_LOGGER.couldNotDeleteWsdlFile(f.getAbsolutePath());
+ }
+ }
+ }
+ }
+
+ if (!publishDir.delete())
+ {
+
Loggers.DEPLOYMENT_LOGGER.couldNotDeleteWsdlDirectory(publishDir.getAbsolutePath());
+ }
+
+ } catch (IOException e) {
+ Loggers.DEPLOYMENT_LOGGER.couldNotCreateWsdlDataPath();
+ }
+ }
+
private static Document getWsdlDocument(Bus bus, Definition def) throws WSDLException
{
WSDLWriter wsdlWriter =
bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
Modified:
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2013-12-09
11:35:52 UTC (rev 18155)
+++
stack/cxf/branches/jbossws-cxf-4.2.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2013-12-09
18:43:51 UTC (rev 18156)
@@ -74,6 +74,12 @@
if (holder != null)
{
holder.close();
+
+ WSDLFilePublisher wsdlFilePublisher =
dep.getAttachment(WSDLFilePublisher.class);
+ if (wsdlFilePublisher != null)
+ {
+ wsdlFilePublisher.unpublishWsdlFiles();
+ }
}
}
Show replies by date