JBossWS SVN: r13369 - spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-11-30 12:27:30 -0500 (Tue, 30 Nov 2010)
New Revision: 13369
Removed:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsFactory.java
Log:
[JBWS-3169] Removing unused XB factory (an equivalent one from jbossws-cxf-server is already being used... this is kind of duplicated)
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsFactory.java 2010-11-30 15:22:11 UTC (rev 13368)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsFactory.java 2010-11-30 17:27:30 UTC (rev 13369)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.spi.metadata.jms;
-
-import java.net.URL;
-
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * JMS Endpoints OjbectModelFactory
- *
- * @author <a href="ema(a)redhat.com">Jim Ma</a>
- */
-public class JMSEndpointsFactory implements ObjectModelFactory
-{
- public static final String DESCRIPTOR_FILE = "jbossws-cxf.xml";
-
- private URL descriptorURL;
-
- public JMSEndpointsFactory(URL descriptorURL)
- {
- this.descriptorURL = descriptorURL;
- }
-
- /**
- * This method is called on the factory by the object model builder when the parsing starts.
- *
- * @return the root of the object model.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName,
- Attributes attrs)
- {
- JMSEndpointsMetaData endpointsMetaData = new JMSEndpointsMetaData(descriptorURL);
- return endpointsMetaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(JMSEndpointsMetaData endpoints, UnmarshallingContext navigator, String namespaceURI,
- String localName, Attributes attrs)
- {
- if ("endpoint".equals(localName) && attrs.getValue("transportId").equals("http://cxf.apache.org/transports/jms"))
- {
- JMSEndpointMetaData endpoint = new JMSEndpointMetaData(endpoints);
- endpoint.setName(attrs.getValue("name"));
- endpoint.setImplementor(attrs.getValue("implementor"));
- endpoint.setEndpointName(attrs.getValue("endpointName"));
- endpoint.setWsdlLocation(attrs.getValue("wsdlLocation"));
- return endpoint;
-
- }
- else
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JMSEndpointsMetaData endpoints, JMSEndpointMetaData endpointMetaData, UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- endpoints.addEndpointMetaData(endpointMetaData);
- }
-
-}
14 years
JBossWS SVN: r13368 - in stack/native/trunk/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wsdd and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-11-30 10:22:11 -0500 (Tue, 30 Nov 2010)
New Revision: 13368
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wsdd/TestWSDDParser.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/jbws1090/webservices.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/metadatafixture/webservices.xml
Log:
[JBWS-3169] Updating native stack to use the new parsing of webservices.xml + fixing 2 testscases to expect jsr 109 v.1.2 namespace
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java 2010-11-30 15:19:40 UTC (rev 13367)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java 2010-11-30 15:22:11 UTC (rev 13368)
@@ -38,10 +38,6 @@
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
import org.w3c.dom.Element;
/**
@@ -132,11 +128,9 @@
InputStream wsXmlStream = new FileInputStream(wsXmlFile);
try
{
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(wsXmlFile.toURL());
- existingWebservices = (WebservicesMetaData)unmarshaller.unmarshal(wsXmlStream, factory, null);
+ existingWebservices = WebservicesFactory.parse(wsXmlStream, wsXmlFile.toURI().toURL());
}
- catch (JBossXBException e)
+ catch (Exception e)
{
throw new WSException("Could not unmarshal existing webservices descriptor: " + wsXmlFile, e);
}
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wsdd/TestWSDDParser.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wsdd/TestWSDDParser.java 2010-11-30 15:19:40 UTC (rev 13367)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wsdd/TestWSDDParser.java 2010-11-30 15:22:11 UTC (rev 13368)
@@ -31,9 +31,6 @@
import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
/**
* Tets webservice.xml additions that are related to JAX-WS
@@ -52,9 +49,7 @@
InputStream is = webservicesURL.openStream();
try
{
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- webservices = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
+ webservices = WebservicesFactory.parse(is, webservicesURL);
}
finally
{
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java 2010-11-30 15:19:40 UTC (rev 13367)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java 2010-11-30 15:22:11 UTC (rev 13368)
@@ -33,9 +33,6 @@
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.common.DOMUtils;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
import org.w3c.dom.Element;
/**
@@ -54,9 +51,7 @@
InputStream is = webservicesURL.openStream();
try
{
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- webservices = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
+ webservices = WebservicesFactory.parse(is);
}
finally
{
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/jbws1090/webservices.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/jbws1090/webservices.xml 2010-11-30 15:19:40 UTC (rev 13367)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/jbws1090/webservices.xml 2010-11-30 15:22:11 UTC (rev 13368)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<webservices xmlns="http://java.sun.com/xml/ns/j2ee"
+<webservices xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
- version="1.1">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd"
+ version="1.2">
<webservice-description>
<webservice-description-name>HelloWsService</webservice-description-name>
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/metadatafixture/webservices.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/metadatafixture/webservices.xml 2010-11-30 15:19:40 UTC (rev 13367)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/metadatafixture/webservices.xml 2010-11-30 15:22:11 UTC (rev 13368)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<webservices
- xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
- version="1.1">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd"
+ version="1.2">
<webservice-description>
<webservice-description-name>HelloWsService</webservice-description-name>
14 years
JBossWS SVN: r13367 - stack/native/trunk/modules/client.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-11-30 10:19:40 -0500 (Tue, 30 Nov 2010)
New Revision: 13367
Modified:
stack/native/trunk/modules/client/pom.xml
Log:
[JBWS-2709] Adding jbossws-api.jar to jbossws-native-client.jar's manifest
Modified: stack/native/trunk/modules/client/pom.xml
===================================================================
--- stack/native/trunk/modules/client/pom.xml 2010-11-30 15:16:57 UTC (rev 13366)
+++ stack/native/trunk/modules/client/pom.xml 2010-11-30 15:19:40 UTC (rev 13367)
@@ -51,7 +51,7 @@
<configuration>
<archive>
<manifestEntries>
- <Class-Path>jbossws-spi.jar jbossws-common.jar jbossws-framework.jar jbossws-native-core.jar jbossws-native-factories.jar jbossws-native-services.jar jaxrpc-api.jar jaxws-api.jar jsr181-api.jar saaj-api.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-logging-spi.jar jboss-logging-log4j.jar jcl-over-slf4j.jar slf4j-api.jar slf4j-jboss-logging.jar jbosssx-client.jar jboss-javaee.jar jboss-xml-binding.jar jbossxb.jar netty.jar wscommons-policy.jar stax-api.jar wsdl4j.jar</Class-Path>
+ <Class-Path>jbossws-api.jar jbossws-spi.jar jbossws-common.jar jbossws-framework.jar jbossws-native-core.jar jbossws-native-factories.jar jbossws-native-services.jar jaxrpc-api.jar jaxws-api.jar jsr181-api.jar saaj-api.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-logging-spi.jar jboss-logging-log4j.jar jcl-over-slf4j.jar slf4j-api.jar slf4j-jboss-logging.jar jbosssx-client.jar jboss-javaee.jar jboss-xml-binding.jar jbossxb.jar netty.jar wscommons-policy.jar stax-api.jar wsdl4j.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
14 years
JBossWS SVN: r13366 - in spi/trunk/src: main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-11-30 10:16:57 -0500 (Tue, 30 Nov 2010)
New Revision: 13366
Added:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/ParserConstants.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/webservices/
spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/webservices/WebServiceFactoryTestCase.java
spi/trunk/src/test/resources/metadata/webservices/
spi/trunk/src/test/resources/metadata/webservices/test-webservices.xml
Removed:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java
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/webservices/WebservicesFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java
Log:
[JBWS-3169]
- Removing HandlerChainsObjectFactory (not used anymore)
- Initial StAX based parsing of webservices.xml (still cohexists with the XB code, WIP as ASIL needs to be updated)
- WebservicesMetaData now builds to JSR109 v.1.2 by default instead of 1.1 (to avoid supporting the 7yrs old NS for jsr 109 v.1.1)
- few additions to StAXUtils
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -0,0 +1,199 @@
+/*
+ * 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.spi.metadata;
+
+import static org.jboss.wsf.spi.metadata.ParserConstants.*;
+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 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
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 30-Nov-2010
+ */
+public abstract class AbstractHandlerChainsMetaDataParser
+{
+ protected UnifiedHandlerChainsMetaData parseHandlerChains(XMLStreamReader reader) throws XMLStreamException
+ {
+ UnifiedHandlerChainsMetaData handlerChains = new UnifiedHandlerChainsMetaData();
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_HANDLER_CHAINS))
+ {
+ return handlerChains;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_HANDLER_CHAIN)) {
+ handlerChains.addHandlerChain(parseHandlerChain(reader, handlerChains));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private UnifiedHandlerChainMetaData parseHandlerChain(XMLStreamReader reader, UnifiedHandlerChainsMetaData handlerChains) throws XMLStreamException
+ {
+ UnifiedHandlerChainMetaData handlerChain = new UnifiedHandlerChainMetaData(handlerChains);
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_HANDLER_CHAIN))
+ {
+ return handlerChain;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_CHAIN_PORT_PATTERN))
+ {
+ handlerChain.setPortNamePattern(elementAsQName(reader));
+ }
+ else if (match(reader, QNAME_CHAIN_SERVICE_PATTERN))
+ {
+ handlerChain.setServiceNamePattern(elementAsQName(reader));
+ }
+ else if(match(reader, QNAME_CHAIN_PROTOCOL_BINDING))
+ {
+ handlerChain.setProtocolBindings(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_HANDLER)) {
+ handlerChain.addHandler(parseHandler(reader, handlerChain));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private UnifiedHandlerMetaData parseHandler(XMLStreamReader reader, UnifiedHandlerChainMetaData handlerChain) throws XMLStreamException
+ {
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(handlerChain);
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_HANDLER))
+ {
+ return handler;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_HANDLER_NAME))
+ {
+ handler.setHandlerName(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_HANDLER_CLASS))
+ {
+ handler.setHandlerClass(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_HANDLER_PARAM)) {
+ handler.addInitParam(parseInitParam(reader));
+ }
+ else if (match(reader, QNAME_HANDLER_SOAP_ROLE)) {
+ handler.addSoapRole(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_HANDLER_SOAP_HEADER)) {
+ handler.addSoapHeader(elementAsQName(reader));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private UnifiedInitParamMetaData parseInitParam(XMLStreamReader reader) throws XMLStreamException
+ {
+ UnifiedInitParamMetaData initParam = new UnifiedInitParamMetaData();
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_HANDLER_PARAM))
+ {
+ return initParam;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_HANDLER_PARAM_NAME))
+ {
+ initParam.setParamName(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_HANDLER_PARAM_VALUE))
+ {
+ initParam.setParamValue(elementAsString(reader));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/ParserConstants.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/ParserConstants.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/ParserConstants.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -0,0 +1,104 @@
+/*
+ * 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.spi.metadata;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants for parsing descriptors
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 30-Nov-2010
+ *
+ */
+public abstract class ParserConstants
+{
+ public static final String JAVAEE_NS = "http://java.sun.com/xml/ns/javaee";
+
+ public static final QName QNAME_CHAIN_PORT_PATTERN = new QName(JAVAEE_NS, "port-name-pattern");
+
+ public static final QName QNAME_CHAIN_PROTOCOL_BINDING = new QName(JAVAEE_NS, "protocol-bindings");
+
+ public static final QName QNAME_CHAIN_SERVICE_PATTERN = new QName(JAVAEE_NS, "service-name-pattern");
+
+ public static final QName QNAME_HANDLER_CHAIN = new QName(JAVAEE_NS, "handler-chain");
+
+ public static final QName QNAME_HANDLER_CHAINS = new QName(JAVAEE_NS, "handler-chains");
+
+ public static final QName QNAME_HANDLER = new QName(JAVAEE_NS, "handler");
+
+ public static final QName QNAME_HANDLER_NAME = new QName(JAVAEE_NS, "handler-name");
+
+ public static final QName QNAME_HANDLER_CLASS = new QName(JAVAEE_NS, "handler-class");
+
+ public static final QName QNAME_HANDLER_SOAP_ROLE = new QName(JAVAEE_NS, "soap-role");
+
+ public static final QName QNAME_HANDLER_SOAP_HEADER = new QName(JAVAEE_NS, "soap-header");
+
+ public static final QName QNAME_HANDLER_PARAM = new QName(JAVAEE_NS, "init-param");
+
+ public static final QName QNAME_HANDLER_PARAM_NAME = new QName(JAVAEE_NS, "param-name");
+
+ public static final QName QNAME_HANDLER_PARAM_VALUE = new QName(JAVAEE_NS, "param-value");
+
+ public static final QName QNAME_WEBSERVICES = new QName(JAVAEE_NS, "webservices");
+
+ public static final QName QNAME_WEBSERVICE_DESCRIPTION = new QName(JAVAEE_NS, "webservice-description");
+
+ public static final QName QNAME_WEBSERVICE_DESCRIPTION_NAME = new QName(JAVAEE_NS, "webservice-description-name");
+
+ public static final QName QNAME_JAXRPC_MAPPING_FILE = new QName(JAVAEE_NS, "jaxrpc-mapping-file");
+
+ public static final QName QNAME_WSDL_FILE = new QName(JAVAEE_NS, "wsdl-file");
+
+ public static final QName QNAME_PORT_COMPONENT = new QName(JAVAEE_NS, "port-component");
+
+ public static final QName QNAME_PORT_COMPONENT_NAME = new QName(JAVAEE_NS, "port-component-name");
+
+ public static final QName QNAME_WSDL_SERVICE = new QName(JAVAEE_NS, "wsdl-service");
+
+ public static final QName QNAME_WSDL_PORT = new QName(JAVAEE_NS, "wsdl-port");
+
+ public static final QName QNAME_ENABLE_MTOM = new QName(JAVAEE_NS, "enable-mtom");
+
+ public static final QName QNAME_MTOM_THRESHOLD = new QName(JAVAEE_NS, "mtom-threshold");
+
+ public static final QName QNAME_ADDRESSING = new QName(JAVAEE_NS, "addressing");
+
+ public static final QName QNAME_ADDRESSING_RESPONSES = new QName(JAVAEE_NS, "responses");
+
+ public static final QName QNAME_RESPECT_BINDING = new QName(JAVAEE_NS, "respect-binding");
+
+ public static final QName QNAME_PROTOCOL_BINDING = new QName(JAVAEE_NS, "protocol-binding");
+
+ public static final QName QNAME_SERVICE_ENDPOINT_INTERFACE = new QName(JAVAEE_NS, "service-endpoint-interface");
+
+ public static final QName QNAME_SERVICE_IMPL_BEAN = new QName(JAVAEE_NS, "service-impl-bean");
+
+ public static final QName QNAME_EJB_LINK = new QName(JAVAEE_NS, "ejb-link");
+
+ public static final QName QNAME_SERVLET_LINK = new QName(JAVAEE_NS, "servlet-link");
+
+ public static final QName QNAME_ENABLED = new QName(JAVAEE_NS, "enabled");
+
+ public static final QName QNAME_REQUIRED = new QName(JAVAEE_NS, "required");
+}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java 2010-11-30 08:25:28 UTC (rev 13365)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -1,168 +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.spi.metadata.j2ee.serviceref;
-
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A JBossXB factory for jsr181 the HandlerChain annotation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Oct-2005
- */
-@Deprecated
-public class HandlerChainsObjectFactory implements ObjectModelFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(HandlerChainsObjectFactory.class);
-
- public HandlerChainsObjectFactory()
- {
- }
-
- /**
- * This method is called on the factory by the object model builder when the parsing starts.
- *
- * @return the root of the object model.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- UnifiedHandlerChainsMetaData handlerConfigMetaData = new UnifiedHandlerChainsMetaData(HandlerType.ENDPOINT);
- return handlerConfigMetaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(UnifiedHandlerChainsMetaData handlerConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler-chain".equals(localName))
- return new UnifiedHandlerChainMetaData(handlerConfig);
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(UnifiedHandlerChainsMetaData handlerConfig, UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- if (!handlerChain.isExcluded()) handlerConfig.addHandlerChain(handlerChain);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(UnifiedHandlerChainMetaData chainConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler".equals(localName))
- return new UnifiedHandlerMetaData(chainConfig);
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(UnifiedHandlerChainMetaData handlerConfig, UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handlerConfig.addHandler(handler);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("init-param".equals(localName))
- return new UnifiedInitParamMetaData();
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(UnifiedHandlerMetaData handler, UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handler.addInitParam(param);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML content.
- */
- public void setValue(UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedHandlerChainMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
- try
- {
- if (localName.equals("protocol-bindings"))
- handlerChain.setProtocolBindings(value);
- else if (localName.equals("service-name-pattern"))
- handlerChain.setServiceNamePattern(navigator.resolveQName(value));
- else if (localName.equals("port-name-pattern"))
- handlerChain.setPortNamePattern(navigator.resolveQName(value));
- }
- catch (java.lang.IllegalStateException ex)
- {
- log.warn("Could not get " + localName + " value : "
- + ex.getMessage() + ", this handler chain will be ingored");
- handlerChain.setExcluded(true);
- }
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML content.
- */
- public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
-
- if (localName.equals("handler-name"))
- handler.setHandlerName(value);
- else if (localName.equals("handler-class"))
- handler.setHandlerClass(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML content.
- */
- public void setValue(UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
-
- if (localName.equals("param-name"))
- param.setParamName(value);
- else if (localName.equals("param-value"))
- param.setParamValue(value);
- }
-}
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 2010-11-30 08:25:28 UTC (rev 13365)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaDataParser.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -23,47 +23,36 @@
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-import static org.jboss.wsf.spi.util.StAXUtils.createXMLStreamReader;
-import static org.jboss.wsf.spi.util.StAXUtils.elementAsQName;
-import static org.jboss.wsf.spi.util.StAXUtils.elementAsString;
+import static org.jboss.wsf.spi.metadata.ParserConstants.*;
import static org.jboss.wsf.spi.util.StAXUtils.match;
import java.io.IOException;
import java.io.InputStream;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
+import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
+import org.jboss.wsf.spi.util.StAXUtils;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-/** The interface of the parser for the unified metadata handler chains element
+/**
+ * The parser for the unified metadata handler chains element
*
* @author alessio.soldano(a)jboss.com
* @since 26-Nov-2010
*/
-public class UnifiedHandlerChainsMetaDataParser
+public class UnifiedHandlerChainsMetaDataParser extends AbstractHandlerChainsMetaDataParser
{
- private static final String JAVAEE_NS = "http://java.sun.com/xml/ns/javaee";
- private static final QName QNAME_CHAIN_PORT_PATTERN = new QName(JAVAEE_NS, "port-name-pattern");
- private static final QName QNAME_CHAIN_PROTOCOL_BINDING = new QName(JAVAEE_NS, "protocol-bindings");
- private static final QName QNAME_CHAIN_SERVICE_PATTERN = new QName(JAVAEE_NS, "service-name-pattern");
- private static final QName QNAME_HANDLER_CHAIN = new QName(JAVAEE_NS, "handler-chain");
- private static final QName QNAME_HANDLER_CHAINS = new QName(JAVAEE_NS, "handler-chains");
- private static final QName QNAME_HANDLER = new QName(JAVAEE_NS, "handler");
- private static final QName QNAME_HANDLER_NAME = new QName(JAVAEE_NS, "handler-name");
- private static final QName QNAME_HANDLER_CLASS = new QName(JAVAEE_NS, "handler-class");
- private static final QName QNAME_HANDLER_SOAP_ROLE = new QName(JAVAEE_NS, "soap-role");
- private static final QName QNAME_HANDLER_SOAP_HEADER = new QName(JAVAEE_NS, "soap-header");
- private static final QName QNAME_HANDLER_PARAM = new QName(JAVAEE_NS, "init-param");
- private static final QName QNAME_HANDLER_PARAM_NAME = new QName(JAVAEE_NS, "param-name");
- private static final QName QNAME_HANDLER_PARAM_VALUE = new QName(JAVAEE_NS, "param-value");
-
+ private UnifiedHandlerChainsMetaDataParser()
+ {
+ super();
+ }
+
public static UnifiedHandlerChainsMetaData parse(InputStream is) throws IOException
{
// http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd
try
{
- XMLStreamReader xmlr = createXMLStreamReader(is);
+ XMLStreamReader xmlr = StAXUtils.createXMLStreamReader(is);
return parse(xmlr);
}
catch (XMLStreamException e)
@@ -95,7 +84,8 @@
if (match(reader, QNAME_HANDLER_CHAINS))
{
- handlerChains = parseHandlerChains(reader);
+ UnifiedHandlerChainsMetaDataParser parser = new UnifiedHandlerChainsMetaDataParser();
+ handlerChains = parser.parseHandlerChains(reader);
}
else
{
@@ -105,159 +95,4 @@
}
return handlerChains;
}
-
- private static UnifiedHandlerChainsMetaData parseHandlerChains(XMLStreamReader reader) throws XMLStreamException
- {
- UnifiedHandlerChainsMetaData handlerChains = new UnifiedHandlerChainsMetaData();
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case XMLStreamConstants.END_ELEMENT : {
- if (match(reader, QNAME_HANDLER_CHAINS))
- {
- return handlerChains;
- }
- else
- {
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
- }
- }
- case XMLStreamConstants.START_ELEMENT : {
- if (match(reader, QNAME_HANDLER_CHAIN)) {
- handlerChains.addHandlerChain(parseHandlerChain(reader, handlerChains));
- }
- else
- {
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
- }
- }
- }
- }
- throw new IllegalStateException("Reached end of xml document unexpectedly");
- }
-
- private static UnifiedHandlerChainMetaData parseHandlerChain(XMLStreamReader reader, UnifiedHandlerChainsMetaData handlerChains) throws XMLStreamException
- {
- UnifiedHandlerChainMetaData handlerChain = new UnifiedHandlerChainMetaData(handlerChains);
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case XMLStreamConstants.END_ELEMENT : {
- if (match(reader, QNAME_HANDLER_CHAIN))
- {
- return handlerChain;
- }
- else
- {
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
- }
- }
- case XMLStreamConstants.START_ELEMENT : {
- if (match(reader, QNAME_CHAIN_PORT_PATTERN))
- {
- handlerChain.setPortNamePattern(elementAsQName(reader));
- }
- else if (match(reader, QNAME_CHAIN_SERVICE_PATTERN))
- {
- handlerChain.setServiceNamePattern(elementAsQName(reader));
- }
- else if(match(reader, QNAME_CHAIN_PROTOCOL_BINDING))
- {
- handlerChain.setProtocolBindings(elementAsString(reader));
- }
- else if (match(reader, QNAME_HANDLER)) {
- handlerChain.addHandler(parseHandler(reader, handlerChain));
- }
- else
- {
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
- }
- }
- }
- }
- throw new IllegalStateException("Reached end of xml document unexpectedly");
- }
-
- private static UnifiedHandlerMetaData parseHandler(XMLStreamReader reader, UnifiedHandlerChainMetaData handlerChain) throws XMLStreamException
- {
- UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(handlerChain);
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case XMLStreamConstants.END_ELEMENT : {
- if (match(reader, QNAME_HANDLER))
- {
- return handler;
- }
- else
- {
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
- }
- }
- case XMLStreamConstants.START_ELEMENT : {
- if (match(reader, QNAME_HANDLER_NAME))
- {
- handler.setHandlerName(elementAsString(reader));
- }
- else if (match(reader, QNAME_HANDLER_CLASS))
- {
- handler.setHandlerClass(elementAsString(reader));
- }
- else if (match(reader, QNAME_HANDLER_PARAM)) {
- handler.addInitParam(parseInitParam(reader));
- }
- else if (match(reader, QNAME_HANDLER_SOAP_ROLE)) {
- handler.addSoapRole(elementAsString(reader));
- }
- else if (match(reader, QNAME_HANDLER_SOAP_HEADER)) {
- handler.addSoapHeader(elementAsQName(reader));
- }
- else
- {
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
- }
- }
- }
- }
- throw new IllegalStateException("Reached end of xml document unexpectedly");
- }
-
- private static UnifiedInitParamMetaData parseInitParam(XMLStreamReader reader) throws XMLStreamException
- {
- UnifiedInitParamMetaData initParam = new UnifiedInitParamMetaData();
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case XMLStreamConstants.END_ELEMENT : {
- if (match(reader, QNAME_HANDLER_PARAM))
- {
- return initParam;
- }
- else
- {
- throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
- }
- }
- case XMLStreamConstants.START_ELEMENT : {
- if (match(reader, QNAME_HANDLER_PARAM_NAME))
- {
- initParam.setParamName(elementAsString(reader));
- }
- else if (match(reader, QNAME_HANDLER_PARAM_VALUE))
- {
- initParam.setParamValue(elementAsString(reader));
- }
- else
- {
- throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
- }
- }
- }
- }
- throw new IllegalStateException("Reached end of xml document unexpectedly");
- }
}
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 2010-11-30 08:25:28 UTC (rev 13365)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -21,21 +21,33 @@
*/
package org.jboss.wsf.spi.metadata.webservices;
+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.util.StAXUtils.elementAsBoolean;
+import static org.jboss.wsf.spi.util.StAXUtils.elementAsInt;
+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.io.IOException;
import java.io.InputStream;
import java.net.URL;
+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.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
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 org.jboss.wsf.spi.util.StAXUtils;
import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -45,7 +57,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 16-Apr-2004
*/
-public class WebservicesFactory implements ObjectModelFactory
+public class WebservicesFactory extends AbstractHandlerChainsMetaDataParser implements ObjectModelFactory
{
// provide logging
private static final Logger log = Logger.getLogger(WebservicesFactory.class);
@@ -100,46 +112,322 @@
{
URL wsddUrl = wsdd.toURL();
+ InputStream is = null;
try
{
- webservices = load(wsddUrl);
+ is = wsddUrl.openStream();
+ XMLStreamReader xmlr = StAXUtils.createXMLStreamReader(is);
+ webservices = parse(xmlr, wsddUrl);
}
- catch (IOException e)
+ catch (Exception e)
{
- throw new WebServiceException("Failed to unmarshall webservices.xml:" + e.getMessage());
+ throw new WebServiceException("Failed to unmarshall " + wsddUrl + ":" + e.getMessage());
}
+ finally
+ {
+ try
+ {
+ if (is != null) is.close();
+ }
+ catch (IOException e) {} //ignore
+ }
}
return webservices;
}
- /**
- * Load webservices.xml from <code>META-INF/webservices.xml</code>
- * or <code>WEB-INF/webservices.xml</code>.
- *
- * @param root virtual file root
- * @return WebservicesMetaData or <code>null</code> if it cannot be found
- */
- public static WebservicesMetaData load(URL wsddUrl) throws IOException
+ public static WebservicesMetaData parse(InputStream is)
{
- InputStream is = null;
+ return parse(is, null);
+ }
+
+ public static WebservicesMetaData parse(InputStream is, URL descriptorURL)
+ {
try
{
- is = wsddUrl.openStream();
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(wsddUrl);
- return (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
+ XMLStreamReader xmlr = StAXUtils.createXMLStreamReader(is);
+ return parse(xmlr, descriptorURL);
}
catch (Exception e)
{
- throw new WebServiceException("Failed to unmarshall " + wsddUrl + ":" + e.getMessage());
+ throw new WebServiceException(e);
}
- finally
+ }
+
+ public static WebservicesMetaData parse(XMLStreamReader reader) throws XMLStreamException
+ {
+ return parse(reader, null);
+ }
+
+ private static WebservicesMetaData parse(XMLStreamReader reader, URL descriptorURL) throws XMLStreamException
+ {
+ int iterate;
+ try
{
- if (is != null)
- is.close();
+ iterate = reader.nextTag();
}
+ catch (XMLStreamException e)
+ {
+ // skip non-tag elements
+ iterate = reader.nextTag();
+ }
+ WebservicesMetaData metadata = null;
+ switch (iterate)
+ {
+ case END_ELEMENT : {
+ // we're done
+ break;
+ }
+ case START_ELEMENT : {
+
+ if (match(reader, QNAME_WEBSERVICES))
+ {
+ WebservicesFactory factory = new WebservicesFactory(descriptorURL);
+ metadata = factory.parseWebservices(reader, descriptorURL);
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ return metadata;
}
+
+ private WebservicesMetaData parseWebservices(XMLStreamReader reader, URL descriptorURL) throws XMLStreamException
+ {
+ WebservicesMetaData metadata = new WebservicesMetaData(descriptorURL);
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_WEBSERVICES))
+ {
+ return metadata;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_WEBSERVICE_DESCRIPTION)) {
+ metadata.addWebserviceDescription(parseWebserviceDescription(reader, metadata));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private WebserviceDescriptionMetaData parseWebserviceDescription(XMLStreamReader reader, WebservicesMetaData wsMetaData) throws XMLStreamException
+ {
+ WebserviceDescriptionMetaData description = new WebserviceDescriptionMetaData(wsMetaData);
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_WEBSERVICE_DESCRIPTION))
+ {
+ return description;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_WEBSERVICE_DESCRIPTION_NAME)) {
+ description.setWebserviceDescriptionName(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_WSDL_FILE)) {
+ description.setWsdlFile(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_JAXRPC_MAPPING_FILE)) {
+ description.setJaxrpcMappingFile(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_PORT_COMPONENT)) {
+ description.addPortComponent(parsePortComponent(reader, description));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private PortComponentMetaData parsePortComponent(XMLStreamReader reader, WebserviceDescriptionMetaData desc) throws XMLStreamException
+ {
+ PortComponentMetaData pc = new PortComponentMetaData(desc);
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_PORT_COMPONENT))
+ {
+ return pc;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_PORT_COMPONENT_NAME)) {
+ pc.setPortComponentName(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_WSDL_SERVICE)) {
+ pc.setWsdlService(elementAsQName(reader));
+ }
+ else if (match(reader, QNAME_WSDL_PORT)) {
+ pc.setWsdlPort(elementAsQName(reader));
+ }
+ else if (match(reader, QNAME_ENABLE_MTOM)) {
+ pc.setMtomEnabled(elementAsBoolean(reader));
+ }
+ else if (match(reader, QNAME_MTOM_THRESHOLD)) {
+ pc.setMtomThreshold(elementAsInt(reader));
+ }
+ else if (match(reader, QNAME_ADDRESSING)) {
+ parseAddressing(reader, pc);
+ }
+ else if (match(reader, QNAME_RESPECT_BINDING)) {
+ parseRespectBinding(reader, pc);
+ }
+ else if (match(reader, QNAME_PROTOCOL_BINDING)) {
+ pc.setProtocolBinding(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_SERVICE_ENDPOINT_INTERFACE)) {
+ pc.setServiceEndpointInterface(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_SERVICE_IMPL_BEAN)) {
+ parseServiceImplBean(reader, pc);
+ }
+ else if (match(reader, QNAME_HANDLER_CHAINS)) {
+ pc.setHandlerChains(parseHandlerChains(reader));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private void parseAddressing(XMLStreamReader reader, PortComponentMetaData pc) throws XMLStreamException
+ {
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_ADDRESSING))
+ {
+ return;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_ENABLED)) {
+ pc.setAddressingEnabled(elementAsBoolean(reader));
+ }
+ else if (match(reader, QNAME_REQUIRED)) {
+ pc.setAddressingRequired(elementAsBoolean(reader));
+ }
+ else if (match(reader, QNAME_ADDRESSING_RESPONSES)) {
+ pc.setAddressingResponses(elementAsString(reader));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private void parseRespectBinding(XMLStreamReader reader, PortComponentMetaData pc) throws XMLStreamException
+ {
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_RESPECT_BINDING))
+ {
+ return;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_ENABLED)) {
+ pc.setRespectBindingEnabled(elementAsBoolean(reader));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ private void parseServiceImplBean(XMLStreamReader reader, PortComponentMetaData pc) throws XMLStreamException
+ {
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case XMLStreamConstants.END_ELEMENT : {
+ if (match(reader, QNAME_SERVICE_IMPL_BEAN))
+ {
+ return;
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected end tag: " + reader.getLocalName());
+ }
+ }
+ case XMLStreamConstants.START_ELEMENT : {
+ if (match(reader, QNAME_SERVLET_LINK)) {
+ pc.setServletLink(elementAsString(reader));
+ }
+ else if (match(reader, QNAME_EJB_LINK)) {
+ pc.setEjbLink(elementAsString(reader));
+ }
+ else
+ {
+ throw new IllegalStateException("Unexpected element: " + reader.getLocalName());
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("Reached end of xml document unexpectedly");
+ }
+
+ //-----------------------------------------
+ //TODO Below are methods to be removed....
+ //-----------------------------------------
/**
* This method is called on the factory by the object model builder when the parsing starts.
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java 2010-11-30 08:25:28 UTC (rev 13365)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -84,9 +84,9 @@
private void createHeader(StringBuilder buf)
{
- buf.append("<webservices xmlns='http://java.sun.com/xml/ns/j2ee'");
+ buf.append("<webservices xmlns='http://java.sun.com/xml/ns/javaee'");
buf.append(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
- buf.append(" xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd'");
- buf.append(" version='1.1'>");
+ buf.append(" xsi:schemaLocation='http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd'");
+ buf.append(" version='1.2'>");
}
}
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 2010-11-30 08:25:28 UTC (rev 13365)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -135,4 +135,16 @@
String namespaceURI = prefix == null ? reader.getNamespaceURI() : reader.getNamespaceURI(prefix);
return prefix == null ? new QName(namespaceURI, localPart) : new QName(namespaceURI, localPart, prefix);
}
+
+ public static boolean elementAsBoolean(XMLStreamReader reader) throws XMLStreamException
+ {
+ String text = reader.getElementText();
+ return Boolean.parseBoolean(text);
+ }
+
+ public static int elementAsInt(XMLStreamReader reader) throws XMLStreamException
+ {
+ String text = reader.getElementText();
+ return Integer.parseInt(text);
+ }
}
Added: spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/webservices/WebServiceFactoryTestCase.java
===================================================================
--- spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/webservices/WebServiceFactoryTestCase.java (rev 0)
+++ spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/webservices/WebServiceFactoryTestCase.java 2010-11-30 15:16:57 UTC (rev 13366)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.wsf.spi.metadata.webservices;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+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 org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Test the WebServiceFactory
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 29-Nov-2010
+ */
+public class WebServiceFactoryTestCase extends TestCase
+{
+ public void testParse() throws Exception
+ {
+ File file = new File("src/test/resources/metadata/webservices/test-webservices.xml");
+ InputStream is = new FileInputStream(file);
+ URL url = file.toURI().toURL();
+ WebservicesMetaData metadata = WebservicesFactory.parse(is, url);
+ assertEquals(url, metadata.getDescriptorURL());
+ assertEquals(2, metadata.getWebserviceDescriptions().length);
+ testDescription1(metadata.getWebserviceDescriptions()[0], metadata);
+ testDescription2(metadata.getWebserviceDescriptions()[1], metadata);
+ }
+
+ private void testDescription1(WebserviceDescriptionMetaData description, WebservicesMetaData webservicesMetaData) throws Exception
+ {
+ assertEquals(null, description.getJaxrpcMappingFile());
+ assertEquals("HelloService", description.getWebserviceDescriptionName());
+ assertEquals("META-INF/wsdl/HelloService.wsdl", description.getWsdlFile());
+ assertEquals(webservicesMetaData, description.getWebservices());
+ PortComponentMetaData[] pcmds = description.getPortComponents();
+ assertEquals(1, pcmds.length);
+ PortComponentMetaData pcmd = pcmds[0];
+ assertEquals(description, pcmd.getWebserviceDescription());
+ assertEquals("HelloBean", pcmd.getPortComponentName());
+ assertEquals("ANONYMOUS", pcmd.getAddressingResponses());
+ assertEquals("jbws2999Test", pcmd.getEjbLink());
+ assertEquals(null, pcmd.getServletLink());
+ assertEquals(500, pcmd.getMtomThreshold());
+ assertEquals(new QName("http://Hello.org", "HelloService"), pcmd.getWsdlService());
+ assertEquals(new QName("http://Hello.org", "Hello"), pcmd.getWsdlPort());
+ assertEquals(true, pcmd.isMtomEnabled());
+ assertEquals(true, pcmd.isAddressingEnabled());
+ assertEquals(true, pcmd.isRespectBindingEnabled());
+ assertEquals(true, pcmd.isAddressingRequired());
+ assertEquals("##SOAP11_HTTP", pcmd.getProtocolBinding());
+ assertEquals("org.jboss.test.ws.jaxws.jbws2999.Hello", pcmd.getServiceEndpointInterface());
+ assertEquals(null, pcmd.getContextRoot());
+
+ UnifiedHandlerChainsMetaData chains = pcmd.getHandlerChains();
+ assertEquals(1, chains.getHandlerChains().size());
+ UnifiedHandlerChainMetaData chain = chains.getHandlerChains().get(0);
+ assertEquals(null, chain.getPortNamePattern());
+ assertEquals(null, chain.getServiceNamePattern());
+ assertEquals(null, chain.getProtocolBindings());
+ List<UnifiedHandlerMetaData> handlers = chain.getHandlers();
+ assertEquals(1, handlers.size());
+ UnifiedHandlerMetaData handler = handlers.get(0);
+// assertEquals(chain, handler.getHandlerChain());
+ assertEquals("CustomHandler", handler.getHandlerName());
+ assertEquals("org.jboss.test.ws.jaxws.jbws2999.CustomHandler", handler.getHandlerClass());
+ List<UnifiedInitParamMetaData> params = handler.getInitParams();
+ assertEquals(0, params.size());
+ assertEquals(0, handler.getPortNames().size());
+ assertEquals(0, handler.getSoapHeaders().size());
+ assertEquals(0, handler.getSoapRoles().size());
+ }
+
+ private void testDescription2(WebserviceDescriptionMetaData description, WebservicesMetaData webservicesMetaData) throws Exception
+ {
+ assertEquals("WEB-INF/jaxrpc-mapping.xml", description.getJaxrpcMappingFile());
+ assertEquals("SampleService", description.getWebserviceDescriptionName());
+ assertEquals("WEB-INF/wsdl/SampleService.wsdl", description.getWsdlFile());
+ assertEquals(webservicesMetaData, description.getWebservices());
+ PortComponentMetaData[] pcmds = description.getPortComponents();
+ assertEquals(1, pcmds.length);
+ PortComponentMetaData pcmd = pcmds[0];
+ assertEquals(description, pcmd.getWebserviceDescription());
+ assertEquals("TrivialServicePort", pcmd.getPortComponentName());
+ assertEquals("ALL", pcmd.getAddressingResponses());
+ assertEquals(null, pcmd.getEjbLink());
+ assertEquals("TrivialEndpoint", pcmd.getServletLink());
+ assertEquals(0, pcmd.getMtomThreshold());
+ assertEquals(null, pcmd.getWsdlService());
+ assertEquals(new QName("http://org.jboss.ws/samples/docstyle/bare", "TrivialServicePort"), pcmd.getWsdlPort());
+ assertEquals(false, pcmd.isMtomEnabled());
+ assertEquals(false, pcmd.isAddressingEnabled());
+ assertEquals(false, pcmd.isRespectBindingEnabled());
+ assertEquals(false, pcmd.isAddressingRequired());
+ assertEquals(null, pcmd.getProtocolBinding());
+ assertEquals("org.jboss.test.ws.jaxrpc.samples.docstyle.bare.TrivialService", pcmd.getServiceEndpointInterface());
+ assertEquals(null, pcmd.getContextRoot());
+
+ UnifiedHandlerChainsMetaData chains = pcmd.getHandlerChains();
+ assertEquals(null, chains);
+ }
+
+}
\ No newline at end of file
Added: spi/trunk/src/test/resources/metadata/webservices/test-webservices.xml
===================================================================
--- spi/trunk/src/test/resources/metadata/webservices/test-webservices.xml (rev 0)
+++ spi/trunk/src/test/resources/metadata/webservices/test-webservices.xml 2010-11-30 15:16:57 UTC (rev 13366)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<webservices xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:wsdl="http://Hello.org"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_web_services_1_3.xsd"
+ version="1.3">
+ <webservice-description>
+ <webservice-description-name>HelloService</webservice-description-name>
+ <wsdl-file>META-INF/wsdl/HelloService.wsdl</wsdl-file>
+ <port-component>
+ <port-component-name>HelloBean</port-component-name>
+ <wsdl-service>wsdl:HelloService</wsdl-service>
+ <wsdl-port>wsdl:Hello</wsdl-port>
+ <enable-mtom>true</enable-mtom>
+ <mtom-threshold>500</mtom-threshold>
+ <addressing>
+ <enabled>true</enabled>
+ <required>true</required>
+ <responses>ANONYMOUS</responses>
+ </addressing>
+ <respect-binding>
+ <enabled>true</enabled>
+ </respect-binding>
+ <protocol-binding>##SOAP11_HTTP</protocol-binding>
+ <service-endpoint-interface>org.jboss.test.ws.jaxws.jbws2999.Hello</service-endpoint-interface>
+ <service-impl-bean>
+ <ejb-link>jbws2999Test</ejb-link>
+ </service-impl-bean>
+ <handler-chains>
+ <handler-chain>
+ <handler>
+ <handler-name>CustomHandler</handler-name>
+ <handler-class>org.jboss.test.ws.jaxws.jbws2999.CustomHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </port-component>
+ </webservice-description>
+
+ <webservice-description>
+ <webservice-description-name>SampleService</webservice-description-name>
+ <wsdl-file>WEB-INF/wsdl/SampleService.wsdl</wsdl-file>
+ <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
+ <port-component>
+ <port-component-name>TrivialServicePort</port-component-name>
+ <wsdl-port xmlns:portNS='http://org.jboss.ws/samples/docstyle/bare'>portNS:TrivialServicePort</wsdl-port>
+ <service-endpoint-interface>org.jboss.test.ws.jaxrpc.samples.docstyle.bare.TrivialService</service-endpoint-interface>
+ <service-impl-bean>
+ <servlet-link>TrivialEndpoint</servlet-link>
+ </service-impl-bean>
+ </port-component>
+ </webservice-description>
+</webservices>
\ No newline at end of file
14 years
JBossWS SVN: r13365 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-30 03:25:28 -0500 (Tue, 30 Nov 2010)
New Revision: 13365
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
Log:
[JBWS-3171] create WS ctx for EJB3 WS endpoints too
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-11-30 08:23:39 UTC (rev 13364)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-11-30 08:25:28 UTC (rev 13365)
@@ -333,7 +333,8 @@
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext instanceof SOAPMessageContextJAXWS)
{
- if (ep.getService().getDeployment().getType() == DeploymentType.JAXWS_JSE)
+ final DeploymentType deploymentType = ep.getService().getDeployment().getType();
+ if (DeploymentType.JAXWS_JSE == deploymentType)
{
if (msgContext.get(MessageContext.SERVLET_REQUEST) != null)
{
@@ -345,6 +346,11 @@
log.warn("Cannot provide WebServiceContext, since the current MessageContext does not provide a ServletRequest");
}
}
+ else if (DeploymentType.JAXWS_EJB3 == deploymentType)
+ {
+ WebServiceContext wsContext = contextFactory.newWebServiceContext(InvocationType.JAXWS_EJB3, (SOAPMessageContextJAXWS)msgContext);
+ invContext.addAttachment(WebServiceContext.class, wsContext);
+ }
invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
}
if (msgContext instanceof SOAPMessageContextJAXRPC)
14 years
JBossWS SVN: r13364 - stack/native/branches/jbossws-native-3.4.1/modules/core/src/main/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-30 03:23:39 -0500 (Tue, 30 Nov 2010)
New Revision: 13364
Modified:
stack/native/branches/jbossws-native-3.4.1/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
Log:
[JBWS-3171] create WS ctx for EJB3 WS endpoints too
Modified: stack/native/branches/jbossws-native-3.4.1/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- stack/native/branches/jbossws-native-3.4.1/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-11-29 16:32:03 UTC (rev 13363)
+++ stack/native/branches/jbossws-native-3.4.1/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-11-30 08:23:39 UTC (rev 13364)
@@ -333,7 +333,8 @@
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext instanceof SOAPMessageContextJAXWS)
{
- if (ep.getService().getDeployment().getType() == DeploymentType.JAXWS_JSE)
+ final DeploymentType deploymentType = ep.getService().getDeployment().getType();
+ if (DeploymentType.JAXWS_JSE == deploymentType)
{
if (msgContext.get(MessageContext.SERVLET_REQUEST) != null)
{
@@ -345,6 +346,11 @@
log.warn("Cannot provide WebServiceContext, since the current MessageContext does not provide a ServletRequest");
}
}
+ else if (DeploymentType.JAXWS_EJB3 == deploymentType)
+ {
+ WebServiceContext wsContext = contextFactory.newWebServiceContext(InvocationType.JAXWS_EJB3, (SOAPMessageContextJAXWS)msgContext);
+ invContext.addAttachment(WebServiceContext.class, wsContext);
+ }
invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
}
if (msgContext instanceof SOAPMessageContextJAXRPC)
14 years
JBossWS SVN: r13363 - common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/injection.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-29 11:32:03 -0500 (Mon, 29 Nov 2010)
New Revision: 13363
Modified:
common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java
Log:
according to JAXWS spec, it is recommended to throw IllegalStateException if WS context is accessed in wrong conditions
Modified: common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java
===================================================================
--- common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java 2010-11-29 16:31:43 UTC (rev 13362)
+++ common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java 2010-11-29 16:32:03 UTC (rev 13363)
@@ -57,32 +57,62 @@
public EndpointReference getEndpointReference(final Element... referenceParameters)
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getEndpointReference(referenceParameters);
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getEndpointReference(referenceParameters);
}
public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz,
final Element... referenceParameters)
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getEndpointReference(clazz, referenceParameters);
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getEndpointReference(clazz, referenceParameters);
}
public MessageContext getMessageContext()
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getMessageContext();
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getMessageContext();
}
public Principal getUserPrincipal()
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getUserPrincipal();
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getUserPrincipal();
}
public boolean isUserInRole(String role)
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? false : delegee.isUserInRole(role);
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.isUserInRole(role);
}
}
14 years
JBossWS SVN: r13362 - common/trunk/src/main/java/org/jboss/wsf/common/injection.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-29 11:31:43 -0500 (Mon, 29 Nov 2010)
New Revision: 13362
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java
Log:
according to JAXWS spec, it is recommended to throw IllegalStateException if WS context is accessed in wrong conditions
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java 2010-11-29 16:23:05 UTC (rev 13361)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java 2010-11-29 16:31:43 UTC (rev 13362)
@@ -57,32 +57,62 @@
public EndpointReference getEndpointReference(final Element... referenceParameters)
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getEndpointReference(referenceParameters);
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getEndpointReference(referenceParameters);
}
public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz,
final Element... referenceParameters)
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getEndpointReference(clazz, referenceParameters);
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getEndpointReference(clazz, referenceParameters);
}
public MessageContext getMessageContext()
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getMessageContext();
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getMessageContext();
}
public Principal getUserPrincipal()
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? null : delegee.getUserPrincipal();
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.getUserPrincipal();
}
public boolean isUserInRole(String role)
{
final WebServiceContext delegee = this.contexts.get();
- return delegee == null ? false : delegee.isUserInRole(role);
+
+ if (delegee == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegee.isUserInRole(role);
}
}
14 years
JBossWS SVN: r13361 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-29 11:23:05 -0500 (Mon, 29 Nov 2010)
New Revision: 13361
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java
Log:
Each resource may only be injected into a single field or method of a given
name in a given class. Requesting injection of the java:comp/env/
com.example.MyApp/myDatabase resource into both the setMyDatabase method
and the myDatabase field is an error
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java 2010-11-29 16:22:13 UTC (rev 13360)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java 2010-11-29 16:23:05 UTC (rev 13361)
@@ -177,7 +177,7 @@
private String string1;
@Resource(name = "string")
- private void setString(String s)
+ private void setString1(String s)
{
this.string1 = s;
}
14 years
JBossWS SVN: r13360 - framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-29 11:22:13 -0500 (Mon, 29 Nov 2010)
New Revision: 13360
Modified:
framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java
Log:
Each resource may only be injected into a single field or method of a given
name in a given class. Requesting injection of the java:comp/env/
com.example.MyApp/myDatabase resource into both the setMyDatabase method
and the myDatabase field is an error
Modified: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java 2010-11-29 14:00:31 UTC (rev 13359)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java 2010-11-29 16:22:13 UTC (rev 13360)
@@ -177,7 +177,7 @@
private String string1;
@Resource(name = "string")
- private void setString(String s)
+ private void setString1(String s)
{
this.string1 = s;
}
14 years