Skip to content

Commit

Permalink
Revert "[JBWS-4080] simplified the algorithm"
Browse files Browse the repository at this point in the history
This reverts commit 3a3107d.
  • Loading branch information
asoldano committed Nov 10, 2017
1 parent 2bdb7a0 commit e2dd125
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
*/
public class WSDLFilePublisher extends AbstractWSDLFilePublisher
{
private static final Object lock= new Object();
private static final String[] wsdlLocationPrefixes = {"vfsfile:", "file:", "jar:", "vfszip:"};

public WSDLFilePublisher(ArchiveDeployment dep)
Expand Down Expand Up @@ -119,58 +118,24 @@ public void publishWsdlFiles(QName serviceName, String wsdlLocation, Bus bus, Li

public void unpublishWsdlFiles()
{
String deploymentName = dep.getCanonicalName();

if (deploymentName.startsWith("http://"))
try
{
deploymentName = deploymentName.replace("http://", "http-");
}

try {

File publishDir = new File(serverConfig.getServerDataDir().getCanonicalPath()
+ "/wsdl/" + deploymentName);

File wsdlRoot = new File(serverConfig.getServerDataDir().getCanonicalPath()
+ "/wsdl/");
String wsdlRootDirStr = wsdlRoot.getCanonicalPath();

if (publishDir.exists()) {

List<File> dirList = new ArrayList<>();
getWsdlDirList(publishDir, dirList);
dirList.add(publishDir); // clean up contents in the parent

for (File dir : dirList) {
File[] wsdlFileList = dir.listFiles();
if (wsdlFileList != null) {
for (int i = 0; i < wsdlFileList.length; i++) {
File f = wsdlFileList[i];
FileUtils.delete(f);
if (f.exists()) {
Loggers.DEPLOYMENT_LOGGER.couldNotDeleteWsdlFile(f.getAbsolutePath());
} else {
Loggers.DEPLOYMENT_LOGGER.deletedWsdlFile(f.getAbsolutePath());
}
}
}
}

synchronized(lock) {
File parent = publishDir;
while (!wsdlRootDirStr.equals(parent.getCanonicalPath())) {
if (parent.exists()) {
File[] files = parent.listFiles();
if (files == null || files.length == 0) {
FileUtils.delete(parent);
}
}
parent = parent.getParentFile();
}
}
File parentDir = new File(serverConfig.getServerDataDir().getCanonicalPath() + "/wsdl");
ArchiveDeployment deployment = dep;
while (deployment.getParent() != null)
{
deployment = deployment.getParent();
}

} catch (IOException e) {
String deploymentName = deployment.getCanonicalName();
if (deploymentName.startsWith("http://"))
{
deploymentName = deploymentName.replace("http://", "http-");
}
File targetDir = new File(parentDir, deploymentName);
FileUtils.removeDir(targetDir);
}
catch (IOException e)
{
Loggers.DEPLOYMENT_LOGGER.couldNotCreateWsdlDataPath();
}
}
Expand Down Expand Up @@ -275,21 +240,4 @@ private String getExpLocation(String wsdlLocation) {
return wsdlLocation.startsWith("vfs:") && wsdlLocation.contains("/") ? wsdlLocation.substring(0, wsdlLocation.lastIndexOf("/") + 1) : "";
}
}

/**
* Depth-first list of directories
* @param dir
* @param dirList
*/
private void getWsdlDirList(File dir, List<File> dirList) {
File[] files = dir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
getWsdlDirList(files[i], dirList);
dirList.add(files[i]);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ public void cleanup() throws Exception {
}
@Deployment(testable = false, name=EAR_DEPLOYMENT,managed=false)
public static JavaArchive createDeployment3() {

JavaArchive archive1 = ShrinkWrap.create(JavaArchive.class, "jaxws-cxf-jbws3655-ejb.jar");
archive1.addManifest().addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.HelloWSEJBImpl.class);
writeToDisk(archive1);

JavaArchive archive2 = ShrinkWrap.create(JavaArchive.class, "jaxws-cxf-jbws3655-jaxws.jar");
archive2.addManifest()
.addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.HelloRequest.class)
Expand All @@ -83,29 +82,12 @@ public static JavaArchive createDeployment3() {
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3655/META-INF/wsdl/Hello.wsdl"), "wsdl/Hello.wsdl")
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3655/META-INF/wsdl/Hello_schema1.xsd"), "wsdl/Hello_schema1.xsd");
writeToDisk(archive2);

JavaArchive archive3 = ShrinkWrap.create(JavaArchive.class, "jaxws-cxf-jbws3655-goodBy-jaxws.jar");
archive3.addManifest()
.addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.GoodByRequest.class)
.addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.GoodByResponse.class)
.addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.GoodByWs.class)
.addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.GoodByWsImpl.class)
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3655/META-INF/wsdl/GoodBy.wsdl"), "wsdl/GoodBy.wsdl")
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3655/META-INF/wsdl/GoodBy_schema1.xsd"), "wsdl/GoodBy_schema1.xsd");
writeToDisk(archive3);

JavaArchive archive4 = ShrinkWrap.create(JavaArchive.class, "jaxws-cxf-jbws3655-ejb-goodBy.jar");
archive4.addManifest().addClass(org.jboss.test.ws.jaxws.cxf.jbws3655.GoodByWSEJBImpl.class);
writeToDisk(archive4);


JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "jaxws-cxf-jbws3655.ear");
archive.addManifest()
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3655/META-INF/application.xml"))
.addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(), "jaxws-cxf-jbws3655-jaxws.jar"), "lib/jaxws-cxf-jbws3655-jaxws.jar")
.addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(), "jaxws-cxf-jbws3655-goodBy-jaxws.jar"), "lib/jaxws-cxf-jbws3655-goodBy-jaxws.jar")
.addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(), "jaxws-cxf-jbws3655-ejb.jar"))
.addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(), "jaxws-cxf-jbws3655-ejb-goodBy.jar"))
;
.addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(), "jaxws-cxf-jbws3655-ejb.jar"));
return archive;
}

Expand Down Expand Up @@ -133,5 +115,4 @@ private HelloWs getPort(String publishURL) throws Exception
Service service = Service.create(wsdlURL, qname);
return (HelloWs)service.getPort(HelloWs.class);
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="6" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<application-name>jbws3655</application-name>
<module>
<ejb>jaxws-cxf-jbws3655-ejb-goodBy.jar</ejb>
</module>
<module>
<ejb>jaxws-cxf-jbws3655-ejb.jar</ejb>
</module>

<library-directory>lib</library-directory>
</application>

This file was deleted.

This file was deleted.

0 comments on commit e2dd125

Please sign in to comment.