JBossWS SVN: r17131 - in spi/trunk/src/main/java/org/jboss/wsf/spi: deployment and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-19 02:40:24 -0500 (Wed, 19 Dec 2012)
New Revision: 17131
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/Loggers.java
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
Log:
[JBWS-3551] New failsafe methods
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/Loggers.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/Loggers.java 2012-12-19 07:39:39 UTC (rev 17130)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/Loggers.java 2012-12-19 07:40:24 UTC (rev 17131)
@@ -21,8 +21,9 @@
*/
package org.jboss.wsf.spi;
+import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.TRACE;
import static org.jboss.logging.Logger.Level.WARN;
-import static org.jboss.logging.Logger.Level.ERROR;
import java.net.URL;
import java.util.Collection;
@@ -32,7 +33,6 @@
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
-import org.jboss.logging.Logger.Level;
import org.jboss.logging.Message;
import org.jboss.logging.MessageLogger;
@@ -71,4 +71,8 @@
@Message(id = 21018, value = "Cannot get name for resource %s")
void cannotGetNameForResource(@Cause Throwable cause, URL url);
+ @LogMessage(level = TRACE)
+ @Message(id = 21019, value = "Cannot get URL for %s")
+ void cannotGetURLFor(String path);
+
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java 2012-12-19 07:39:39 UTC (rev 17130)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/ResourceResolver.java 2012-12-19 07:40:24 UTC (rev 17131)
@@ -41,4 +41,13 @@
*/
public URL resolve(String resourcePath) throws IOException;
+ /**
+ * Same as resolve(String resourcePath) except it does not throw exception
+ * when resource is not found, simply returns null.
+ *
+ * @param resourcePath
+ * @return
+ */
+ public URL resolveFailSafe(String resourcePath);
+
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java 2012-12-19 07:39:39 UTC (rev 17130)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.java 2012-12-19 07:40:24 UTC (rev 17131)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -27,16 +27,24 @@
import java.util.List;
/**
- * An adaptor to a VirtualFile from jboss-vfs.jar
- * jboss-vfs cannot be used in jboss-4.x because of its dependeny on jboss-common-core.jar
*
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 05-May-2006
*/
public interface UnifiedVirtualFile extends Serializable
{
UnifiedVirtualFile findChild(String child) throws IOException;
+ /**
+ * Same as findChild(String child) but does not throw any exception
+ * on child not found, simply returns null.
+ *
+ * @param child
+ * @return
+ */
+ UnifiedVirtualFile findChildFailSafe(String child);
+
List<UnifiedVirtualFile> getChildren() throws IOException;
String getName();
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java 2012-12-19 07:39:39 UTC (rev 17130)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java 2012-12-19 07:40:24 UTC (rev 17131)
@@ -86,20 +86,11 @@
public static JBossWebservicesMetaData loadFromVFSRoot(final UnifiedVirtualFile root) {
JBossWebservicesMetaData webservices = null;
- UnifiedVirtualFile wsdd = null;
- try {
- wsdd = root.findChild("META-INF/jboss-webservices.xml");
- } catch (IOException e) {
- //
- }
+ UnifiedVirtualFile wsdd = root.findChildFailSafe("META-INF/jboss-webservices.xml");
// Maybe a web application deployment?
if (null == wsdd) {
- try {
- wsdd = root.findChild("WEB-INF/jboss-webservices.xml");
- } catch (IOException e) {
- //
- }
+ wsdd = root.findChildFailSafe("WEB-INF/jboss-webservices.xml");
}
// the descriptor is optional
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2012-12-19 07:39:39 UTC (rev 17130)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2012-12-19 07:40:24 UTC (rev 17131)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -96,27 +96,12 @@
{
WebservicesMetaData webservices = null;
- UnifiedVirtualFile wsdd = null;
- try
- {
- wsdd = root.findChild("META-INF/webservices.xml");
- }
- catch (IOException e)
- {
- //
- }
+ UnifiedVirtualFile wsdd = root.findChildFailSafe("META-INF/webservices.xml");
// Maybe a web application deployment?
if (null == wsdd)
{
- try
- {
- wsdd = root.findChild("WEB-INF/webservices.xml");
- }
- catch (IOException e)
- {
- //
- }
+ wsdd = root.findChildFailSafe("WEB-INF/webservices.xml");
}
// the descriptor is optional
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2012-12-19 07:39:39 UTC (rev 17130)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2012-12-19 07:40:24 UTC (rev 17131)
@@ -69,7 +69,7 @@
this.loader = loader;
}
- public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+ private UnifiedVirtualFile findChild(String resourcePath, boolean throwExceptionIfNotFound) throws IOException
{
URL resourceURL = null;
if (resourcePath != null)
@@ -114,11 +114,38 @@
}
if (resourceURL == null)
- throw Messages.MESSAGES.cannotGetURLFor(resourcePath);
+ {
+ if (throwExceptionIfNotFound)
+ {
+ throw Messages.MESSAGES.cannotGetURLFor(resourcePath);
+ }
+ else
+ {
+ if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.cannotGetURLFor(resourcePath);
+ return null;
+ }
+ }
return new URLLoaderAdapter(rootURL, loader, resourceURL);
}
+ public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+ {
+ return findChild(resourcePath, true);
+ }
+
+ public UnifiedVirtualFile findChildFailSafe(String resourcePath)
+ {
+ try
+ {
+ return findChild(resourcePath, false);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
public URL toURL()
{
if (resourceURL != null)
12 years
JBossWS SVN: r17130 - stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-12-19 02:39:39 -0500 (Wed, 19 Dec 2012)
New Revision: 17130
Modified:
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
Log:
fixing synchronization issues
Modified: stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java 2012-12-18 17:20:00 UTC (rev 17129)
+++ stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java 2012-12-19 07:39:39 UTC (rev 17130)
@@ -62,23 +62,23 @@
this.host = host;
this.port = port;
}
-
- public Bus getBus()
+
+ public synchronized Bus getBus()
{
return bus;
}
- public String getProtocol()
+ public synchronized String getProtocol()
{
return protocol;
}
- public int getPort()
+ public synchronized int getPort()
{
return port;
}
- public String getHost()
+ public synchronized String getHost()
{
return host;
}
@@ -112,7 +112,7 @@
/**
* This method is called by the ServerEngine Factory to destroy the server
*/
- protected void stop() throws Exception
+ protected synchronized void stop() throws Exception
{
if (server != null)
{
@@ -124,7 +124,7 @@
* This method will shut down the server engine and
* remove it from the factory's cache.
*/
- public void shutdown()
+ public synchronized void shutdown()
{
if (factory != null && handlerCount == 0)
{
Modified: stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2012-12-18 17:20:00 UTC (rev 17129)
+++ stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2012-12-19 07:39:39 UTC (rev 17130)
@@ -44,7 +44,7 @@
*/
public class HttpServerEngineFactory implements BusLifeCycleListener
{
- private static final Logger LOG = LogUtils.getL7dLogger(HttpServerEngineFactory.class);
+ private static final Logger LOG = LogUtils.getL7dLogger(HttpServerEngineFactory.class);
private static Map<Integer, HttpServerEngine> portMap = new HashMap<Integer, HttpServerEngine>();
private BusLifeCycleManager lifeCycleManager;
@@ -148,9 +148,12 @@
public void postShutdown()
{
// shut down the httpserver in the portMap
- // To avoid the CurrentModificationException,
- // do not use portMap.vaules directly
- HttpServerEngine[] engines = portMap.values().toArray(new HttpServerEngine[0]);
+ // To avoid the CurrentModificationException,
+ // do not use portMap.vaules directly
+ HttpServerEngine[] engines = null;
+ synchronized (portMap) {
+ engines = portMap.values().toArray(new HttpServerEngine[0]);
+ }
for (HttpServerEngine engine : engines)
{
if (engine.getBus() == getBus())
12 years
JBossWS SVN: r17129 - common/trunk/src/main/java/org/jboss/ws/common/utils.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-18 12:20:00 -0500 (Tue, 18 Dec 2012)
New Revision: 17129
Modified:
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3580] Adding NPE guard
Modified: common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 17:03:18 UTC (rev 17128)
+++ common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 17:20:00 UTC (rev 17129)
@@ -263,10 +263,12 @@
private static Element getFirstChildElement(Node node) {
Node fc = node.getFirstChild();
Element e = null;
- if (fc.getNodeType() == Node.ELEMENT_NODE) {
- e = (Element)fc;
- } else{
- e = getNextSiblingElement(fc);
+ if (fc != null) {
+ if (fc.getNodeType() == Node.ELEMENT_NODE) {
+ e = (Element)fc;
+ } else{
+ e = getNextSiblingElement(fc);
+ }
}
return e;
}
12 years
JBossWS SVN: r17128 - common/trunk/src/main/java/org/jboss/ws/common/utils.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-18 12:03:18 -0500 (Tue, 18 Dec 2012)
New Revision: 17128
Modified:
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3580] Fixing bug
Modified: common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 15:43:01 UTC (rev 17127)
+++ common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 17:03:18 UTC (rev 17128)
@@ -201,20 +201,12 @@
final String ln = childElement.getLocalName();
if ("import".equals(ln) || "include".equals(ln)) {
String schemaLocation = childElement.getAttribute("schemaLocation");
- if (schemaLocation.length() > 0)
+ if (schemaLocation.length() > 0 && schemaLocation.startsWith("http://") == false)
{
- if (schemaLocation.startsWith("http://") == false)
+ // infinity loops prevention
+ if (!published.contains(schemaLocation))
{
- // infinity loops prevention
- if (published.contains(schemaLocation))
- {
- continue;
- }
- else
- {
- published.add(schemaLocation);
- }
-
+ published.add(schemaLocation);
String baseURI = parentURL.toExternalForm();
URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
File targetFile = new File(xsdURL.getFile()); //JBWS-3488
12 years
JBossWS SVN: r17127 - common/trunk/src/main/java/org/jboss/ws/common/utils.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-12-18 10:43:01 -0500 (Tue, 18 Dec 2012)
New Revision: 17127
Modified:
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3580] Optimize AbstractWSDLFilePublisher performances
Modified: common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 13:13:42 UTC (rev 17126)
+++ common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 15:43:01 UTC (rev 17127)
@@ -43,12 +43,14 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.jboss.ws.common.Constants;
import org.jboss.ws.common.DOMUtils;
import org.jboss.ws.common.IOUtils;
import org.jboss.ws.common.management.AbstractServerConfig;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.management.ServerConfig;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* Abstract WSDL file publisher
@@ -128,16 +130,12 @@
@SuppressWarnings("unchecked")
protected void publishWsdlImports(URL parentURL, Definition parentDefinition, List<String> published, String expLocation) throws Exception
{
- String baseURI = parentURL.toExternalForm();
-
Iterator it = parentDefinition.getImports().values().iterator();
while (it.hasNext())
{
for (Import wsdlImport : (List<Import>)it.next())
{
String locationURI = wsdlImport.getLocationURI();
- Definition subdef = wsdlImport.getDefinition();
-
// its an external import, don't publish locally
if (locationURI.startsWith("http://") == false)
{
@@ -151,15 +149,12 @@
published.add(locationURI);
}
+ String baseURI = parentURL.toExternalForm();
URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
File targetFile = new File(targetURL.getFile()); //JBWS-3488
- File parentFile = targetFile.getParentFile();
- if (parentFile != null) {
- if (!parentFile.mkdirs()) {
- ; // exception will be thrown later in this code
- }
- }
+ createParentDir(targetFile);
+ Definition subdef = wsdlImport.getDefinition();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
FileWriter fw = new FileWriter(targetFile);
@@ -179,6 +174,16 @@
}
}
+ private static void createParentDir(File targetFile)
+ {
+ File parentFile = targetFile.getParentFile();
+ if (parentFile != null) {
+ if (!parentFile.mkdirs()) {
+ ; // exception will be thrown later in this code
+ }
+ }
+ }
+
protected void publishSchemaImports(URL parentURL, Element element, List<String> published) throws Exception
{
this.publishSchemaImports(parentURL, element, published, expLocation);
@@ -188,82 +193,104 @@
*/
protected void publishSchemaImports(URL parentURL, Element element, List<String> published, String expLocation) throws Exception
{
- String baseURI = parentURL.toExternalForm();
-
- Iterator<Element> it = DOMUtils.getChildElements(element);
- while (it.hasNext())
- {
- Element childElement = (Element)it.next();
- if ("import".equals(childElement.getLocalName()) || "include".equals(childElement.getLocalName()))
- {
- String schemaLocation = childElement.getAttribute("schemaLocation");
- if (schemaLocation.length() > 0)
- {
- if (schemaLocation.startsWith("http://") == false)
+ Element childElement = getFirstChildElement(element);
+ while (childElement != null) {
+ //first check on namespace only to avoid doing anything on any other wsdl/schema elements
+ final String ns = childElement.getNamespaceURI();
+ if (Constants.NS_SCHEMA_XSD.equals(ns)) {
+ final String ln = childElement.getLocalName();
+ if ("import".equals(ln) || "include".equals(ln)) {
+ String schemaLocation = childElement.getAttribute("schemaLocation");
+ if (schemaLocation.length() > 0)
{
- // infinity loops prevention
- if (published.contains(schemaLocation))
+ if (schemaLocation.startsWith("http://") == false)
{
- continue;
- }
- else
- {
- published.add(schemaLocation);
- }
-
- URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
- File targetFile = new File(xsdURL.getFile()); //JBWS-3488
- File parentFile = targetFile.getParentFile();
- if (parentFile != null) {
- if (!parentFile.mkdirs()) {
- ; // exception will be thrown later in this code
+ // infinity loops prevention
+ if (published.contains(schemaLocation))
+ {
+ continue;
}
- }
+ else
+ {
+ published.add(schemaLocation);
+ }
+
+ String baseURI = parentURL.toExternalForm();
+ URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
+ File targetFile = new File(xsdURL.getFile()); //JBWS-3488
+ createParentDir(targetFile);
- String deploymentName = dep.getCanonicalName();
+ String deploymentName = dep.getCanonicalName();
- // get the resource path including the separator
- int index = baseURI.indexOf(deploymentName) + 1;
- String resourcePath = baseURI.substring(index + deploymentName.length());
- //check for sub-directories
- resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1);
+ // get the resource path including the separator
+ int index = baseURI.indexOf(deploymentName) + 1;
+ String resourcePath = baseURI.substring(index + deploymentName.length());
+ //check for sub-directories
+ resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1);
- resourcePath = expLocation + resourcePath + schemaLocation;
- while (resourcePath.indexOf("//") != -1)
- {
- resourcePath = resourcePath.replace("//", "/");
- }
- URL resourceURL = dep.getResourceResolver().resolve(resourcePath);
- InputStream is = new ResourceURL(resourceURL).openStream();
- if (is == null)
- throw MESSAGES.cannotFindSchemaImportInDeployment(resourcePath, deploymentName);
+ resourcePath = expLocation + resourcePath + schemaLocation;
+ while (resourcePath.indexOf("//") != -1)
+ {
+ resourcePath = resourcePath.replace("//", "/");
+ }
+ URL resourceURL = dep.getResourceResolver().resolve(resourcePath);
+ InputStream is = new ResourceURL(resourceURL).openStream();
+ if (is == null)
+ throw MESSAGES.cannotFindSchemaImportInDeployment(resourcePath, deploymentName);
- FileOutputStream fos = null;
- try
- {
- fos = new FileOutputStream(targetFile);
- IOUtils.copyStream(fos, is);
- }
- finally
- {
- if (fos != null) fos.close();
- }
+ FileOutputStream fos = null;
+ try
+ {
+ fos = new FileOutputStream(targetFile);
+ IOUtils.copyStream(fos, is);
+ }
+ finally
+ {
+ if (fos != null) fos.close();
+ }
- DEPLOYMENT_LOGGER.xmlSchemaImportPublishedTo(xsdURL);
+ DEPLOYMENT_LOGGER.xmlSchemaImportPublishedTo(xsdURL);
- // recursively publish imports
- Element subdoc = DOMUtils.parse(xsdURL.openStream(), getDocumentBuilder());
- publishSchemaImports(xsdURL, subdoc, published, expLocation);
+ // recursively publish imports
+ Element subdoc = DOMUtils.parse(xsdURL.openStream(), getDocumentBuilder());
+ publishSchemaImports(xsdURL, subdoc, published, expLocation);
+ }
}
+ } else if ("schema".equals(ln)) {
+ //recurse, as xsd:schema might contain an import
+ publishSchemaImports(parentURL, childElement, published, expLocation);
}
- }
- else
- {
+ } else if (Constants.NS_WSDL11.equals(ns) && "types".equals(childElement.getLocalName())) {
+ //recurse as wsdl:types might contain a schema
publishSchemaImports(parentURL, childElement, published, expLocation);
}
+ childElement = getNextSiblingElement(childElement);
}
}
+ private static Element getFirstChildElement(Node node) {
+ Node fc = node.getFirstChild();
+ Element e = null;
+ if (fc.getNodeType() == Node.ELEMENT_NODE) {
+ e = (Element)fc;
+ } else{
+ e = getNextSiblingElement(fc);
+ }
+ return e;
+ }
+
+ private static Element getNextSiblingElement(Node node) {
+ Element e = null;
+ Node nextSibling = node.getNextSibling();
+ while (e == null && nextSibling != null) {
+ if (nextSibling.getNodeType() == Node.ELEMENT_NODE) {
+ e = (Element)nextSibling;
+ }
+ nextSibling = nextSibling.getNextSibling();
+ }
+ return e;
+ }
+
/**
* Delete the published wsdl
*/
@@ -297,8 +324,8 @@
}
// delete the directory as well
- if (!dir.delete()) {
- dir.deleteOnExit();
+ if (dir.delete() == false) {
+ DEPLOYMENT_LOGGER.cannotDeletePublishedWsdlDoc(dir.toURI().toURL());
}
}
}
12 years
JBossWS SVN: r17126 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-12-18 08:13:42 -0500 (Tue, 18 Dec 2012)
New Revision: 17126
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3579] fixed PortComponentMD matching to be JSR 109 compliant
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2012-12-18 13:07:01 UTC (rev 17125)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2012-12-18 13:13:42 UTC (rev 17126)
@@ -118,68 +118,52 @@
{
for (PortComponentMetaData portComp : wsDesc.getPortComponents())
{
- // We match portComp's by SEI first and portQName second
- // In the first case the portComp may override the portQName that derives from the annotation
- String portCompSEI = portComp.getServiceEndpointInterface();
- boolean doesMatch = portCompSEI != null ? portCompSEI.equals(endpoint.getEpClass().getName()) : false;
- if (!doesMatch)
- {
- doesMatch = portComp.getWsdlPort().equals(endpoint.getPortName());
+ final String linkedId = portComp.getEjbLink() != null ? portComp.getEjbLink() : portComp.getServletLink();
+ final String id = endpoint.getId();
+ if (!id.equals(linkedId)) continue;
+
+ // PortQName overrides
+ if (portComp.getWsdlPort() != null) {
+ METADATA_LOGGER.overridePortName(id, endpoint.getPortName(), portComp.getWsdlPort());
+ endpoint.setPortName(portComp.getWsdlPort());
}
+ // ServiceQName overrides
+ if (portComp.getWsdlService() != null) {
+ METADATA_LOGGER.overrideServiceName(id, endpoint.getServiceName(), portComp.getWsdlService());
+ endpoint.setServiceName(portComp.getWsdlService());
+ }
- if (doesMatch)
- {
- final String id = endpoint.getId();
- // PortQName overrides
- if (portComp.getWsdlPort() != null)
- {
- METADATA_LOGGER.overridePortName(id, endpoint.getPortName(), portComp.getWsdlPort());
- endpoint.setPortName(portComp.getWsdlPort());
- }
- //ServiceQName overrides
- if (portComp.getWsdlService() != null)
- {
- METADATA_LOGGER.overrideServiceName(id, endpoint.getServiceName(), portComp.getWsdlService());
- endpoint.setServiceName(portComp.getWsdlService());
- }
-
- //HandlerChain contributions
- UnifiedHandlerChainsMetaData chainWrapper = portComp.getHandlerChains();
- if (chainWrapper != null)
- {
- endpoint.setHandlers(convertEndpointHandlers(chainWrapper.getHandlerChains()));
- }
+ // HandlerChain contributions
+ UnifiedHandlerChainsMetaData chainWrapper = portComp.getHandlerChains();
+ if (chainWrapper != null) {
+ endpoint.setHandlers(convertEndpointHandlers(chainWrapper.getHandlerChains()));
+ }
- // MTOM settings
- if (portComp.isMtomEnabled())
- {
- METADATA_LOGGER.enableMTOM(id);
- endpoint.setMtomEnabled(true);
- endpoint.setMtomThreshold(portComp.getMtomThreshold());
- }
-
- //Addressing
- if (portComp.isAddressingEnabled())
- {
- METADATA_LOGGER.enableAddressing(id);
- endpoint.setAddressingEnabled(true);
- endpoint.setAddressingRequired(portComp.isAddressingRequired());
- endpoint.setAddressingResponses(portComp.getAddressingResponses());
- }
- //RespectBinding
- if (portComp.isRespectBindingEnabled())
- {
- METADATA_LOGGER.enableRespectBinding(id);
- endpoint.setRespectBindingEnabled(true);
- }
- //wsdlLocation override
- String wsdlFile = portComp.getWebserviceDescription().getWsdlFile();
- if (wsdlFile != null)
- {
- METADATA_LOGGER.overridingWsdlFileLocation(id, wsdlFile);
- endpoint.setWsdlLocation(wsdlFile);
- }
+ // MTOM settings
+ if (portComp.isMtomEnabled()) {
+ METADATA_LOGGER.enableMTOM(id);
+ endpoint.setMtomEnabled(true);
+ endpoint.setMtomThreshold(portComp.getMtomThreshold());
}
+
+ // Addressing
+ if (portComp.isAddressingEnabled()) {
+ METADATA_LOGGER.enableAddressing(id);
+ endpoint.setAddressingEnabled(true);
+ endpoint.setAddressingRequired(portComp.isAddressingRequired());
+ endpoint.setAddressingResponses(portComp.getAddressingResponses());
+ }
+ // RespectBinding
+ if (portComp.isRespectBindingEnabled()) {
+ METADATA_LOGGER.enableRespectBinding(id);
+ endpoint.setRespectBindingEnabled(true);
+ }
+ // wsdlLocation override
+ String wsdlFile = portComp.getWebserviceDescription().getWsdlFile();
+ if (wsdlFile != null) {
+ METADATA_LOGGER.overridingWsdlFileLocation(id, wsdlFile);
+ endpoint.setWsdlLocation(wsdlFile);
+ }
}
}
}
12 years
JBossWS SVN: r17125 - shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/publish.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-12-18 08:07:01 -0500 (Tue, 18 Dec 2012)
New Revision: 17125
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java
Log:
[JBWS-3579] fixing test case using WebservicesMD - servlet-link is required in order to do proper match
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java 2012-12-18 12:27:51 UTC (rev 17124)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java 2012-12-18 13:07:01 UTC (rev 17125)
@@ -124,7 +124,20 @@
}
}
}
-
+
+ // See https://issues.jboss.org/browse/JBWS-3579
+ //
+ // There's one magic think in endpoint publish when using WebservicesMetaData.
+ // Every URL pattern is transformed to link name using the following algorithm.
+ // Note that in order to match WebservicesMetaData with particular endpoint,
+ // either ejb-link or servlet-link have to be provided.
+ // +-------------------------+----------------+----------------------+-------------------------------------------------------------------+
+ // | pattern URL | endpoint class | generated link name | comment |
+ // +-------------------------+----------------+----------------------+-------------------------------------------------------------------+
+ // | /* | foo.Bar | foo.Bar | used class name if pattern is wildcard |
+ // | /some/pattern | foo.Bar | some.pattern | used pattern url with dots instead of / and removed all wildcards |
+ // | /some/complex/pattern/* | foo.Bar | some.complex.pattern | used pattern url with dots instead of / and removed all wildcards |
+ // +-------------------------+----------------+----------------------+-------------------------------------------------------------------+
private WebservicesMetaData createMetaData() {
WebservicesMetaData metadata = new WebservicesMetaData();
WebserviceDescriptionMetaData webserviceDescription = new WebserviceDescriptionMetaData(metadata);
@@ -135,6 +148,9 @@
portComponent.setServiceEndpointInterface("org.jboss.test.ws.publish.EndpointImpl4");
portComponent.setWsdlPort(new QName("http://publish.ws.test.jboss.org/", "EndpointPort4"));
portComponent.setWsdlService(new QName("http://publish.ws.test.jboss.org/", "EndpointService4"));
+ // mandatory servlet link (because endpoint is POJO) - needed for proper matching of endpoint with WebservicesMD
+ portComponent.setServletLink("pattern4");
+ // if endpoint ^ would be EJB, users have to use setEjbLink() method instead
webserviceDescription.addPortComponent(portComponent);
WebserviceDescriptionMetaData webserviceDescription2 = new WebserviceDescriptionMetaData(metadata);
metadata.addWebserviceDescription(webserviceDescription2);
@@ -144,6 +160,9 @@
portComponent2.setServiceEndpointInterface("org.jboss.test.ws.publish.EndpointImpl5");
portComponent2.setWsdlPort(new QName("http://publish.ws.test.jboss.org/", "EndpointPort5"));
portComponent2.setWsdlService(new QName("http://publish.ws.test.jboss.org/", "EndpointService5"));
+ // mandatory servlet link (because endpoint is POJO) - needed for proper matching of endpoint with WebservicesMD
+ portComponent2.setServletLink("pattern5");
+ // if endpoint ^ would be EJB, users have to use setEjbLink() method instead
webserviceDescription2.addPortComponent(portComponent2);
return metadata;
}
12 years
JBossWS SVN: r17124 - common/trunk/src/main/java/org/jboss/ws/common/utils.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-12-18 07:27:51 -0500 (Tue, 18 Dec 2012)
New Revision: 17124
Modified:
common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
Log:
[JBWS-3573] fixing some violations
Modified: common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 11:32:54 UTC (rev 17123)
+++ common/trunk/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java 2012-12-18 12:27:51 UTC (rev 17124)
@@ -153,8 +153,9 @@
URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
File targetFile = new File(targetURL.getFile()); //JBWS-3488
- if (targetFile.getParentFile() != null) {
- if (!targetFile.getParentFile().mkdirs()) {
+ File parentFile = targetFile.getParentFile();
+ if (parentFile != null) {
+ if (!parentFile.mkdirs()) {
; // exception will be thrown later in this code
}
}
@@ -212,8 +213,9 @@
URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
File targetFile = new File(xsdURL.getFile()); //JBWS-3488
- if (targetFile.getParentFile() != null) {
- if (!targetFile.getParentFile().mkdirs()) {
+ File parentFile = targetFile.getParentFile();
+ if (parentFile != null) {
+ if (!parentFile.mkdirs()) {
; // exception will be thrown later in this code
}
}
12 years
JBossWS SVN: r17123 - common-tools/trunk/src/main/java/org/jboss/ws/tools/ant.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-12-18 06:32:54 -0500 (Tue, 18 Dec 2012)
New Revision: 17123
Modified:
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java
Log:
[JBWS-3573] fixing some violations
Modified: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java 2012-12-18 11:27:21 UTC (rev 17122)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java 2012-12-18 11:32:54 UTC (rev 17123)
@@ -193,6 +193,7 @@
ClassLoader prevCL = SecurityActions.getContextClassLoader();
ClassLoader antLoader = SecurityActions.getClassLoader(this.getClass());
SecurityActions.setContextClassLoader(antLoader);
+ PrintStream ps = null;
try
{
WSContractConsumer consumer = WSContractConsumer.newInstance();
@@ -228,7 +229,8 @@
if (verbose)
{
- consumer.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO)));
+ ps = new PrintStream(new LogOutputStream(this, Project.MSG_INFO));
+ consumer.setMessageStream(ps);
}
try
@@ -243,6 +245,9 @@
}
finally
{
+ if (ps != null) {
+ ps.close();
+ }
SecurityActions.setContextClassLoader(prevCL);
}
}
12 years
JBossWS SVN: r17122 - in thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497: rt/frontend/simple/src/main/java/org/apache/cxf/frontend and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: mmusaji
Date: 2012-12-18 06:27:21 -0500 (Tue, 18 Dec 2012)
New Revision: 17122
Modified:
thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497/
thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
Log:
[JBPAPP-10497] - Adding autoRewriteSoapAddressForAllServices option
Property changes on: thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497
___________________________________________________________________
Added: svn:mergeinfo
+ /thirdparty/cxf/branches/cxf-2.4.10:17053
Modified: thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
===================================================================
--- thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java 2012-12-18 11:09:02 UTC (rev 17121)
+++ thirdparty/cxf/branches/cxf-2.4.9.jbossorg-1_JBPAPP-10497/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java 2012-12-18 11:27:21 UTC (rev 17122)
@@ -82,6 +82,7 @@
public static final WSDLGetInterceptor INSTANCE = new WSDLGetInterceptor();
public static final String AUTO_REWRITE_ADDRESS = "autoRewriteSoapAddress";
+ public static final String AUTO_REWRITE_ADDRESS_ALL = "autoRewriteSoapAddressForAllServices";
public static final String PUBLISHED_ENDPOINT_URL = "publishedEndpointUrl";
private static final String WSDLS_KEY = WSDLGetInterceptor.class.getName() + ".WSDLs";
@@ -302,7 +303,6 @@
Map<String, SchemaReference> smp,
Message message) {
List<Element> elementList = null;
- Object rewriteSoapAddress = message.getContextualProperty(AUTO_REWRITE_ADDRESS);
try {
elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
@@ -348,7 +348,18 @@
base), e);
}
- if (rewriteSoapAddress == null || MessageUtils.isTrue(rewriteSoapAddress)) {
+ boolean rewriteAllSoapAddress = MessageUtils.isTrue(message.getContextualProperty(AUTO_REWRITE_ADDRESS_ALL));
+ if (rewriteAllSoapAddress) {
+ List<Element> portList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ "http://schemas.xmlsoap.org/wsdl/",
+ "port");
+ for (Element el : portList) {
+ rewriteAddressProtocolHostPort(base, el, "http://schemas.xmlsoap.org/wsdl/soap/");
+ rewriteAddressProtocolHostPort(base, el, "http://schemas.xmlsoap.org/wsdl/soap12/");
+ }
+ }
+ Object rewriteSoapAddress = message.getContextualProperty(AUTO_REWRITE_ADDRESS);
+ if (rewriteSoapAddress == null || MessageUtils.isTrue(rewriteSoapAddress) || rewriteAllSoapAddress) {
List<Element> serviceList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
"http://schemas.xmlsoap.org/wsdl/",
"service");
@@ -385,6 +396,25 @@
soapAddress.setAttribute("location", base);
}
}
+
+ protected void rewriteAddressProtocolHostPort(String base, Element el, String soapNS) {
+ List<Element> sadEls = DOMUtils.findAllElementsByTagNameNS(el,
+ soapNS,
+ "address");
+ for (Element soapAddress : sadEls) {
+ try {
+ String location = soapAddress.getAttribute("location").trim();
+ URL locUrl = new URL(location);
+ URL baseUrl = new URL(base);
+ StringBuilder sb = new StringBuilder(baseUrl.getProtocol());
+ sb.append("://").append(baseUrl.getHost()).append(":").append(baseUrl.getPort())
+ .append(locUrl.getPath());
+ soapAddress.setAttribute("location", sb.toString());
+ } catch (Exception e) {
+ //ignore
+ }
+ }
+ }
static String resolveWithCatalogs(OASISCatalogManager catalogs, String start, String base) {
try {
12 years