JBossWS SVN: r14599 - spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-06-22 02:46:21 -0400 (Wed, 22 Jun 2011)
New Revision: 14599
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java
Log:
[JBWS-3316]:Get the bundle key short
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties 2011-06-22 06:46:21 UTC (rev 14599)
@@ -4,4 +4,4 @@
UNEXPECTED_END_TAG=Unexpected end tag: {0}
REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY=Reached end of xml document unexpectedly
ELEMENT_IN_WEBSERVICES.XML_NOT_NAMESPACE_QUALIFIED=<wsdl-port> element in webservices.xml not namespace qualified: {0}
-ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_STRINGS_ARE_ALLOWED=Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed
+ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_ALLOWED=Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java 2011-06-22 06:46:21 UTC (rev 14599)
@@ -211,7 +211,7 @@
public void setAddressingResponses(final String responsesTypes)
{
if (!"ANONYMOUS".equals(responsesTypes) && !"NON_ANONYMOUS".equals(responsesTypes) && !"ALL".equals(responsesTypes))
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ONLY_ALL,_ANONYMOUS_OR_NON_ANONYMOUS_STRINGS_ARE_ALLOWED"));
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_ALLOWED"));
this.addressingResponses = responsesTypes;
}
13 years, 6 months
JBossWS SVN: r14598 - in spi/trunk: src/main/java/org/jboss/wsf/spi/metadata and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-06-22 02:38:21 -0400 (Wed, 22 Jun 2011)
New Revision: 14598
Added:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/Message.properties
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/Message.properties
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/Message.properties
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/Message.properties
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties
spi/trunk/src/main/java/org/jboss/wsf/spi/util/Message.properties
Modified:
spi/trunk/pom.xml
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaDataParser.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
Log:
[JBWS-3316]:i18n spi
Modified: spi/trunk/pom.xml
===================================================================
--- spi/trunk/pom.xml 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/pom.xml 2011-06-22 06:38:21 UTC (rev 14598)
@@ -73,6 +73,15 @@
<!-- Plugins -->
<build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -21,18 +21,34 @@
*/
package org.jboss.wsf.spi.metadata;
-import static org.jboss.wsf.spi.metadata.ParserConstants.*;
+import static org.jboss.wsf.spi.metadata.ParserConstants.CHAIN_PORT_PATTERN;
+import static org.jboss.wsf.spi.metadata.ParserConstants.CHAIN_PROTOCOL_BINDING;
+import static org.jboss.wsf.spi.metadata.ParserConstants.CHAIN_SERVICE_PATTERN;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_CHAIN;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_CHAINS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_CLASS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_NAME;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_PARAM;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_PARAM_NAME;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_PARAM_VALUE;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_SOAP_HEADER;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_SOAP_ROLE;
import static org.jboss.wsf.spi.util.StAXUtils.elementAsQName;
import static org.jboss.wsf.spi.util.StAXUtils.elementAsString;
import static org.jboss.wsf.spi.util.StAXUtils.match;
+import java.util.ResourceBundle;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
/**
* Basic handler-chains parser
@@ -42,6 +58,7 @@
*/
public abstract class AbstractHandlerChainsMetaDataParser
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(AbstractHandlerChainsMetaDataParser.class);
protected UnifiedHandlerChainsMetaData parseHandlerChains(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
return this.parseHandlerChains(reader, nsUri, nsUri, HANDLER_CHAINS);
@@ -62,7 +79,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -71,12 +88,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private UnifiedHandlerChainMetaData parseHandlerChain(XMLStreamReader reader, String nsUri, UnifiedHandlerChainsMetaData handlerChains) throws XMLStreamException
@@ -93,7 +110,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -114,12 +131,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
protected UnifiedHandlerMetaData parseHandler(XMLStreamReader reader, String nsUri) throws XMLStreamException
@@ -141,7 +158,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -164,12 +181,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private UnifiedInitParamMetaData parseInitParam(XMLStreamReader reader, String nsUri) throws XMLStreamException
@@ -186,7 +203,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -200,11 +217,11 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/Message.properties (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
@@ -0,0 +1,3 @@
+UNEXPECTED_END_TAG=Unexpected end tag: {0}
+UNEXPECTED_ELEMENT=Unexpected element: {0}
+REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY=Reached end of xml document unexpectedly
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -24,7 +24,9 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.ResourceBundle;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
@@ -36,6 +38,7 @@
*/
public abstract class AbstractCommonConfig implements CommonConfig
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(AbstractCommonConfig.class);
private String configName;
private Map<String, Feature> features = new HashMap<String, Feature>();
private Map<String, String> properties = new HashMap<String, String>();
@@ -69,7 +72,7 @@
handlerChains = getPreHandlerChains();
else if (type == HandlerType.POST)
handlerChains = getPostHandlerChains();
- else throw new IllegalArgumentException("Invalid handler type: " + type);
+ else throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INVALID_HANDLER_TYPE", type));
return handlerChains;
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -23,23 +23,38 @@
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-import static org.jboss.wsf.spi.metadata.ParserConstants.*;
+import static org.jboss.wsf.spi.metadata.ParserConstants.CLIENT_CONFIG;
+import static org.jboss.wsf.spi.metadata.ParserConstants.CONFIG_NAME;
+import static org.jboss.wsf.spi.metadata.ParserConstants.ENDPOINT_CONFIG;
+import static org.jboss.wsf.spi.metadata.ParserConstants.FEATURE;
+import static org.jboss.wsf.spi.metadata.ParserConstants.FEATURE_DATA;
+import static org.jboss.wsf.spi.metadata.ParserConstants.FEATURE_NAME;
+import static org.jboss.wsf.spi.metadata.ParserConstants.JAVAEE_NS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.JAXWS_CONFIG;
+import static org.jboss.wsf.spi.metadata.ParserConstants.JBOSSWS_JAXWS_CONFIG_NS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.POST_HANDLER_CHAINS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.PRE_HANDLER_CHAINS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.PROPERTY;
+import static org.jboss.wsf.spi.metadata.ParserConstants.PROPERTY_NAME;
+import static org.jboss.wsf.spi.metadata.ParserConstants.PROPERTY_VALUE;
import static org.jboss.wsf.spi.util.StAXUtils.elementAsString;
import static org.jboss.wsf.spi.util.StAXUtils.match;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.ResourceBundle;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.util.StAXUtils;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
/**
* The parser for the configuration metadata
*
@@ -48,6 +63,7 @@
*/
public class ConfigMetaDataParser extends AbstractHandlerChainsMetaDataParser
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(ConfigMetaDataParser.class);
private ConfigMetaDataParser()
{
super();
@@ -112,7 +128,7 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
@@ -133,7 +149,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -149,12 +165,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private void parseConfig(XMLStreamReader reader, CommonConfig config, String configElement) throws XMLStreamException
@@ -170,7 +186,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -193,12 +209,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private void parseProperty(XMLStreamReader reader, CommonConfig config) throws XMLStreamException
@@ -214,14 +230,14 @@
{
if (name == null)
{
- throw new IllegalStateException("Could not get property name!");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "COULD_NOT_GET_PROPERTY_NAME"));
}
config.setProperty(name, value);
return;
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -233,12 +249,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private Feature parseFeature(XMLStreamReader reader) throws XMLStreamException
@@ -253,13 +269,13 @@
{
if (feature == null)
{
- throw new IllegalStateException("Could not read feature name!");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "COULD_NOT_READ_FEATURE_NAME"));
}
return feature;
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -268,7 +284,7 @@
}
else if (match(reader, JBOSSWS_JAXWS_CONFIG_NS, FEATURE_DATA)) {
//not implemented yet
- Logger.getLogger(this.getClass()).warn("Feature data not supported yet!");
+ Logger.getLogger(this.getClass()).warn(BundleUtils.getMessage(bundle, "FEATURE_DATA_NOT_SUPPORTED_YET"));
while (reader.hasNext()) {
reader.next();
if (reader.isEndElement() && match(reader, JBOSSWS_JAXWS_CONFIG_NS, FEATURE_DATA))
@@ -279,11 +295,11 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/Message.properties (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
@@ -0,0 +1,7 @@
+INVALID_HANDLER_TYPE=Invalid handler type: {0}
+UNEXPECTED_ELEMENT=Unexpected element: {0}
+UNEXPECTED_END_TAG=Unexpected end tag: {0}
+REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY=Reached end of xml document unexpectedly
+COULD_NOT_GET_PROPERTY_NAME=Could not get property name!
+COULD_NOT_READ_FEATURE_NAME=Could not read feature name!
+FEATURE_DATA_NOT_SUPPORTED_YET=Feature data not supported yet!
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -21,6 +21,10 @@
*/
package org.jboss.wsf.spi.metadata.injection;
+import java.util.ResourceBundle;
+
+import org.jboss.ws.api.util.BundleUtils;
+
/**
* An injection target specifies a class and a name within
* that class into which a resource should be injected.
@@ -30,6 +34,7 @@
*/
public final class InjectionMetaData
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(InjectionMetaData.class);
/**
* Target class to do injection on.
@@ -70,11 +75,11 @@
super();
if (targetClass == null)
- throw new IllegalArgumentException("targetClass not specified");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "TARGETCLASS_NOT_SPECIFIED"));
if (targetName == null)
- throw new IllegalArgumentException("targetName not specified");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "TARGETNAME_NOT_SPECIFIED"));
if (envEntryName == null)
- throw new IllegalArgumentException("envEntryName not specified");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ENVENTRYNAME_NOT_SPECIFIED"));
this.targetClass = targetClass;
this.targetName = targetName;
@@ -113,7 +118,7 @@
if (Double.class.getName().equals(s))
return Double.class;
- throw new IllegalArgumentException("Unsupported env entry type: " + s);
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "UNSUPPORTED_ENV_ENTRY_TYPE", s));
}
/**
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -22,6 +22,8 @@
package org.jboss.wsf.spi.metadata.injection;
import java.lang.annotation.Annotation;
+import java.util.ResourceBundle;
+import org.jboss.ws.api.util.BundleUtils;
import java.util.Collections;
import java.util.Collection;
import java.util.LinkedList;
@@ -36,6 +38,7 @@
*/
public final class InjectionsMetaData
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(InjectionsMetaData.class);
/**
* Empty list constant.
@@ -63,9 +66,9 @@
super();
if (injections == null)
- throw new IllegalArgumentException("injections metadata list cannot be null");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INJECTIONS_METADATA_LIST_CANNOT_BE_NULL"));
if ((resolvers == null) || (resolvers.size() == 0))
- throw new IllegalArgumentException("reference resolvers list cannot be null or empty collection");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "REFERENCE_RESOLVERS_LIST_CANNOT_BE_NULL"));
this.injections = injections;
this.referenceResolvers = resolvers;
@@ -80,7 +83,7 @@
public Collection<InjectionMetaData> getInjectionsMetaData(Class<?> clazz)
{
if (clazz == null)
- throw new IllegalArgumentException("class cannot be null");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CLASS_CANNOT_BE_NULL"));
if (this.injections.size() == 0)
return EMPTY_LIST;
@@ -117,7 +120,7 @@
final ReferenceResolver resolver = this.referenceResolvers.get(annotation);
if (resolver == null)
{
- throw new IllegalArgumentException("No registered reference resolver for: " + annotation);
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "NO_REGISTERED_REFERENCE_RESOLVER_FOR", annotation));
}
return resolver;
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/Message.properties (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
@@ -0,0 +1,8 @@
+TARGETCLASS_NOT_SPECIFIED=targetClass not specified
+TARGETNAME_NOT_SPECIFIED=targetName not specified
+ENVENTRYNAME_NOT_SPECIFIED=envEntryName not specified
+UNSUPPORTED_ENV_ENTRY_TYPE=Unsupported env entry type: {0}
+INJECTIONS_METADATA_LIST_CANNOT_BE_NULL=injections metadata list cannot be null
+REFERENCE_RESOLVERS_LIST_CANNOT_BE_NULL=reference resolvers list cannot be null or empty collection
+CLASS_CANNOT_BE_NULL=class cannot be null
+NO_REGISTERED_REFERENCE_RESOLVER_FOR=No registered reference resolver for: {0}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/Message.properties (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
@@ -0,0 +1,7 @@
+ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_ALLOWED=Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed
+CANNOT_FIND_JAXRCP-MAPPING-FILE=Cannot find jaxrcp-mapping-file: {0}
+MULTIPLE_MATCHING_PORT_COMPONENT_REF=Multiple matching port component ref: sei={0} port={1}
+CANNOT_FIND_WSDL-OVERRIDE=Cannot find wsdl-override: {0}
+CANNOT_FIND_WSDL-FILE=Cannot find wsdl-file: {0}
+UNEXPECTED_ELEMENT=Unexpected element: {0}
+CANNOT_MATCH=Cannot match against seiName=null && portName=null.
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaDataParser.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaDataParser.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaDataParser.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -23,17 +23,22 @@
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-import static org.jboss.wsf.spi.metadata.ParserConstants.*;
+import static org.jboss.wsf.spi.metadata.ParserConstants.HANDLER_CHAINS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.J2EE_NS;
+import static org.jboss.wsf.spi.metadata.ParserConstants.JAVAEE_NS;
import static org.jboss.wsf.spi.util.StAXUtils.match;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ResourceBundle;
-import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
-import org.jboss.wsf.spi.util.StAXUtils;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
+import org.jboss.wsf.spi.util.StAXUtils;
+
/**
* The parser for the unified metadata handler chains element
*
@@ -42,6 +47,7 @@
*/
public class UnifiedHandlerChainsMetaDataParser extends AbstractHandlerChainsMetaDataParser
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(UnifiedHandlerChainsMetaDataParser.class);
private UnifiedHandlerChainsMetaDataParser()
{
super();
@@ -89,7 +95,7 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -23,9 +23,11 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.ResourceBundle;
import javax.xml.namespace.QName;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.serviceref.ServiceRefElement;
/** The metdata data from service-ref/port-component-ref element in web.xml, ejb-jar.xml, and application-client.xml.
@@ -34,6 +36,7 @@
*/
public class UnifiedPortComponentRefMetaData extends ServiceRefElement
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(UnifiedPortComponentRefMetaData.class);
private static final long serialVersionUID = 8622309745808960649L;
// The parent service-ref
@@ -93,7 +96,7 @@
public void setAddressingResponses(final String responsesTypes)
{
if (!"ANONYMOUS".equals(responsesTypes) && !"NON_ANONYMOUS".equals(responsesTypes) && !"ALL".equals(responsesTypes))
- throw new IllegalArgumentException("Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_ALLOWED"));
this.addressingResponses = responsesTypes;
}
@@ -221,7 +224,7 @@
public boolean matches(String seiName, QName portName)
{
if (seiName == null && portName == null)
- throw new IllegalArgumentException("Cannot match against seiName=null && portName=null.");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_MATCH"));
boolean match = false;
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -35,11 +35,13 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.ResourceBundle;
import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.deployment.WritableUnifiedVirtualFile;
import org.jboss.wsf.spi.serviceref.ServiceRefElement;
@@ -56,6 +58,7 @@
*/
public final class UnifiedServiceRefMetaData extends ServiceRefElement
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(UnifiedServiceRefMetaData.class);
private static final long serialVersionUID = -926464174132493955L;
// provide logging
@@ -147,7 +150,7 @@
public void setAddressingResponses(final String responsesTypes)
{
if (!"ANONYMOUS".equals(responsesTypes) && !"NON_ANONYMOUS".equals(responsesTypes) && !"ALL".equals(responsesTypes))
- throw new IllegalArgumentException("Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ONLY_ALL,ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_ALLOWED"));
this.addressingResponses = responsesTypes;
}
@@ -248,7 +251,7 @@
}
catch (Exception e)
{
- throw new WebServiceException("Cannot find jaxrcp-mapping-file: " + mappingFile, e);
+ throw new WebServiceException(BundleUtils.getMessage(bundle, "CANNOT_FIND_JAXRCP-MAPPING-FILE", mappingFile), e);
}
}
return mappingURL;
@@ -267,7 +270,7 @@
if (ref.matches(seiName, portName))
{
if (matchingRef != null)
- log.warn("Multiple matching port component ref: [sei=" + seiName + ",port=" + portName + "]");
+ log.warn(BundleUtils.getMessage(bundle, "MULTIPLE_MATCHING_PORT_COMPONENT_REF", new Object[]{ seiName , portName }));
matchingRef = ref;
}
@@ -357,7 +360,7 @@
}
catch (Exception e)
{
- throw new WebServiceException("Cannot find wsdl-override: " + wsdlOverride, e);
+ throw new WebServiceException(BundleUtils.getMessage(bundle, "CANNOT_FIND_WSDL-OVERRIDE", wsdlOverride), e);
}
}
}
@@ -376,7 +379,7 @@
}
catch (Exception e)
{
- throw new WebServiceException("Cannot find wsdl-file: " + wsdlFile, e);
+ throw new WebServiceException(BundleUtils.getMessage(bundle, "CANNOT_FIND_WSDL-FILE", wsdlFile), e);
}
}
}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
@@ -0,0 +1,7 @@
+CANNOT_GET_PORT_COMPONENT_NAME=Cannot get port component name {0}, we have: {1}
+FAILED_TO_UNMARSHALL=Failed to unmarshall:{0}
+UNEXPECTED_ELEMENT=Unexpected element: {0}
+UNEXPECTED_END_TAG=Unexpected end tag: {0}
+REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY=Reached end of xml document unexpectedly
+ELEMENT_IN_WEBSERVICES.XML_NOT_NAMESPACE_QUALIFIED=<wsdl-port> element in webservices.xml not namespace qualified: {0}
+ONLY_ALL_ANONYMOUS_OR_NON_ANONYMOUS_STRINGS_ARE_ALLOWED=Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -23,10 +23,12 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.ResourceBundle;
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
@@ -43,6 +45,7 @@
*/
public class PortComponentMetaData
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(PortComponentMetaData.class);
/**
* The index of the webservice-description in webservices.xml
*/
@@ -122,7 +125,7 @@
public void setWsdlPort(QName wsdlPort)
{
if (wsdlPort.getNamespaceURI().length() == 0)
- log.warn("<wsdl-port> element in webservices.xml not namespace qualified: " + wsdlPort);
+ log.warn(BundleUtils.getMessage(bundle, "ELEMENT_IN_WEBSERVICES.XML_NOT_NAMESPACE_QUALIFIED", wsdlPort));
this.wsdlPort = wsdlPort;
}
@@ -208,7 +211,7 @@
public void setAddressingResponses(final String responsesTypes)
{
if (!"ANONYMOUS".equals(responsesTypes) && !"NON_ANONYMOUS".equals(responsesTypes) && !"ALL".equals(responsesTypes))
- throw new IllegalArgumentException("Only ALL, ANONYMOUS or NON_ANONYMOUS strings are allowed");
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ONLY_ALL,_ANONYMOUS_OR_NON_ANONYMOUS_STRINGS_ARE_ALLOWED"));
this.addressingResponses = responsesTypes;
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -22,6 +22,8 @@
package org.jboss.wsf.spi.metadata.webservices;
import java.util.ArrayList;
+import java.util.ResourceBundle;
+import org.jboss.ws.api.util.BundleUtils;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -38,6 +40,7 @@
*/
public class WebserviceDescriptionMetaData
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(WebserviceDescriptionMetaData.class);
// provide logging
private static final Logger log = Logger.getLogger(WebserviceDescriptionMetaData.class);
@@ -113,7 +116,7 @@
pcNames.add(wsdlPortName);
}
- log.error("Cannot get port component name '" + name + "', we have: " + pcNames);
+ log.error(BundleUtils.getMessage(bundle, "CANNOT_GET_PORT_COMPONENT_NAME", new Object[]{ name , pcNames}));
return null;
}
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 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -57,13 +57,14 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.ResourceBundle;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.ws.WebServiceException;
-import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
import org.jboss.wsf.spi.util.StAXUtils;
@@ -76,6 +77,7 @@
*/
public class WebservicesFactory extends AbstractHandlerChainsMetaDataParser
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(WebservicesFactory.class);
// The URL to the webservices.xml descriptor
private URL descriptorURL;
@@ -138,7 +140,7 @@
}
catch (Exception e)
{
- throw new WebServiceException("Failed to unmarshall " + wsddUrl + ":" + e.getMessage(), e);
+ throw new WebServiceException(BundleUtils.getMessage(bundle, "FAILED_TO_UNMARSHALL", wsddUrl), e);
}
finally
{
@@ -202,7 +204,7 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
@@ -223,7 +225,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -232,12 +234,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private WebserviceDescriptionMetaData parseWebserviceDescription(XMLStreamReader reader, String nsUri, WebservicesMetaData wsMetaData) throws XMLStreamException
@@ -254,7 +256,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -272,12 +274,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private PortComponentMetaData parsePortComponent(XMLStreamReader reader, String nsUri, WebserviceDescriptionMetaData desc) throws XMLStreamException
@@ -294,7 +296,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -336,12 +338,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private void parseAddressing(XMLStreamReader reader, String nsUri, PortComponentMetaData pc) throws XMLStreamException
@@ -357,7 +359,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -372,12 +374,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private void parseRespectBinding(XMLStreamReader reader, String nsUri, PortComponentMetaData pc) throws XMLStreamException
@@ -393,7 +395,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -402,12 +404,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
private void parseServiceImplBean(XMLStreamReader reader, String nsUri, PortComponentMetaData pc) throws XMLStreamException
@@ -423,7 +425,7 @@
}
else
{
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_END_TAG", reader.getLocalName()));
}
}
case XMLStreamConstants.START_ELEMENT : {
@@ -435,12 +437,12 @@
}
else
{
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "UNEXPECTED_ELEMENT", reader.getLocalName()));
}
}
}
}
- throw new IllegalStateException("Reached end of xml document unexpectedly");
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "REACHED_END_OF_XML_DOCUMENT_UNEXPECTEDLY"));
}
public URL getDescriptorURL()
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/util/Message.properties
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/Message.properties (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/Message.properties 2011-06-22 06:38:21 UTC (rev 14598)
@@ -0,0 +1,5 @@
+CANNOT_GET_URL_FOR=Cannot get URL for: {0}
+CANNOT_GET_CHILDREN_FOR_RESOURCE=Cannot get children for resource: {0}
+CANNOT_GET_NAME_FOR_RESOURCE=Cannot get name for resource: {0}
+READING_EXTERNAL_ENTITIES_IS_DISABLED=Reading external entities is disabled
+COULDN'T_PARSE_STREAM=Couldn't parse stream
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -22,6 +22,7 @@
package org.jboss.wsf.spi.util;
import java.io.InputStream;
+import java.util.ResourceBundle;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@@ -31,6 +32,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.ws.api.util.BundleUtils;
+
/**
* StAX utils
*
@@ -39,6 +42,7 @@
*/
public class StAXUtils
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(StAXUtils.class);
private static final BlockingQueue<XMLInputFactory> INPUT_FACTORY_POOL;
static
@@ -77,7 +81,7 @@
public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace)
throws XMLStreamException
{
- throw new XMLStreamException("Reading external entities is disabled");
+ throw new XMLStreamException(BundleUtils.getMessage(bundle, "READING_EXTERNAL_ENTITIES_IS_DISABLED"));
}
});
return factory;
@@ -107,7 +111,7 @@
}
catch (XMLStreamException e)
{
- throw new RuntimeException("Couldn't parse stream.", e);
+ throw new RuntimeException(BundleUtils.getMessage(bundle, "COULDN'T_PARSE_STREAM"), e);
}
finally
{
@@ -184,7 +188,7 @@
}
catch (XMLStreamException e)
{
- throw new RuntimeException("Couldn't parse stream.", e);
+ throw new RuntimeException(BundleUtils.getMessage(bundle, "COULDN'T_PARSE_STREAM"), e);
}
}
}
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 2011-06-21 11:31:52 UTC (rev 14597)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2011-06-22 06:38:21 UTC (rev 14598)
@@ -31,10 +31,12 @@
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
+import java.util.ResourceBundle;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
/**
@@ -48,6 +50,7 @@
*/
public class URLLoaderAdapter implements UnifiedVirtualFile
{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(URLLoaderAdapter.class);
private static final long serialVersionUID = 8263115387770740414L;
private URL rootURL;
@@ -113,7 +116,7 @@
}
if (resourceURL == null)
- throw new IOException("Cannot get URL for: " + resourcePath);
+ throw new IOException(BundleUtils.getMessage(bundle, "CANNOT_GET_URL_FOR", resourcePath));
return new URLLoaderAdapter(rootURL, loader, resourceURL);
}
@@ -201,7 +204,7 @@
catch (Exception e)
{
e.printStackTrace();
- log.error("Cannot get children for resource: " + url);
+ log.error(BundleUtils.getMessage(bundle, "CANNOT_GET_CHILDREN_FOR_RESOURCE", url));
}
}
else //std file/dir
@@ -223,7 +226,7 @@
}
catch (Exception e)
{
- log.error("Cannot get children for resource: " + url, e);
+ log.error(BundleUtils.getMessage(bundle, "CANNOT_GET_CHILDREN_FOR_RESOURCE", url), e);
}
}
return list;
@@ -242,7 +245,7 @@
}
catch (Exception e)
{
- log.error("Cannot get name for resource: " + toURL(), e);
+ log.error(BundleUtils.getMessage(bundle, "CANNOT_GET_NAME_FOR_RESOURCE", toURL()), e);
}
return name;
}
13 years, 6 months
JBossWS SVN: r14597 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-06-21 07:31:52 -0400 (Tue, 21 Jun 2011)
New Revision: 14597
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
Log:
fixing NPE
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 11:05:37 UTC (rev 14596)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 11:31:52 UTC (rev 14597)
@@ -98,7 +98,7 @@
Object implementor = endpoint.getImplementor();
// setup our invoker for http endpoints if invoker is not configured in jbossws-cxf.xml DD
- boolean isHttpEndpoint = (endpoint.getAddress().substring(0, 5).toLowerCase().startsWith("http"));
+ boolean isHttpEndpoint = endpoint.getAddress() != null && endpoint.getAddress().substring(0, 5).toLowerCase().startsWith("http");
if ((endpoint.getInvoker() == null) && isHttpEndpoint)
{
endpoint.setInvoker(new JBossWSInvoker());
13 years, 7 months
JBossWS SVN: r14596 - in stack/cxf/trunk/modules: testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-06-21 07:05:37 -0400 (Tue, 21 Jun 2011)
New Revision: 14596
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml
Log:
[JBWS-3319] Unified CXF InvokerJSE & InvokerEJB3 invokers - round 2
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 11:05:37 UTC (rev 14596)
@@ -96,6 +96,13 @@
if (!endpoint.isPublished()) //before publishing, we set the jaxws conf
{
Object implementor = endpoint.getImplementor();
+
+ // setup our invoker for http endpoints if invoker is not configured in jbossws-cxf.xml DD
+ boolean isHttpEndpoint = (endpoint.getAddress().substring(0, 5).toLowerCase().startsWith("http"));
+ if ((endpoint.getInvoker() == null) && isHttpEndpoint)
+ {
+ endpoint.setInvoker(new JBossWSInvoker());
+ }
EndpointConfig epConfig = implementor.getClass().getAnnotation(EndpointConfig.class);
String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -19,9 +19,6 @@
<jaxws:serviceFactory>
<ref bean='aegis-service-factory' />
</jaxws:serviceFactory>
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker' />
- </jaxws:invoker>
</jaxws:endpoint>
</beans>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -6,11 +6,6 @@
<jaxws:endpoint id='TestService' address='http://@jboss.bind.address@:8080/jaxws-cxf-descriptor'
implementor='org.jboss.test.ws.jaxws.cxf.descriptor.DescriptorEndpointImpl'>
-
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
- </jaxws:invoker>
-
</jaxws:endpoint>
</beans>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -15,9 +15,6 @@
</wsp:Policy>
<jaxws:endpoint id='RMService' address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-doc' implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicDocEndpointImpl'>
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
- </jaxws:invoker>
<jaxws:features>
<p:policies>
<wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -15,9 +15,6 @@
</wsp:Policy>
<jaxws:endpoint id='TestService' address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-rpc' implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicRPCEndpointImpl'>
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
- </jaxws:invoker>
<jaxws:features>
<p:policies>
<wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -9,11 +9,7 @@
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml"/>
<jaxws:endpoint id='SOAPQueryService'
- implementor='org.jboss.test.ws.jaxws.samples.jmstransport.OrganizationHttpEndpoint'
- >
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
- </jaxws:invoker>
+ implementor='org.jboss.test.ws.jaxws.samples.jmstransport.OrganizationHttpEndpoint'>
</jaxws:endpoint>
<jaxws:endpoint id='JMSQueryService'
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -43,9 +43,6 @@
id='ServiceImpl'
address='http://@jboss.bind.address@:8080/jaxws-samples-wsse-sign-encrypt'
implementor='org.jboss.test.ws.jaxws.samples.wsse.ServiceImpl'>
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
- </jaxws:invoker>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
<ref bean="Sign_Response"/>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml 2011-06-21 11:05:37 UTC (rev 14596)
@@ -26,9 +26,6 @@
id='EjbEndpointImpl'
address='http://@jboss.bind.address@:8080/jaxws-samples-wsseEJB/EjbEndpointService/EjbEndpoint'
implementor='org.jboss.test.ws.jaxws.samples.wsseEJB.EjbEndpointImpl'>
- <jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
- </jaxws:invoker>
<jaxws:inInterceptors>
<ref bean="SecurityContextIn"/>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
13 years, 7 months
JBossWS SVN: r14595 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf/configuration and 10 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-06-21 06:38:54 -0400 (Tue, 21 Jun 2011)
New Revision: 14595
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
Removed:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml
Log:
[JBWS-3319] Unified CXF InvokerJSE & InvokerEJB3 invokers
Deleted: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -1,350 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jboss.wsf.stack.cxf;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-import javax.xml.ws.soap.SOAPFaultException;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.attachment.AttachmentImpl;
-import org.apache.cxf.binding.soap.SoapFault;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.frontend.MethodDispatcher;
-import org.apache.cxf.headers.Header;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
-import org.apache.cxf.jaxws.context.WrappedMessageContext;
-import org.apache.cxf.message.Attachment;
-import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.FaultMode;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageContentsList;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.invoker.Invoker;
-import org.apache.cxf.service.model.BindingOperationInfo;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
-import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
-
-/**
- * An abstract CXF invoker
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author richard.opalka(a)jboss.com
- * @author alessio.soldano(a)jboss.com
- *
- * @see org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker
- */
-public abstract class AbstractInvoker implements Invoker
-{
- private static final Object[] NO_ARGS = new Object[]{};
- private Object targetBean;
- private WebServiceContextFactory contextFactory;
-
- public void setTargetBean(Object targetBean)
- {
- this.targetBean = targetBean;
- }
-
- public Object invoke(Exchange exchange, Object o)
- {
- // set up the webservice request context
- WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
-
- Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
-
- WebServiceContextImpl.setMessageContext(ctx);
-
- Object retObj = null;
- try
- {
- retObj = _invokeInternal(exchange, o, ctx);
-
- addHandlerProperties(ctx, handlerScopedStuff);
-
- //update the webservice response context
- updateWebServiceContext(exchange, ctx);
- }
- finally
- {
- //clear the WebServiceContextImpl's ThreadLocal variable
- WebServiceContextImpl.clear();
- }
-
- return new MessageContentsList(retObj);
- }
-
- private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx)
- {
- BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
- MethodDispatcher md = (MethodDispatcher)exchange.get(Service.class).get(MethodDispatcher.class.getName());
- Method m = md.getMethod(bop);
-
- Object[] params = NO_ARGS;
- List<Object> paramList = null;
- if (m.getParameterTypes().length != 0)
- {
- if (o instanceof List<?>)
- {
- paramList = CastUtils.cast((List<?>)o);
- params = paramList.toArray();
- }
- else
- {
- params = new Object[]{o};
- }
- }
-
- Endpoint ep = exchange.get(Endpoint.class);
- InvocationHandler invHandler = ep.getInvocationHandler();
-
- Invocation inv = invHandler.createInvocation();
- InvocationContext invContext = inv.getInvocationContext();
- invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
- invContext.addAttachment(MessageContext.class, ctx);
- invContext.setTargetBean(targetBean != null ? targetBean : ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
- inv.setJavaMethod(m);
- inv.setArgs(params);
-
- Object retObj = null;
- Bus threadBus = BusFactory.getThreadDefaultBus(false);
- try
- {
- invHandler.invoke(ep, inv);
- retObj = inv.getReturnValue();
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t == null) {
- t = e;
- }
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- for (Class<?> cl : m.getExceptionTypes()) {
- if (cl.isInstance(t)) {
- exchange.getInMessage().put(FaultMode.class,
- FaultMode.CHECKED_APPLICATION_FAULT);
- }
- }
-
- if (t instanceof Fault) {
- exchange.getInMessage().put(FaultMode.class,
- FaultMode.CHECKED_APPLICATION_FAULT);
- throw (Fault)t;
- }
- throw createFault(t, m, paramList, true);
- } catch (Fault f) {
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- throw f;
- } catch (Exception e) {
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- throw createFault(e, m, paramList, false);
- }
- finally
- {
- //make sure the right bus is restored after coming back from the endpoint method
- BusFactory.setThreadDefaultBus(threadBus);
- // JBWS-2486
- if (ep.getAttachment(Object.class) == null)
- {
- ep.addAttachment(Object.class, inv.getInvocationContext().getTargetBean());
- }
- }
-
- return retObj;
- }
-
- protected SOAPFaultException findSoapFaultException(Throwable ex) {
- if (ex instanceof SOAPFaultException) {
- return (SOAPFaultException)ex;
- }
- if (ex.getCause() != null) {
- return findSoapFaultException(ex.getCause());
- }
- return null;
- }
-
- protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) {
- //map the JAX-WS faults
- SOAPFaultException sfe = findSoapFaultException(ex);
- if (sfe != null) {
- SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
- sfe,
- sfe.getFault().getFaultCodeAsQName());
- fault.setRole(sfe.getFault().getFaultActor());
- fault.setDetail(sfe.getFault().getDetail());
-
- return fault;
- }
-
- return new Fault(ex);
- }
-
-
- protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
- {
- return getWebServiceContextFactory().newWebServiceContext(msgCtx);
- }
-
- protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx)
- {
- Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
- Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
- if (scopes != null)
- {
- for (Map.Entry<String, Scope> scope : scopes.entrySet())
- {
- if (scope.getValue() == Scope.HANDLER)
- {
- handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
- }
- }
- for (String key : handlerScopedStuff.keySet())
- {
- ctx.remove(key);
- }
- }
- return handlerScopedStuff;
- }
-
- protected void updateWebServiceContext(Exchange exchange, MessageContext ctx)
- {
- // Guard against wrong type associated with header list.
- // Need to copy header only if the message is going out.
- if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>)
- {
- List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
- if (list != null && !list.isEmpty()) {
- SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
- if (sm != null)
- {
- Iterator<?> iter = list.iterator();
- while (iter.hasNext())
- {
- sm.getHeaders().add((Header) iter.next());
- }
- }
- }
- }
- if (exchange.getOutMessage() != null)
- {
- Message out = exchange.getOutMessage();
- if (out.containsKey(Message.PROTOCOL_HEADERS))
- {
- Map<String, List<String>> heads = CastUtils
- .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS));
- if (heads.containsKey("Content-Type")) {
- List<String> ct = heads.get("Content-Type");
- exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0));
- heads.remove("Content-Type");
- }
- }
- Map<String, DataHandler> dataHandlers
- = CastUtils.cast((Map<?, ?>)out.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
- if (dataHandlers != null && !dataHandlers.isEmpty())
- {
- Collection<Attachment> attachments = out.getAttachments();
- if (attachments == null)
- {
- attachments = new ArrayList<Attachment>();
- out.setAttachments(attachments);
- }
- for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
- {
- Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
- attachments.add(att);
- }
- }
- out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
- }
- }
-
- private Message createResponseMessage(Exchange exchange)
- {
- if (exchange == null) {
- return null;
- }
- Message m = exchange.getOutMessage();
- if (m == null && !exchange.isOneWay())
- {
- org.apache.cxf.endpoint.Endpoint ep = exchange.get(org.apache.cxf.endpoint.Endpoint.class);
- m = ep.getBinding().createMessage();
- exchange.setOutMessage(m);
- }
- return m;
- }
-
- protected void addHandlerProperties(WrappedMessageContext ctx, Map<String, Object> handlerScopedStuff)
- {
- for (Map.Entry<String, Object> key : handlerScopedStuff.entrySet())
- {
- ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
- }
- }
-
- protected synchronized WebServiceContextFactory getWebServiceContextFactory()
- {
- if (contextFactory == null)
- {
- ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
- SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
- contextFactory = spiProvider.getSPI(WebServiceContextFactory.class, cl);
- }
- return contextFactory;
- }
-
-}
Deleted: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf;
-
-
-/**
- * An XFire invoker for EJB3
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author alessio.soldano(a)jboss.com
- * @since 21-May-2007
- */
-public class InvokerEJB3 extends AbstractInvoker
-{
- // TODO: remove this class
-}
Deleted: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf;
-
-
-/**
- * An CXF invoker for JSE
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author alessio.soldano(a)jboss.com
- * @since 21-May-2007
- */
-public class InvokerJSE extends AbstractInvoker
-{
- // TODO: remove this class
-}
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -0,0 +1,350 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.wsf.stack.cxf;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.attachment.AttachmentImpl;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.frontend.MethodDispatcher;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxws.context.WebServiceContextImpl;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.FaultMode;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.invoker.Invoker;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
+
+/**
+ * An abstract CXF invoker
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author richard.opalka(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
+ *
+ * @see org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker
+ */
+public final class JBossWSInvoker implements Invoker
+{
+ private static final Object[] NO_ARGS = new Object[]{};
+ private Object targetBean;
+ private WebServiceContextFactory contextFactory;
+
+ public void setTargetBean(Object targetBean)
+ {
+ this.targetBean = targetBean;
+ }
+
+ public Object invoke(Exchange exchange, Object o)
+ {
+ // set up the webservice request context
+ WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
+
+ Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
+
+ WebServiceContextImpl.setMessageContext(ctx);
+
+ Object retObj = null;
+ try
+ {
+ retObj = _invokeInternal(exchange, o, ctx);
+
+ addHandlerProperties(ctx, handlerScopedStuff);
+
+ //update the webservice response context
+ updateWebServiceContext(exchange, ctx);
+ }
+ finally
+ {
+ //clear the WebServiceContextImpl's ThreadLocal variable
+ WebServiceContextImpl.clear();
+ }
+
+ return new MessageContentsList(retObj);
+ }
+
+ private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx)
+ {
+ BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
+ MethodDispatcher md = (MethodDispatcher)exchange.get(Service.class).get(MethodDispatcher.class.getName());
+ Method m = md.getMethod(bop);
+
+ Object[] params = NO_ARGS;
+ List<Object> paramList = null;
+ if (m.getParameterTypes().length != 0)
+ {
+ if (o instanceof List<?>)
+ {
+ paramList = CastUtils.cast((List<?>)o);
+ params = paramList.toArray();
+ }
+ else
+ {
+ params = new Object[]{o};
+ }
+ }
+
+ Endpoint ep = exchange.get(Endpoint.class);
+ InvocationHandler invHandler = ep.getInvocationHandler();
+
+ Invocation inv = invHandler.createInvocation();
+ InvocationContext invContext = inv.getInvocationContext();
+ invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
+ invContext.addAttachment(MessageContext.class, ctx);
+ invContext.setTargetBean(targetBean != null ? targetBean : ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
+ inv.setJavaMethod(m);
+ inv.setArgs(params);
+
+ Object retObj = null;
+ Bus threadBus = BusFactory.getThreadDefaultBus(false);
+ try
+ {
+ invHandler.invoke(ep, inv);
+ retObj = inv.getReturnValue();
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t == null) {
+ t = e;
+ }
+ exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+ for (Class<?> cl : m.getExceptionTypes()) {
+ if (cl.isInstance(t)) {
+ exchange.getInMessage().put(FaultMode.class,
+ FaultMode.CHECKED_APPLICATION_FAULT);
+ }
+ }
+
+ if (t instanceof Fault) {
+ exchange.getInMessage().put(FaultMode.class,
+ FaultMode.CHECKED_APPLICATION_FAULT);
+ throw (Fault)t;
+ }
+ throw createFault(t, m, paramList, true);
+ } catch (Fault f) {
+ exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+ throw f;
+ } catch (Exception e) {
+ exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+ throw createFault(e, m, paramList, false);
+ }
+ finally
+ {
+ //make sure the right bus is restored after coming back from the endpoint method
+ BusFactory.setThreadDefaultBus(threadBus);
+ // JBWS-2486
+ if (ep.getAttachment(Object.class) == null)
+ {
+ ep.addAttachment(Object.class, inv.getInvocationContext().getTargetBean());
+ }
+ }
+
+ return retObj;
+ }
+
+ protected SOAPFaultException findSoapFaultException(Throwable ex) {
+ if (ex instanceof SOAPFaultException) {
+ return (SOAPFaultException)ex;
+ }
+ if (ex.getCause() != null) {
+ return findSoapFaultException(ex.getCause());
+ }
+ return null;
+ }
+
+ protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) {
+ //map the JAX-WS faults
+ SOAPFaultException sfe = findSoapFaultException(ex);
+ if (sfe != null) {
+ SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
+ sfe,
+ sfe.getFault().getFaultCodeAsQName());
+ fault.setRole(sfe.getFault().getFaultActor());
+ fault.setDetail(sfe.getFault().getDetail());
+
+ return fault;
+ }
+
+ return new Fault(ex);
+ }
+
+
+ protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
+ {
+ return getWebServiceContextFactory().newWebServiceContext(msgCtx);
+ }
+
+ protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx)
+ {
+ Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
+ Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
+ if (scopes != null)
+ {
+ for (Map.Entry<String, Scope> scope : scopes.entrySet())
+ {
+ if (scope.getValue() == Scope.HANDLER)
+ {
+ handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
+ }
+ }
+ for (String key : handlerScopedStuff.keySet())
+ {
+ ctx.remove(key);
+ }
+ }
+ return handlerScopedStuff;
+ }
+
+ protected void updateWebServiceContext(Exchange exchange, MessageContext ctx)
+ {
+ // Guard against wrong type associated with header list.
+ // Need to copy header only if the message is going out.
+ if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>)
+ {
+ List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
+ if (list != null && !list.isEmpty()) {
+ SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
+ if (sm != null)
+ {
+ Iterator<?> iter = list.iterator();
+ while (iter.hasNext())
+ {
+ sm.getHeaders().add((Header) iter.next());
+ }
+ }
+ }
+ }
+ if (exchange.getOutMessage() != null)
+ {
+ Message out = exchange.getOutMessage();
+ if (out.containsKey(Message.PROTOCOL_HEADERS))
+ {
+ Map<String, List<String>> heads = CastUtils
+ .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS));
+ if (heads.containsKey("Content-Type")) {
+ List<String> ct = heads.get("Content-Type");
+ exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0));
+ heads.remove("Content-Type");
+ }
+ }
+ Map<String, DataHandler> dataHandlers
+ = CastUtils.cast((Map<?, ?>)out.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+ if (dataHandlers != null && !dataHandlers.isEmpty())
+ {
+ Collection<Attachment> attachments = out.getAttachments();
+ if (attachments == null)
+ {
+ attachments = new ArrayList<Attachment>();
+ out.setAttachments(attachments);
+ }
+ for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
+ {
+ Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
+ attachments.add(att);
+ }
+ }
+ out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ }
+ }
+
+ private Message createResponseMessage(Exchange exchange)
+ {
+ if (exchange == null) {
+ return null;
+ }
+ Message m = exchange.getOutMessage();
+ if (m == null && !exchange.isOneWay())
+ {
+ org.apache.cxf.endpoint.Endpoint ep = exchange.get(org.apache.cxf.endpoint.Endpoint.class);
+ m = ep.getBinding().createMessage();
+ exchange.setOutMessage(m);
+ }
+ return m;
+ }
+
+ protected void addHandlerProperties(WrappedMessageContext ctx, Map<String, Object> handlerScopedStuff)
+ {
+ for (Map.Entry<String, Object> key : handlerScopedStuff.entrySet())
+ {
+ ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
+ }
+ }
+
+ protected synchronized WebServiceContextFactory getWebServiceContextFactory()
+ {
+ if (contextFactory == null)
+ {
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ contextFactory = spiProvider.getSPI(WebServiceContextFactory.class, cl);
+ }
+ return contextFactory;
+ }
+
+}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -35,7 +35,7 @@
import org.jboss.wsf.spi.management.ServerConfigFactory;
import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
import org.jboss.wsf.spi.metadata.config.ConfigRoot;
-import org.jboss.wsf.stack.cxf.AbstractInvoker;
+import org.jboss.wsf.stack.cxf.JBossWSInvoker;
import org.jboss.wsf.stack.cxf.client.configuration.BeanCustomizer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
@@ -67,9 +67,9 @@
{
ServerFactoryBean factory = (ServerFactoryBean) beanInstance;
- if (factory.getInvoker() instanceof AbstractInvoker)
+ if (factory.getInvoker() instanceof JBossWSInvoker)
{
- ((AbstractInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
+ ((JBossWSInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
}
if (depEndpoints != null)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -48,19 +48,6 @@
// provide logging
private static final Logger log = Logger.getLogger(DescriptorDeploymentAspect.class);
- private String invokerEJB3;
- private String invokerJSE;
-
- public void setInvokerEJB3(String invokerEJB3)
- {
- this.invokerEJB3 = invokerEJB3;
- }
-
- public void setInvokerJSE(String invokerJSE)
- {
- this.invokerJSE = invokerJSE;
- }
-
@Override
public void start(Deployment dep)
{
@@ -160,7 +147,7 @@
private DDBeans generateMetadataFromDeployment(Deployment dep)
{
MetadataBuilder builder = new MetadataBuilder();
- DDBeans dd = builder.build(dep, invokerEJB3, invokerJSE);
+ DDBeans dd = builder.build(dep);
dep.addAttachment(DDBeans.class, dd);
return dd;
}
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 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2011-06-21 10:38:54 UTC (rev 14595)
@@ -47,6 +47,7 @@
import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+import org.jboss.wsf.stack.cxf.JBossWSInvoker;
import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
@@ -66,9 +67,8 @@
}
- public DDBeans build(Deployment dep, String invokerEJB3, String invokerJSE)
+ public DDBeans build(Deployment dep)
{
- DeploymentType depType = dep.getType();
DDBeans dd = new DDBeans();
for (Endpoint ep : dep.getService().getEndpoints())
{
@@ -76,17 +76,8 @@
if (ep instanceof HttpEndpoint)
{
- if (depType == DeploymentType.JAXWS_EJB3)
- {
- ddep.setInvoker(invokerEJB3);
- }
-
- if (depType == DeploymentType.JAXWS_JSE)
- {
- ddep.setInvoker(invokerJSE);
- }
+ ddep.setInvoker(JBossWSInvoker.class.getName());
}
-
processWSDDContribution(ddep, (ArchiveDeployment)dep);
log.info("Add " + ddep);
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -49,8 +49,6 @@
<bean name="WSCXFDescriptorDeploymentAspect" class="org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect">
<property name="requires">EndpointAddress,JAXBIntros</property>
<property name="provides">StackDescriptor</property>
- <property name="invokerEJB3">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
- <property name="invokerJSE">org.jboss.wsf.stack.cxf.InvokerJSE</property>
<property name="forJaxRpc">false</property>
</bean>
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -40,8 +40,6 @@
<deploymentAspect class="org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect">
<property name="requires" class="java.lang.String">EndpointAddress,JAXBIntros</property>
<property name="provides" class="java.lang.String">StackDescriptor</property>
- <property name="invokerEJB3" class="java.lang.String">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
- <property name="invokerJSE" class="java.lang.String">org.jboss.wsf.stack.cxf.InvokerJSE</property>
<property name="forJaxRpc" class="boolean">false</property>
</deploymentAspect>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -20,7 +20,7 @@
<ref bean='aegis-service-factory' />
</jaxws:serviceFactory>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerJSE' />
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker' />
</jaxws:invoker>
</jaxws:endpoint>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -8,7 +8,7 @@
implementor='org.jboss.test.ws.jaxws.cxf.descriptor.DescriptorEndpointImpl'>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
</jaxws:invoker>
</jaxws:endpoint>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-doc/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -16,7 +16,7 @@
<jaxws:endpoint id='RMService' address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-doc' implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicDocEndpointImpl'>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
</jaxws:invoker>
<jaxws:features>
<p:policies>
@@ -25,4 +25,4 @@
</jaxws:features>
</jaxws:endpoint>
-</beans>
\ No newline at end of file
+</beans>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -16,7 +16,7 @@
<jaxws:endpoint id='TestService' address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-rpc' implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicRPCEndpointImpl'>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
</jaxws:invoker>
<jaxws:features>
<p:policies>
@@ -25,4 +25,4 @@
</jaxws:features>
</jaxws:endpoint>
-</beans>
\ No newline at end of file
+</beans>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -12,7 +12,7 @@
implementor='org.jboss.test.ws.jaxws.samples.jmstransport.OrganizationHttpEndpoint'
>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
</jaxws:invoker>
</jaxws:endpoint>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -44,7 +44,7 @@
address='http://@jboss.bind.address@:8080/jaxws-samples-wsse-sign-encrypt'
implementor='org.jboss.test.ws.jaxws.samples.wsse.ServiceImpl'>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
</jaxws:invoker>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml 2011-06-21 10:38:54 UTC (rev 14595)
@@ -27,7 +27,7 @@
address='http://@jboss.bind.address@:8080/jaxws-samples-wsseEJB/EjbEndpointService/EjbEndpoint'
implementor='org.jboss.test.ws.jaxws.samples.wsseEJB.EjbEndpointImpl'>
<jaxws:invoker>
- <bean class='org.jboss.wsf.stack.cxf.InvokerEJB3'/>
+ <bean class='org.jboss.wsf.stack.cxf.JBossWSInvoker'/>
</jaxws:invoker>
<jaxws:inInterceptors>
<ref bean="SecurityContextIn"/>
13 years, 7 months
JBossWS SVN: r14594 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf/configuration and 10 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-06-21 05:46:03 -0400 (Tue, 21 Jun 2011)
New Revision: 14594
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java
Removed:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInvoker.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
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/services/DDEndpoint.java
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml
Log:
rollback previous commit
Copied: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java (from rev 14588, stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java)
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -0,0 +1,350 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.wsf.stack.cxf;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.attachment.AttachmentImpl;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.frontend.MethodDispatcher;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxws.context.WebServiceContextImpl;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.FaultMode;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.invoker.Invoker;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
+
+/**
+ * An abstract CXF invoker
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author richard.opalka(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
+ *
+ * @see org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker
+ */
+public abstract class AbstractInvoker implements Invoker
+{
+ private static final Object[] NO_ARGS = new Object[]{};
+ private Object targetBean;
+ private WebServiceContextFactory contextFactory;
+
+ public void setTargetBean(Object targetBean)
+ {
+ this.targetBean = targetBean;
+ }
+
+ public Object invoke(Exchange exchange, Object o)
+ {
+ // set up the webservice request context
+ WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
+
+ Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
+
+ WebServiceContextImpl.setMessageContext(ctx);
+
+ Object retObj = null;
+ try
+ {
+ retObj = _invokeInternal(exchange, o, ctx);
+
+ addHandlerProperties(ctx, handlerScopedStuff);
+
+ //update the webservice response context
+ updateWebServiceContext(exchange, ctx);
+ }
+ finally
+ {
+ //clear the WebServiceContextImpl's ThreadLocal variable
+ WebServiceContextImpl.clear();
+ }
+
+ return new MessageContentsList(retObj);
+ }
+
+ private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx)
+ {
+ BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
+ MethodDispatcher md = (MethodDispatcher)exchange.get(Service.class).get(MethodDispatcher.class.getName());
+ Method m = md.getMethod(bop);
+
+ Object[] params = NO_ARGS;
+ List<Object> paramList = null;
+ if (m.getParameterTypes().length != 0)
+ {
+ if (o instanceof List<?>)
+ {
+ paramList = CastUtils.cast((List<?>)o);
+ params = paramList.toArray();
+ }
+ else
+ {
+ params = new Object[]{o};
+ }
+ }
+
+ Endpoint ep = exchange.get(Endpoint.class);
+ InvocationHandler invHandler = ep.getInvocationHandler();
+
+ Invocation inv = invHandler.createInvocation();
+ InvocationContext invContext = inv.getInvocationContext();
+ invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
+ invContext.addAttachment(MessageContext.class, ctx);
+ invContext.setTargetBean(targetBean != null ? targetBean : ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
+ inv.setJavaMethod(m);
+ inv.setArgs(params);
+
+ Object retObj = null;
+ Bus threadBus = BusFactory.getThreadDefaultBus(false);
+ try
+ {
+ invHandler.invoke(ep, inv);
+ retObj = inv.getReturnValue();
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t == null) {
+ t = e;
+ }
+ exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+ for (Class<?> cl : m.getExceptionTypes()) {
+ if (cl.isInstance(t)) {
+ exchange.getInMessage().put(FaultMode.class,
+ FaultMode.CHECKED_APPLICATION_FAULT);
+ }
+ }
+
+ if (t instanceof Fault) {
+ exchange.getInMessage().put(FaultMode.class,
+ FaultMode.CHECKED_APPLICATION_FAULT);
+ throw (Fault)t;
+ }
+ throw createFault(t, m, paramList, true);
+ } catch (Fault f) {
+ exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+ throw f;
+ } catch (Exception e) {
+ exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
+ throw createFault(e, m, paramList, false);
+ }
+ finally
+ {
+ //make sure the right bus is restored after coming back from the endpoint method
+ BusFactory.setThreadDefaultBus(threadBus);
+ // JBWS-2486
+ if (ep.getAttachment(Object.class) == null)
+ {
+ ep.addAttachment(Object.class, inv.getInvocationContext().getTargetBean());
+ }
+ }
+
+ return retObj;
+ }
+
+ protected SOAPFaultException findSoapFaultException(Throwable ex) {
+ if (ex instanceof SOAPFaultException) {
+ return (SOAPFaultException)ex;
+ }
+ if (ex.getCause() != null) {
+ return findSoapFaultException(ex.getCause());
+ }
+ return null;
+ }
+
+ protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) {
+ //map the JAX-WS faults
+ SOAPFaultException sfe = findSoapFaultException(ex);
+ if (sfe != null) {
+ SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
+ sfe,
+ sfe.getFault().getFaultCodeAsQName());
+ fault.setRole(sfe.getFault().getFaultActor());
+ fault.setDetail(sfe.getFault().getDetail());
+
+ return fault;
+ }
+
+ return new Fault(ex);
+ }
+
+
+ protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
+ {
+ return getWebServiceContextFactory().newWebServiceContext(msgCtx);
+ }
+
+ protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx)
+ {
+ Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
+ Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
+ if (scopes != null)
+ {
+ for (Map.Entry<String, Scope> scope : scopes.entrySet())
+ {
+ if (scope.getValue() == Scope.HANDLER)
+ {
+ handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
+ }
+ }
+ for (String key : handlerScopedStuff.keySet())
+ {
+ ctx.remove(key);
+ }
+ }
+ return handlerScopedStuff;
+ }
+
+ protected void updateWebServiceContext(Exchange exchange, MessageContext ctx)
+ {
+ // Guard against wrong type associated with header list.
+ // Need to copy header only if the message is going out.
+ if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>)
+ {
+ List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
+ if (list != null && !list.isEmpty()) {
+ SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
+ if (sm != null)
+ {
+ Iterator<?> iter = list.iterator();
+ while (iter.hasNext())
+ {
+ sm.getHeaders().add((Header) iter.next());
+ }
+ }
+ }
+ }
+ if (exchange.getOutMessage() != null)
+ {
+ Message out = exchange.getOutMessage();
+ if (out.containsKey(Message.PROTOCOL_HEADERS))
+ {
+ Map<String, List<String>> heads = CastUtils
+ .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS));
+ if (heads.containsKey("Content-Type")) {
+ List<String> ct = heads.get("Content-Type");
+ exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0));
+ heads.remove("Content-Type");
+ }
+ }
+ Map<String, DataHandler> dataHandlers
+ = CastUtils.cast((Map<?, ?>)out.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+ if (dataHandlers != null && !dataHandlers.isEmpty())
+ {
+ Collection<Attachment> attachments = out.getAttachments();
+ if (attachments == null)
+ {
+ attachments = new ArrayList<Attachment>();
+ out.setAttachments(attachments);
+ }
+ for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
+ {
+ Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
+ attachments.add(att);
+ }
+ }
+ out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ }
+ }
+
+ private Message createResponseMessage(Exchange exchange)
+ {
+ if (exchange == null) {
+ return null;
+ }
+ Message m = exchange.getOutMessage();
+ if (m == null && !exchange.isOneWay())
+ {
+ org.apache.cxf.endpoint.Endpoint ep = exchange.get(org.apache.cxf.endpoint.Endpoint.class);
+ m = ep.getBinding().createMessage();
+ exchange.setOutMessage(m);
+ }
+ return m;
+ }
+
+ protected void addHandlerProperties(WrappedMessageContext ctx, Map<String, Object> handlerScopedStuff)
+ {
+ for (Map.Entry<String, Object> key : handlerScopedStuff.entrySet())
+ {
+ ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
+ }
+ }
+
+ protected synchronized WebServiceContextFactory getWebServiceContextFactory()
+ {
+ if (contextFactory == null)
+ {
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ contextFactory = spiProvider.getSPI(WebServiceContextFactory.class, cl);
+ }
+ return contextFactory;
+ }
+
+}
Deleted: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInvoker.java 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInvoker.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -1,350 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jboss.wsf.stack.cxf;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-import javax.xml.ws.soap.SOAPFaultException;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.attachment.AttachmentImpl;
-import org.apache.cxf.binding.soap.SoapFault;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.frontend.MethodDispatcher;
-import org.apache.cxf.headers.Header;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
-import org.apache.cxf.jaxws.context.WrappedMessageContext;
-import org.apache.cxf.message.Attachment;
-import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.FaultMode;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageContentsList;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.invoker.Invoker;
-import org.apache.cxf.service.model.BindingOperationInfo;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
-import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
-
-/**
- * An abstract CXF invoker
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author richard.opalka(a)jboss.com
- * @author alessio.soldano(a)jboss.com
- *
- * @see org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker
- */
-public final class CXFInvoker implements Invoker
-{
- private static final Object[] NO_ARGS = new Object[]{};
- private Object targetBean;
- private WebServiceContextFactory contextFactory;
-
- public void setTargetBean(Object targetBean)
- {
- this.targetBean = targetBean;
- }
-
- public Object invoke(Exchange exchange, Object o)
- {
- // set up the webservice request context
- WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
-
- Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
-
- WebServiceContextImpl.setMessageContext(ctx);
-
- Object retObj = null;
- try
- {
- retObj = _invokeInternal(exchange, o, ctx);
-
- addHandlerProperties(ctx, handlerScopedStuff);
-
- //update the webservice response context
- updateWebServiceContext(exchange, ctx);
- }
- finally
- {
- //clear the WebServiceContextImpl's ThreadLocal variable
- WebServiceContextImpl.clear();
- }
-
- return new MessageContentsList(retObj);
- }
-
- private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx)
- {
- BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
- MethodDispatcher md = (MethodDispatcher)exchange.get(Service.class).get(MethodDispatcher.class.getName());
- Method m = md.getMethod(bop);
-
- Object[] params = NO_ARGS;
- List<Object> paramList = null;
- if (m.getParameterTypes().length != 0)
- {
- if (o instanceof List<?>)
- {
- paramList = CastUtils.cast((List<?>)o);
- params = paramList.toArray();
- }
- else
- {
- params = new Object[]{o};
- }
- }
-
- Endpoint ep = exchange.get(Endpoint.class);
- InvocationHandler invHandler = ep.getInvocationHandler();
-
- Invocation inv = invHandler.createInvocation();
- InvocationContext invContext = inv.getInvocationContext();
- invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
- invContext.addAttachment(MessageContext.class, ctx);
- invContext.setTargetBean(targetBean != null ? targetBean : ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
- inv.setJavaMethod(m);
- inv.setArgs(params);
-
- Object retObj = null;
- Bus threadBus = BusFactory.getThreadDefaultBus(false);
- try
- {
- invHandler.invoke(ep, inv);
- retObj = inv.getReturnValue();
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t == null) {
- t = e;
- }
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- for (Class<?> cl : m.getExceptionTypes()) {
- if (cl.isInstance(t)) {
- exchange.getInMessage().put(FaultMode.class,
- FaultMode.CHECKED_APPLICATION_FAULT);
- }
- }
-
- if (t instanceof Fault) {
- exchange.getInMessage().put(FaultMode.class,
- FaultMode.CHECKED_APPLICATION_FAULT);
- throw (Fault)t;
- }
- throw createFault(t, m, paramList, true);
- } catch (Fault f) {
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- throw f;
- } catch (Exception e) {
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- throw createFault(e, m, paramList, false);
- }
- finally
- {
- //make sure the right bus is restored after coming back from the endpoint method
- BusFactory.setThreadDefaultBus(threadBus);
- // JBWS-2486
- if (ep.getAttachment(Object.class) == null)
- {
- ep.addAttachment(Object.class, inv.getInvocationContext().getTargetBean());
- }
- }
-
- return retObj;
- }
-
- protected SOAPFaultException findSoapFaultException(Throwable ex) {
- if (ex instanceof SOAPFaultException) {
- return (SOAPFaultException)ex;
- }
- if (ex.getCause() != null) {
- return findSoapFaultException(ex.getCause());
- }
- return null;
- }
-
- protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) {
- //map the JAX-WS faults
- SOAPFaultException sfe = findSoapFaultException(ex);
- if (sfe != null) {
- SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
- sfe,
- sfe.getFault().getFaultCodeAsQName());
- fault.setRole(sfe.getFault().getFaultActor());
- fault.setDetail(sfe.getFault().getDetail());
-
- return fault;
- }
-
- return new Fault(ex);
- }
-
-
- protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
- {
- return getWebServiceContextFactory().newWebServiceContext(msgCtx);
- }
-
- protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx)
- {
- Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
- Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
- if (scopes != null)
- {
- for (Map.Entry<String, Scope> scope : scopes.entrySet())
- {
- if (scope.getValue() == Scope.HANDLER)
- {
- handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
- }
- }
- for (String key : handlerScopedStuff.keySet())
- {
- ctx.remove(key);
- }
- }
- return handlerScopedStuff;
- }
-
- protected void updateWebServiceContext(Exchange exchange, MessageContext ctx)
- {
- // Guard against wrong type associated with header list.
- // Need to copy header only if the message is going out.
- if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>)
- {
- List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
- if (list != null && !list.isEmpty()) {
- SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
- if (sm != null)
- {
- Iterator<?> iter = list.iterator();
- while (iter.hasNext())
- {
- sm.getHeaders().add((Header) iter.next());
- }
- }
- }
- }
- if (exchange.getOutMessage() != null)
- {
- Message out = exchange.getOutMessage();
- if (out.containsKey(Message.PROTOCOL_HEADERS))
- {
- Map<String, List<String>> heads = CastUtils
- .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS));
- if (heads.containsKey("Content-Type")) {
- List<String> ct = heads.get("Content-Type");
- exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0));
- heads.remove("Content-Type");
- }
- }
- Map<String, DataHandler> dataHandlers
- = CastUtils.cast((Map<?, ?>)out.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
- if (dataHandlers != null && !dataHandlers.isEmpty())
- {
- Collection<Attachment> attachments = out.getAttachments();
- if (attachments == null)
- {
- attachments = new ArrayList<Attachment>();
- out.setAttachments(attachments);
- }
- for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
- {
- Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
- attachments.add(att);
- }
- }
- out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
- }
- }
-
- private Message createResponseMessage(Exchange exchange)
- {
- if (exchange == null) {
- return null;
- }
- Message m = exchange.getOutMessage();
- if (m == null && !exchange.isOneWay())
- {
- org.apache.cxf.endpoint.Endpoint ep = exchange.get(org.apache.cxf.endpoint.Endpoint.class);
- m = ep.getBinding().createMessage();
- exchange.setOutMessage(m);
- }
- return m;
- }
-
- protected void addHandlerProperties(WrappedMessageContext ctx, Map<String, Object> handlerScopedStuff)
- {
- for (Map.Entry<String, Object> key : handlerScopedStuff.entrySet())
- {
- ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
- }
- }
-
- protected WebServiceContextFactory getWebServiceContextFactory()
- {
- if (contextFactory == null)
- {
- ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
- SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
- contextFactory = spiProvider.getSPI(WebServiceContextFactory.class, cl);
- }
- return contextFactory;
- }
-
-}
Copied: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java (from rev 14588, stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java)
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf;
+
+
+/**
+ * An XFire invoker for EJB3
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
+ * @since 21-May-2007
+ */
+public class InvokerEJB3 extends AbstractInvoker
+{
+ // TODO: remove this class
+}
Copied: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java (from rev 14588, stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java)
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf;
+
+
+/**
+ * An CXF invoker for JSE
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
+ * @since 21-May-2007
+ */
+public class InvokerJSE extends AbstractInvoker
+{
+ // TODO: remove this class
+}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -40,7 +40,6 @@
import org.jboss.ws.api.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.stack.cxf.CXFInvoker;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSNonSpringBusFactory;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSNonSpringConfigurer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
@@ -92,7 +91,7 @@
for (DDEndpoint dde : metadata.getEndpoints())
{
EndpointImpl endpoint = new EndpointImpl(bus, newInstance(dde.getImplementor()));
- endpoint.setInvoker(new CXFInvoker());
+ endpoint.setInvoker((Invoker) newInstance(dde.getInvoker()));
endpoint.setAddress(dde.getAddress());
endpoint.setEndpointName(dde.getPortName());
endpoint.setServiceName(dde.getServiceName());
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -35,7 +35,7 @@
import org.jboss.wsf.spi.management.ServerConfigFactory;
import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
import org.jboss.wsf.spi.metadata.config.ConfigRoot;
-import org.jboss.wsf.stack.cxf.CXFInvoker;
+import org.jboss.wsf.stack.cxf.AbstractInvoker;
import org.jboss.wsf.stack.cxf.client.configuration.BeanCustomizer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
@@ -67,9 +67,9 @@
{
ServerFactoryBean factory = (ServerFactoryBean) beanInstance;
- if (factory.getInvoker() instanceof CXFInvoker)
+ if (factory.getInvoker() instanceof AbstractInvoker)
{
- ((CXFInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
+ ((AbstractInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
}
if (depEndpoints != null)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -48,6 +48,19 @@
// provide logging
private static final Logger log = Logger.getLogger(DescriptorDeploymentAspect.class);
+ private String invokerEJB3;
+ private String invokerJSE;
+
+ public void setInvokerEJB3(String invokerEJB3)
+ {
+ this.invokerEJB3 = invokerEJB3;
+ }
+
+ public void setInvokerJSE(String invokerJSE)
+ {
+ this.invokerJSE = invokerJSE;
+ }
+
@Override
public void start(Deployment dep)
{
@@ -147,7 +160,7 @@
private DDBeans generateMetadataFromDeployment(Deployment dep)
{
MetadataBuilder builder = new MetadataBuilder();
- DDBeans dd = builder.build(dep);
+ DDBeans dd = builder.build(dep, invokerEJB3, invokerJSE);
dep.addAttachment(DDBeans.class, dd);
return dd;
}
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 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -37,7 +37,9 @@
import org.jboss.ws.common.JavaUtils;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.HttpEndpoint;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
@@ -64,12 +66,27 @@
}
- public DDBeans build(Deployment dep)
+ public DDBeans build(Deployment dep, String invokerEJB3, String invokerJSE)
{
+ DeploymentType depType = dep.getType();
DDBeans dd = new DDBeans();
for (Endpoint ep : dep.getService().getEndpoints())
{
DDEndpoint ddep = createDDEndpoint(ep.getTargetBeanClass(), (ArchiveDeployment)dep, ep);
+
+ if (ep instanceof HttpEndpoint)
+ {
+ if (depType == DeploymentType.JAXWS_EJB3)
+ {
+ ddep.setInvoker(invokerEJB3);
+ }
+
+ if (depType == DeploymentType.JAXWS_JSE)
+ {
+ ddep.setInvoker(invokerJSE);
+ }
+ }
+
processWSDDContribution(ddep, (ArchiveDeployment)dep);
log.info("Add " + ddep);
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2011-06-21 09:46:03 UTC (rev 14594)
@@ -44,6 +44,8 @@
private String implementor;
+ private String invoker;
+
private boolean mtomEnabled;
private int mtomThreshold;
@@ -141,6 +143,11 @@
this.epClass = epClass;
}
+ public String getInvoker()
+ {
+ return invoker;
+ }
+
public List<String> getHandlers()
{
return handlers;
@@ -151,6 +158,11 @@
return mtomEnabled;
}
+ public void setInvoker(String invoker)
+ {
+ this.invoker = invoker;
+ }
+
public void setHandlers(List<String> handlers)
{
this.handlers = handlers;
@@ -264,6 +276,11 @@
}
+ if (this.invoker != null)
+ {
+ writer.write("<jaxws:invoker><bean class='" + this.invoker + "'/></jaxws:invoker>");
+ }
+
if (this.handlers != null && !this.handlers.isEmpty())
{
writer.write("<jaxws:handlers>");
@@ -304,6 +321,7 @@
str.append("\n id=" + this.id);
str.append("\n address=" + this.address);
str.append("\n implementor=" + this.implementor);
+ str.append("\n invoker=" + this.invoker);
str.append("\n serviceName=" + this.serviceName);
str.append("\n portName=" + this.portName);
str.append("\n wsdlLocation=" + this.wsdlLocation);
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -49,6 +49,8 @@
<bean name="WSCXFDescriptorDeploymentAspect" class="org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect">
<property name="requires">EndpointAddress,JAXBIntros</property>
<property name="provides">StackDescriptor</property>
+ <property name="invokerEJB3">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
+ <property name="invokerJSE">org.jboss.wsf.stack.cxf.InvokerJSE</property>
<property name="forJaxRpc">false</property>
</bean>
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -40,6 +40,8 @@
<deploymentAspect class="org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect">
<property name="requires" class="java.lang.String">EndpointAddress,JAXBIntros</property>
<property name="provides" class="java.lang.String">StackDescriptor</property>
+ <property name="invokerEJB3" class="java.lang.String">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
+ <property name="invokerJSE" class="java.lang.String">org.jboss.wsf.stack.cxf.InvokerJSE</property>
<property name="forJaxRpc" class="boolean">false</property>
</deploymentAspect>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/aegis/jaxws/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -19,6 +19,9 @@
<jaxws:serviceFactory>
<ref bean='aegis-service-factory' />
</jaxws:serviceFactory>
+ <jaxws:invoker>
+ <bean class='org.jboss.wsf.stack.cxf.InvokerJSE' />
+ </jaxws:invoker>
</jaxws:endpoint>
</beans>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/descriptor/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -6,6 +6,11 @@
<jaxws:endpoint id='TestService' address='http://@jboss.bind.address@:8080/jaxws-cxf-descriptor'
implementor='org.jboss.test.ws.jaxws.cxf.descriptor.DescriptorEndpointImpl'>
+
+ <jaxws:invoker>
+ <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ </jaxws:invoker>
+
</jaxws:endpoint>
</beans>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/wsrm/basic-rpc/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -15,6 +15,9 @@
</wsp:Policy>
<jaxws:endpoint id='TestService' address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-rpc' implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicRPCEndpointImpl'>
+ <jaxws:invoker>
+ <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ </jaxws:invoker>
<jaxws:features>
<p:policies>
<wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>
@@ -22,4 +25,4 @@
</jaxws:features>
</jaxws:endpoint>
-</beans>
+</beans>
\ No newline at end of file
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmstransport/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -9,7 +9,11 @@
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml"/>
<jaxws:endpoint id='SOAPQueryService'
- implementor='org.jboss.test.ws.jaxws.samples.jmstransport.OrganizationHttpEndpoint'>
+ implementor='org.jboss.test.ws.jaxws.samples.jmstransport.OrganizationHttpEndpoint'
+ >
+ <jaxws:invoker>
+ <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ </jaxws:invoker>
</jaxws:endpoint>
<jaxws:endpoint id='JMSQueryService'
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsse/sign-encrypt/WEB-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -43,6 +43,9 @@
id='ServiceImpl'
address='http://@jboss.bind.address@:8080/jaxws-samples-wsse-sign-encrypt'
implementor='org.jboss.test.ws.jaxws.samples.wsse.ServiceImpl'>
+ <jaxws:invoker>
+ <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
+ </jaxws:invoker>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
<ref bean="Sign_Response"/>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml 2011-06-21 06:13:28 UTC (rev 14593)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/wsseEJB/META-INF/jbossws-cxf.xml 2011-06-21 09:46:03 UTC (rev 14594)
@@ -26,6 +26,9 @@
id='EjbEndpointImpl'
address='http://@jboss.bind.address@:8080/jaxws-samples-wsseEJB/EjbEndpointService/EjbEndpoint'
implementor='org.jboss.test.ws.jaxws.samples.wsseEJB.EjbEndpointImpl'>
+ <jaxws:invoker>
+ <bean class='org.jboss.wsf.stack.cxf.InvokerEJB3'/>
+ </jaxws:invoker>
<jaxws:inInterceptors>
<ref bean="SecurityContextIn"/>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
13 years, 7 months
JBossWS SVN: r14593 - in api/trunk: src/main/java/org/jboss/ws/api/annotation and 7 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-06-21 02:13:28 -0400 (Tue, 21 Jun 2011)
New Revision: 14593
Added:
api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties
api/trunk/src/main/java/org/jboss/ws/api/util/BundleUtils.java
api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties
api/trunk/src/test/java/org/
api/trunk/src/test/java/org/jboss/
api/trunk/src/test/java/org/jboss/ws/
api/trunk/src/test/java/org/jboss/ws/api/
api/trunk/src/test/java/org/jboss/ws/api/util/
api/trunk/src/test/java/org/jboss/ws/api/util/BundleUtilsTest.java
api/trunk/src/test/java/org/jboss/ws/api/util/Message_fr.properties
Modified:
api/trunk/pom.xml
api/trunk/src/main/java/org/jboss/ws/api/annotation/AuthMethod.java
api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java
Log:
[JBWS-3316]:i18n logging and message
Modified: api/trunk/pom.xml
===================================================================
--- api/trunk/pom.xml 2011-06-20 22:52:35 UTC (rev 14592)
+++ api/trunk/pom.xml 2011-06-21 06:13:28 UTC (rev 14593)
@@ -25,6 +25,7 @@
<properties>
<jboss-logging-spi.version>2.0.5.GA</jboss-logging-spi.version>
+ <junit.version>3.8.2</junit.version>
</properties>
<!-- Dependencies -->
@@ -37,10 +38,37 @@
<version>${jboss-logging-spi.version}</version>
<scope>provided</scope>
</dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<!-- Plugins -->
<build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </testResource>
+ </testResources>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Modified: api/trunk/src/main/java/org/jboss/ws/api/annotation/AuthMethod.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/annotation/AuthMethod.java 2011-06-20 22:52:35 UTC (rev 14592)
+++ api/trunk/src/main/java/org/jboss/ws/api/annotation/AuthMethod.java 2011-06-21 06:13:28 UTC (rev 14593)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.api.annotation;
+import java.util.ResourceBundle;
+
import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
/**
* The authMethod is used to configure the authentication mechanism for the web service.
@@ -33,6 +36,7 @@
public final class AuthMethod
{
private static final Logger log = Logger.getLogger(AuthMethod.class);
+ private static final ResourceBundle bundle = BundleUtils.getBundle(AuthMethod.class);
/**
* Basic authentication.
@@ -73,11 +77,11 @@
{
return AuthMethod.CLIENT_CERT;
}
- log.warn("Non-standard auth method value: " + s);
+ log.warn(BundleUtils.getMessage(bundle, "NON_STANDARD_METHOD", s));
return s;
}
- throw new IllegalArgumentException("Illegal auth method value: " + s);
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ILLEGAL_AUTH_METHOD", s));
}
}
Added: api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties (rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties 2011-06-21 06:13:28 UTC (rev 14593)
@@ -0,0 +1,2 @@
+NON_STANDARD_METHOD=Non-standard auth method value : {0}
+ILLEGAL_AUTH_METHOD= Illegal auth method : {0}
\ No newline at end of file
Added: api/trunk/src/main/java/org/jboss/ws/api/util/BundleUtils.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/util/BundleUtils.java (rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/util/BundleUtils.java 2011-06-21 06:13:28 UTC (rev 14593)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.api.util;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+/**
+ * Utility class to get resource bundle and i18n message
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public final class BundleUtils {
+ private static final String BUNDLE_FILE_NAME = ".Message";
+
+ private BundleUtils() {
+ }
+
+ /**Get resource bundle with a class
+ * @param cls the class to find the resource bundle
+ * @return ResourceBundle if exists, otherwise null
+ */
+ public static ResourceBundle getBundle(Class<?> cls)
+ {
+ String bundleName = cls.getPackage().getName() + BUNDLE_FILE_NAME;
+ try
+ {
+ return ResourceBundle.getBundle(bundleName, Locale.getDefault(), cls.getClassLoader());
+ }
+ catch (MissingResourceException ex)
+ {
+ return ResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread()
+ .getContextClassLoader());
+
+ }
+ }
+
+ /**
+ * Get the i18n string message with an associated resource bundle
+ * @param bundle resourceBundle
+ * @param key the key for the desired string
+ * @param params the message substitution parameters
+ * @return the formated string for the given key
+ */
+ public static String getMessage(ResourceBundle bundle, String key, Object... params)
+ {
+ String fmt = null;
+ try
+ {
+ if (null == bundle)
+ {
+ return key;
+ }
+ fmt = bundle.getString(key);
+ }
+ catch (MissingResourceException ex)
+ {
+ return key;
+ }
+ return MessageFormat.format(fmt, params);
+ }
+}
Modified: api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java 2011-06-20 22:52:35 UTC (rev 14592)
+++ api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java 2011-06-21 06:13:28 UTC (rev 14593)
@@ -31,6 +31,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.ResourceBundle;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
@@ -64,6 +65,7 @@
public abstract class DOMUtils
{
private static Logger log = Logger.getLogger(DOMUtils.class);
+ private static ResourceBundle bundle = BundleUtils.getBundle(DOMUtils.class);
/** Get the qname of the given node.
*/
@@ -567,6 +569,7 @@
}
catch (IOException e)
{
+ log.error(BundleUtils.getMessage(bundle, "CAN_NOT_PARSE", xmlString));
log.error("Cannot parse: " + xmlString);
throw e;
}
Added: api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties (rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties 2011-06-21 06:13:28 UTC (rev 14593)
@@ -0,0 +1 @@
+CAN_NOT_PARSE = Cannot parse: {0}
\ No newline at end of file
Added: api/trunk/src/test/java/org/jboss/ws/api/util/BundleUtilsTest.java
===================================================================
--- api/trunk/src/test/java/org/jboss/ws/api/util/BundleUtilsTest.java (rev 0)
+++ api/trunk/src/test/java/org/jboss/ws/api/util/BundleUtilsTest.java 2011-06-21 06:13:28 UTC (rev 14593)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.api.util;
+
+import java.util.Locale;
+
+import junit.framework.TestCase;
+
+public class BundleUtilsTest extends TestCase
+{
+ public void testI18NMessage() throws Exception
+ {
+ String message = BundleUtils.getMessage(BundleUtils.getBundle(this.getClass()), "CAN_NOT_PARSE", "file");
+ assertTrue("English error message is expected", message.indexOf("Cannot parse") > -1);
+ Locale.setDefault(java.util.Locale.FRANCE);
+ message = BundleUtils.getMessage(BundleUtils.getBundle(this.getClass()), "CAN_NOT_PARSE", "file");
+ assertTrue("French error message is expected", message.contains("ne peut pas analyser"));
+ }
+}
Added: api/trunk/src/test/java/org/jboss/ws/api/util/Message_fr.properties
===================================================================
--- api/trunk/src/test/java/org/jboss/ws/api/util/Message_fr.properties (rev 0)
+++ api/trunk/src/test/java/org/jboss/ws/api/util/Message_fr.properties 2011-06-21 06:13:28 UTC (rev 14593)
@@ -0,0 +1 @@
+CAN_NOT_PARSE = ne peut pas analyser: {0}
\ No newline at end of file
13 years, 7 months
JBossWS SVN: r14592 - stack/native/branches/jbossws-native-3.1.2.
by jbossws-commits@lists.jboss.org
Author: klape
Date: 2011-06-20 18:52:35 -0400 (Mon, 20 Jun 2011)
New Revision: 14592
Modified:
stack/native/branches/jbossws-native-3.1.2/pom.xml
Log:
[JBPAPP-6389] Shouldn't have checked in my modified pom.xml
Modified: stack/native/branches/jbossws-native-3.1.2/pom.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/pom.xml 2011-06-20 22:49:01 UTC (rev 14591)
+++ stack/native/branches/jbossws-native-3.1.2/pom.xml 2011-06-20 22:52:35 UTC (rev 14592)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<!-- ====================================================================== -->
<!-- -->
<!-- JBoss, the OpenSource J2EE webOS -->
@@ -7,25 +8,31 @@
<!-- See terms of license at http://www.gnu.org. -->
<!-- -->
<!-- ====================================================================== -->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<name>JBoss Web Services - Stack Native</name>
<groupId>org.jboss.ws.native</groupId>
<artifactId>jbossws-native</artifactId>
<packaging>pom</packaging>
+
<version>3.1.2-SNAPSHOT</version>
+
<!-- Parent -->
<parent>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-parent</artifactId>
<version>1.0.8.GA</version>
</parent>
+
<!-- Source Control Management -->
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/stack/native/branches/jbos...</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/stack/native/branches/jbossws...</developerConnection>
<url>http://fisheye.jboss.com/viewrep/JBossWS/stack/native/branches/jbossws-na...</url>
</scm>
+
<!-- Modules -->
<modules>
<module>modules/endorsed</module>
@@ -34,11 +41,12 @@
<module>modules/management</module>
<module>modules/resources</module>
</modules>
+
<!-- Properties -->
<properties>
- <jbossws.common.version>1.1.0</jbossws.common.version>
- <jbossws.framework.version>3.1.2</jbossws.framework.version>
- <jbossws.spi.version>1.1.2</jbossws.spi.version>
+ <jbossws.common.version>1.1.0-SNAPSHOT</jbossws.common.version>
+ <jbossws.framework.version>3.1.2-SNAPSHOT</jbossws.framework.version>
+ <jbossws.spi.version>1.1.2-SNAPSHOT</jbossws.spi.version>
<!-- [JBWS-2505] -->
<!-- START -->
<!--
@@ -69,6 +77,7 @@
<xalan.version>2.7.1.patch02</xalan.version>
<xerces.version>2.9.1</xerces.version>
</properties>
+
<!-- DependencyManagement -->
<dependencyManagement>
<dependencies>
@@ -264,40 +273,40 @@
<type>sar</type>
<exclusions>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-jmx</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-system-jmx</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system-jmx</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2se</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2se</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-system</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
</exclusion>
<exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss.jbossws</groupId>
- <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ <artifactId>jboss-jaxrpc</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss.jbossws</groupId>
- <artifactId>jboss-saaj</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ <artifactId>jboss-saaj</artifactId>
</exclusion>
<!--
<exclusion>
@@ -358,6 +367,7 @@
</dependency>
</dependencies>
</dependencyManagement>
+
<!-- Plugins -->
<build>
<plugins>
@@ -365,9 +375,9 @@
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<configuration>
- <escapeWindowsPaths>false</escapeWindowsPaths>
- </configuration>
- </plugin>
+ <escapeWindowsPaths>false</escapeWindowsPaths>
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
@@ -379,10 +389,10 @@
</goals>
<configuration>
<tasks>
- <echo/>
- <echo message="profile=${jbossws.integration.target}"/>
- <echo message="jboss.home=${jboss.home}"/>
- <echo/>
+ <echo />
+ <echo message="profile=${jbossws.integration.target}" />
+ <echo message="jboss.home=${jboss.home}" />
+ <echo />
</tasks>
</configuration>
</execution>
@@ -422,6 +432,7 @@
</plugin>
</plugins>
</build>
+
<!-- Repositories -->
<repositories>
<repository>
@@ -439,8 +450,10 @@
</snapshots>
</repository>
</repositories>
+
<!-- Profiles -->
<profiles>
+
<!--
Name: bindist
Descr: Build the binary distribution
@@ -463,6 +476,7 @@
</plugins>
</build>
</profile>
+
<!--
Name: srcdist
Descr: Build the source distribution
@@ -485,6 +499,7 @@
</plugins>
</build>
</profile>
+
<!--
Name: jboss510
Descr: JBoss-5.1.0 specific options
@@ -496,6 +511,7 @@
<jboss.home>${jboss510.home}</jboss.home>
</properties>
</profile>
+
<!--
Name: jdk16
Descr: Compile with jdk1.6
@@ -518,6 +534,7 @@
</plugins>
</build>
</profile>
+
<!--
Name: smoketest
Descr: Executes the smoke tests
@@ -540,6 +557,7 @@
</plugins>
</build>
</profile>
+
<!--
Name: testsuite
Descr: Executes the testsuite
@@ -551,4 +569,5 @@
</modules>
</profile>
</profiles>
+
</project>
13 years, 7 months
JBossWS SVN: r14591 - in stack/native/branches/jbossws-native-3.1.2: modules/core and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: klape
Date: 2011-06-20 18:49:01 -0400 (Mon, 20 Jun 2011)
New Revision: 14591
Modified:
stack/native/branches/jbossws-native-3.1.2/
stack/native/branches/jbossws-native-3.1.2/modules/core/
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java
stack/native/branches/jbossws-native-3.1.2/pom.xml
Log:
[JBPAPP-6389] Fix for schema validation with multiple imported schemas.
Property changes on: stack/native/branches/jbossws-native-3.1.2
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/jbossws-native-3.4.0.SP1:13928,13933,13936,13946
/stack/native/trunk:12502,13992,14181,14183
+ /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365:14192
/stack/native/branches/jbossws-native-3.4.0.SP1:13928,13933,13936,13946
/stack/native/trunk:12502,13992,14157,14160,14181,14183
Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/core
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/jbossws-native-3.4.0.SP1/modules/core:13928,13933,13936,13946
/stack/native/trunk/modules/core:12502,13992,14011,14181,14183
+ /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365/modules/core:14192
/stack/native/branches/jbossws-native-3.4.0.SP1/modules/core:13928,13933,13936,13946
/stack/native/trunk/modules/core:12502,13992,14011,14157,14160,14181,14183
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2011-06-20 16:25:38 UTC (rev 14590)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2011-06-20 22:49:01 UTC (rev 14591)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.core.soap;
+import java.io.InputStream;
import java.net.URL;
import javax.xml.namespace.QName;
@@ -102,6 +103,7 @@
EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
feature = epMetaData.getFeature(SchemaValidationFeature.class);
URL xsdURL = feature.getSchemaLocation() != null ? new URL(feature.getSchemaLocation()) : null;
+ InputStream[] xsdStreams = null;
if (xsdURL == null)
{
URL wsdlURL = epMetaData.getServiceMetaData().getWsdlFileOrLocation();
@@ -111,7 +113,7 @@
}
else
{
- xsdURL = schemaExtractor.getSchemaUrl(wsdlURL);
+ xsdStreams = schemaExtractor.getSchemas(wsdlURL);
}
}
if (xsdURL != null)
@@ -120,6 +122,12 @@
Element xmlDOM = DOMUtils.sourceToElement(source);
new SchemaValidationHelper(xsdURL).setErrorHandler(errorHandler).validateDocument(xmlDOM);
}
+ else //xsdStreams != null
+ {
+ ErrorHandler errorHandler = feature.getErrorHandler();
+ Element xmlDOM = DOMUtils.sourceToElement(source);
+ new SchemaValidationHelper(xsdStreams).setErrorHandler(errorHandler).validateDocument(xmlDOM);
+ }
}
catch (RuntimeException rte)
{
@@ -129,10 +137,6 @@
{
WSException.rethrow(ex);
}
- finally
- {
- schemaExtractor.close();
- }
}
private boolean isValidationEnabled()
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java 2011-06-20 16:25:38 UTC (rev 14590)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java 2011-06-20 22:49:01 UTC (rev 14591)
@@ -25,8 +25,16 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.FileInputStream;
import java.net.URL;
+import java.util.Map;
import java.util.List;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
import javax.xml.namespace.QName;
@@ -35,6 +43,9 @@
import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.common.IOUtils;
import org.w3c.dom.Element;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+import org.w3c.dom.NamedNodeMap;
/**
* Extracts the schema from a given WSDL
@@ -48,12 +59,20 @@
private static Logger log = Logger.getLogger(SchemaExtractor.class);
private File xsdFile;
+ private String path;
- public URL getSchemaUrl(URL wsdlURL) throws IOException
+ public InputStream[] getSchemas(URL wsdlURL) throws IOException
{
+ //Get the path to the WSDL
+ Pattern p = Pattern.compile("[a-zA-Z]+\\.[a-zA-Z]+$");
+ Matcher m = p.matcher(wsdlURL.getFile());
+ path = m.replaceFirst("");
+
// parse the wsdl
Element root = DOMUtils.parse(wsdlURL.openStream());
+ List<Attr> nsAttrs = getNamespaceAttrs(root);
+
// get the types element
QName typesQName = new QName(root.getNamespaceURI(), "types");
Element typesEl = DOMUtils.getFirstChildElement(root, typesQName);
@@ -77,25 +96,91 @@
}
Element schemaElement = schemaElements.get(0);
- File tmpdir = IOUtils.createTempDirectory();
- xsdFile = File.createTempFile("jbossws_schema", ".xsd", tmpdir);
- xsdFile.deleteOnExit();
+ //Add namespace declarations from root element
+ for(Attr nsAttr : nsAttrs)
+ {
+ Attr replacedAttr = schemaElement.setAttributeNodeNS(nsAttr);
+ if(replacedAttr != null) //then put it back
+ {
+ schemaElement.setAttributeNodeNS(replacedAttr);
+ }
+ }
- OutputStreamWriter outwr = new OutputStreamWriter(new FileOutputStream(xsdFile));
+ List<InputStream> streams = new ArrayList<InputStream>();
+
+ pullImportedSchemas(schemaElement, streams);
+
+ //Add the WSDL schema to the schema array
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ OutputStreamWriter outwr = new OutputStreamWriter( outStream );
DOMWriter domWriter = new DOMWriter(outwr);
domWriter.setPrettyprint(true);
domWriter.print(schemaElement);
- outwr.close();
- return xsdFile.toURL();
+ streams.add(new ByteArrayInputStream(outStream.toByteArray()));
+
+ return streams.toArray(new InputStream[streams.size()]);
}
-
- public void close()
+
+ private List<Attr> getNamespaceAttrs(Element element)
{
- if (xsdFile != null)
+ List<Attr> nsAttrs = new ArrayList<Attr>();
+
+ NamedNodeMap nodes = element.getAttributes();
+
+ for(int i=0; i < nodes.getLength(); i++)
{
- xsdFile.delete();
- xsdFile = null;
+ Node node = nodes.item(i);
+ Attr attr = (Attr)node;
+ if(attr.getName().startsWith("xmlns"))
+ nsAttrs.add((Attr)attr.cloneNode(true));
}
+
+ return nsAttrs;
}
+
+ private void pullImportedSchemas(Element schemaElement, List<InputStream> streams)
+ {
+ QName importQName = new QName( "http://www.w3.org/2001/XMLSchema", "import" );
+ List<Element> importElements = DOMUtils.getChildElementsAsList( schemaElement, importQName );
+
+ ArrayList<String> schemaLocations = new ArrayList<String>();
+ for( Element importElement : importElements )
+ {
+ String schemaLocation = importElement.getAttribute( "schemaLocation" );
+ schemaLocations.add( schemaLocation );
+ }
+
+ ByteArrayOutputStream outStream = null;
+
+ for( int i=0; i < schemaLocations.size(); i++ )
+ {
+ String schemaLocation = schemaLocations.get( i );
+
+ try
+ {
+ FileInputStream in = new FileInputStream( path + schemaLocation );
+ outStream = new ByteArrayOutputStream();
+
+ int bt = 0;
+ while(( bt = in.read() ) != -1 )
+ {
+ outStream.write( (byte)bt );
+ }
+
+ InputStream inputStream = new ByteArrayInputStream(outStream.toByteArray());
+ inputStream.mark(0);
+
+ Element root = DOMUtils.parse(inputStream);
+ pullImportedSchemas(root, streams);
+
+ inputStream.reset();
+ streams.add(inputStream);
+ }
+ catch(IOException ioe)
+ {
+ log.warn("Error obtaining schema: " + path + schemaLocation);
+ }
+ }
+ }
}
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java 2011-06-20 16:25:38 UTC (rev 14590)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java 2011-06-20 22:49:01 UTC (rev 14591)
@@ -30,6 +30,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.jboss.logging.Logger;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Element;
import org.xml.sax.ErrorHandler;
@@ -44,13 +45,21 @@
public class SchemaValidationHelper
{
private URL xsdURL;
+ private InputStream[] xsdStreams;
private ErrorHandler errorHandler = new StrictlyValidErrorHandler();
+
+ private static Logger log = Logger.getLogger(SchemaValidationHelper.class);
public SchemaValidationHelper(URL xsdURL)
{
this.xsdURL = xsdURL;
}
+ public SchemaValidationHelper(InputStream[] xsdStreams)
+ {
+ this.xsdStreams = xsdStreams;
+ }
+
public SchemaValidationHelper setErrorHandler(ErrorHandler errorHandler)
{
this.errorHandler = errorHandler;
@@ -79,14 +88,23 @@
DocumentBuilder builder = getDocumentBuilder();
builder.parse(inxml);
}
-
+
private DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdURL.toExternalForm());
+
+ if(xsdStreams != null)
+ {
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdStreams);
+ }
+ else //use xsdURL
+ {
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdURL.toExternalForm());
+ }
+
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(errorHandler);
Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/jbossws-native-3.4.0.SP1/modules/testsuite/native-tests:13928,13933,13936,13946
/stack/native/trunk/modules/testsuite/native-tests:12502,13992,14013,14181,14183
+ /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365/modules/testsuite/native-tests:14192
/stack/native/branches/jbossws-native-3.4.0.SP1/modules/testsuite/native-tests:13928,13933,13936,13946
/stack/native/trunk/modules/testsuite/native-tests:12502,13992,14013,14157,14160,14181,14183
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java 2011-06-20 16:25:38 UTC (rev 14590)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java 2011-06-20 22:49:01 UTC (rev 14591)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.jaxws.jbws1172;
+import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
@@ -60,19 +61,19 @@
public void testSchemaValidationPositive() throws Exception
{
URL wsdlURL = getResourceURL("jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl");
- URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
+ InputStream[] xsdStreams = new SchemaExtractor().getSchemas(wsdlURL);
String inxml = "<performTest xmlns='http://www.my-company.it/ws/my-test'><Code>1000</Code></performTest>";
- new SchemaValidationHelper(xsdURL).validateDocument(inxml);
+ new SchemaValidationHelper(xsdStreams).validateDocument(inxml);
}
public void testSchemaValidationNegative() throws Exception
{
URL wsdlURL = getResourceURL("jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl");
- URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
+ InputStream[] xsdStreams = new SchemaExtractor().getSchemas(wsdlURL);
String inxml = "<performTest xmlns='http://www.my-company.it/ws/my-test'><Code>2000</Code></performTest>";
try
{
- new SchemaValidationHelper(xsdURL).validateDocument(inxml);
+ new SchemaValidationHelper(xsdStreams).validateDocument(inxml);
}
catch (SAXException ex)
{
@@ -84,18 +85,19 @@
public void testEndpointWsdlValidation() throws Exception
{
URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1172/noval?wsdl");
- URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
+ InputStream[] xsdStreams = new SchemaExtractor().getSchemas(wsdlURL);
String inxml = "<performTest xmlns='http://www.my-company.it/ws/my-test'><Code>1000</Code></performTest>";
- new SchemaValidationHelper(xsdURL).validateDocument(inxml);
+ new SchemaValidationHelper(xsdStreams).validateDocument(inxml);
}
public void testValidatingClientWithExplicitSchema() throws Exception
{
URL wsdlURL = getResourceURL("jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl");
- URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
+ //URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
Service service = Service.create(wsdlURL, SERVICE_NAME);
- SchemaValidationFeature feature = new SchemaValidationFeature(xsdURL.toString());
+ //SchemaValidationFeature feature = new SchemaValidationFeature(xsdURL.toString());
+ SchemaValidationFeature feature = new SchemaValidationFeature();
MyTest port = service.getPort(MyTest.class, feature);
try
{
@@ -113,10 +115,11 @@
public void testValidatingClientWithErrorHandler() throws Exception
{
URL wsdlURL = getResourceURL("jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl");
- URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
+ //URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
Service service = Service.create(wsdlURL, SERVICE_NAME);
- SchemaValidationFeature feature = new SchemaValidationFeature(xsdURL.toString());
+ //SchemaValidationFeature feature = new SchemaValidationFeature(xsdURL.toString());
+ SchemaValidationFeature feature = new SchemaValidationFeature();
TestErrorHandler errorHandler = new TestErrorHandler();
feature.setErrorHandler(errorHandler);
Modified: stack/native/branches/jbossws-native-3.1.2/pom.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/pom.xml 2011-06-20 16:25:38 UTC (rev 14590)
+++ stack/native/branches/jbossws-native-3.1.2/pom.xml 2011-06-20 22:49:01 UTC (rev 14591)
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<!-- ====================================================================== -->
<!-- -->
<!-- JBoss, the OpenSource J2EE webOS -->
@@ -8,31 +7,25 @@
<!-- See terms of license at http://www.gnu.org. -->
<!-- -->
<!-- ====================================================================== -->
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<name>JBoss Web Services - Stack Native</name>
<groupId>org.jboss.ws.native</groupId>
<artifactId>jbossws-native</artifactId>
<packaging>pom</packaging>
-
<version>3.1.2-SNAPSHOT</version>
-
<!-- Parent -->
<parent>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-parent</artifactId>
<version>1.0.8.GA</version>
</parent>
-
<!-- Source Control Management -->
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/stack/native/branches/jbos...</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/stack/native/branches/jbossws...</developerConnection>
<url>http://fisheye.jboss.com/viewrep/JBossWS/stack/native/branches/jbossws-na...</url>
</scm>
-
<!-- Modules -->
<modules>
<module>modules/endorsed</module>
@@ -41,12 +34,11 @@
<module>modules/management</module>
<module>modules/resources</module>
</modules>
-
<!-- Properties -->
<properties>
- <jbossws.common.version>1.1.0-SNAPSHOT</jbossws.common.version>
- <jbossws.framework.version>3.1.2-SNAPSHOT</jbossws.framework.version>
- <jbossws.spi.version>1.1.2-SNAPSHOT</jbossws.spi.version>
+ <jbossws.common.version>1.1.0</jbossws.common.version>
+ <jbossws.framework.version>3.1.2</jbossws.framework.version>
+ <jbossws.spi.version>1.1.2</jbossws.spi.version>
<!-- [JBWS-2505] -->
<!-- START -->
<!--
@@ -77,7 +69,6 @@
<xalan.version>2.7.1.patch02</xalan.version>
<xerces.version>2.9.1</xerces.version>
</properties>
-
<!-- DependencyManagement -->
<dependencyManagement>
<dependencies>
@@ -273,40 +264,40 @@
<type>sar</type>
<exclusions>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-jmx</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-system-jmx</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system-jmx</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2se</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2se</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-system</artifactId>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
</exclusion>
<exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss.jbossws</groupId>
- <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ <artifactId>jboss-jaxrpc</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss.jbossws</groupId>
- <artifactId>jboss-saaj</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ <artifactId>jboss-saaj</artifactId>
</exclusion>
<!--
<exclusion>
@@ -367,7 +358,6 @@
</dependency>
</dependencies>
</dependencyManagement>
-
<!-- Plugins -->
<build>
<plugins>
@@ -375,9 +365,9 @@
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<configuration>
- <escapeWindowsPaths>false</escapeWindowsPaths>
- </configuration>
- </plugin>
+ <escapeWindowsPaths>false</escapeWindowsPaths>
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
@@ -389,10 +379,10 @@
</goals>
<configuration>
<tasks>
- <echo />
- <echo message="profile=${jbossws.integration.target}" />
- <echo message="jboss.home=${jboss.home}" />
- <echo />
+ <echo/>
+ <echo message="profile=${jbossws.integration.target}"/>
+ <echo message="jboss.home=${jboss.home}"/>
+ <echo/>
</tasks>
</configuration>
</execution>
@@ -432,7 +422,6 @@
</plugin>
</plugins>
</build>
-
<!-- Repositories -->
<repositories>
<repository>
@@ -450,10 +439,8 @@
</snapshots>
</repository>
</repositories>
-
<!-- Profiles -->
<profiles>
-
<!--
Name: bindist
Descr: Build the binary distribution
@@ -476,7 +463,6 @@
</plugins>
</build>
</profile>
-
<!--
Name: srcdist
Descr: Build the source distribution
@@ -499,7 +485,6 @@
</plugins>
</build>
</profile>
-
<!--
Name: jboss510
Descr: JBoss-5.1.0 specific options
@@ -511,7 +496,6 @@
<jboss.home>${jboss510.home}</jboss.home>
</properties>
</profile>
-
<!--
Name: jdk16
Descr: Compile with jdk1.6
@@ -534,7 +518,6 @@
</plugins>
</build>
</profile>
-
<!--
Name: smoketest
Descr: Executes the smoke tests
@@ -557,7 +540,6 @@
</plugins>
</build>
</profile>
-
<!--
Name: testsuite
Descr: Executes the testsuite
@@ -569,5 +551,4 @@
</modules>
</profile>
</profiles>
-
</project>
13 years, 7 months
JBossWS SVN: r14590 - container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/invocation.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-06-20 12:25:38 -0400 (Mon, 20 Jun 2011)
New Revision: 14590
Modified:
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
Log:
[JBWS-3318] WebServiceContext is invocation type agnostic since now
Modified: container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
===================================================================
--- container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2011-06-20 15:10:51 UTC (rev 14589)
+++ container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2011-06-20 16:25:38 UTC (rev 14590)
@@ -22,17 +22,13 @@
package org.jboss.webservices.integration.invocation;
import java.lang.reflect.Method;
-import java.security.Principal;
import javax.naming.Context;
import javax.naming.NamingException;
-import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.context.CurrentEJBContext;
import org.jboss.webservices.integration.util.ASHelper;
import org.jboss.ws.common.injection.ThreadLocalAwareWebServiceContext;
import org.jboss.ws.common.invocation.AbstractInvocationHandler;
@@ -45,7 +41,6 @@
import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
import org.jboss.wsf.spi.ioc.IoCContainerProxy;
import org.jboss.wsf.spi.ioc.IoCContainerProxyFactory;
-import org.w3c.dom.Element;
/**
* Handles invocations on EJB3 endpoints.
@@ -187,44 +182,9 @@
{
final InvocationContext invocationContext = invocation.getInvocationContext();
- return new WebServiceContextAdapter(invocationContext.getAttachment(WebServiceContext.class));
+ return invocationContext.getAttachment(WebServiceContext.class);
}
- private static final class WebServiceContextAdapter implements WebServiceContext
- {
- private final WebServiceContext delegate;
-
- private WebServiceContextAdapter(final WebServiceContext delegate)
- {
- this.delegate = delegate;
- }
-
- public MessageContext getMessageContext()
- {
- return this.delegate.getMessageContext();
- }
-
- public Principal getUserPrincipal()
- {
- return CurrentEJBContext.get().getCallerPrincipal();
- }
-
- public boolean isUserInRole(final String role)
- {
- return CurrentEJBContext.get().isCallerInRole(role);
- }
-
- public EndpointReference getEndpointReference(final Element... referenceParameters)
- {
- return delegate.getEndpointReference(referenceParameters);
- }
-
- public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters)
- {
- return delegate.getEndpointReference(clazz, referenceParameters);
- }
- }
-
/**
* EJB3 invocation callback allowing EJB 3 beans to access Web Service invocation properties.
*/
13 years, 7 months