Author: richard.opalka(a)jboss.com
Date: 2007-12-05 07:55:00 -0500 (Wed, 05 Dec 2007)
New Revision: 5188
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMBackPortsServerConfig.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java
stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java
stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml
Log:
backports server is now configurable
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-12-05
10:10:32 UTC (rev 5187)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-12-05
12:55:00 UTC (rev 5188)
@@ -21,8 +21,10 @@
*/
package org.jboss.ws.extensions.wsrm;
+import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.UnknownHostException;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
@@ -94,18 +96,34 @@
{
super();
if (wsrmConfig == null)
- throw new IllegalArgumentException();
+ throw new RMException("WS-RM configuration missing");
+ if (wsrmConfig.getBackPortsServer() == null)
+ throw new RMException("WS-RM backports server configuration
missing");
this.addressableClient = addrType;
this.wsrmConfig = wsrmConfig;
try
{
- this.backPort = new
URI("http://localhost:8888/temporary_listen_address/" +
UUIDGenerator.generateRandomUUIDString());
+ String host = wsrmConfig.getBackPortsServer().getHost();
+ if (host == null)
+ {
+ host = InetAddress.getLocalHost().getCanonicalHostName();
+ logger.debug("Backports server configuration omits host configuration -
using autodetected " + host);
+ }
+ String port = wsrmConfig.getBackPortsServer().getPort();
+ String path = "/temporary_listen_address/" +
UUIDGenerator.generateRandomUUIDString();
+ this.backPort = new URI("http://" + host + ":" + port +
path);
}
catch (URISyntaxException use)
{
logger.warn(use);
+ throw new RMException(use.getMessage(), use);
}
+ catch (UnknownHostException uhe)
+ {
+ logger.warn(uhe);
+ throw new RMException(uhe.getMessage(), uhe);
+ }
}
public final Set<Long> getReceivedInboundMessages()
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMBackPortsServerConfig.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMBackPortsServerConfig.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMBackPortsServerConfig.java 2007-12-05
12:55:00 UTC (rev 5188)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.extensions.wsrm.config;
+
+/**
+ * Reliable messaging backports server provider metadata
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Dec 5, 2007
+ */
+public final class RMBackPortsServerConfig
+{
+
+ private String host;
+ private String port;
+
+ public final String getHost()
+ {
+ return host;
+ }
+
+ public final void setHost(String hostname)
+ {
+ this.host = hostname;
+ }
+
+ public final String getPort()
+ {
+ return port;
+ }
+
+ public final void setPort(String port)
+ {
+ this.port = port;
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMBackPortsServerConfig.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java 2007-12-05
10:10:32 UTC (rev 5187)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java 2007-12-05
12:55:00 UTC (rev 5188)
@@ -34,6 +34,7 @@
private RMDeliveryAssuranceConfig deliveryAssurance;
private RMProviderConfig provider;
+ private RMBackPortsServerConfig backportsServer;
private RMMessageStoreConfig messageStore;
private List<RMPortConfig> ports = new LinkedList<RMPortConfig>();
@@ -50,6 +51,16 @@
return this.deliveryAssurance;
}
+ public final void setBackPortsServer(RMBackPortsServerConfig backportsServer)
+ {
+ this.backportsServer = backportsServer;
+ }
+
+ public final RMBackPortsServerConfig getBackPortsServer()
+ {
+ return this.backportsServer;
+ }
+
public final void setProvider(RMProviderConfig provider)
{
if (provider == null)
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java 2007-12-05
10:10:32 UTC (rev 5187)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java 2007-12-05
12:55:00 UTC (rev 5188)
@@ -38,6 +38,7 @@
import org.xml.sax.Attributes;
import org.jboss.ws.extensions.wsrm.RMDeliveryAssurance;
import org.jboss.ws.extensions.wsrm.RMDeliveryAssuranceFactory;
+import org.jboss.ws.extensions.wsrm.config.RMBackPortsServerConfig;
import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
import org.jboss.ws.extensions.wsrm.config.RMMessageStoreConfig;
import org.jboss.ws.extensions.wsrm.config.RMConfig;
@@ -152,6 +153,24 @@
wsrmConfig.setDeliveryAssurance(deliveryAssurance);
return deliveryAssurance;
}
+ if (localName.equals("backports-server"))
+ {
+ String host = null, port = null;
+ for (int i = 0; i < countOfAttributes && (host == null || port ==
null); i++)
+ {
+ String attrLocalName = attrs.getLocalName(i);
+ if (attrLocalName.equals("host"))
+ host = attrs.getValue(i);
+ if (attrLocalName.equals("port"))
+ port = attrs.getValue(i);
+ }
+
+ RMBackPortsServerConfig backportsServer = new RMBackPortsServerConfig();
+ backportsServer.setHost(host);
+ backportsServer.setPort(port);
+ wsrmConfig.setBackPortsServer(backportsServer);
+ return backportsServer;
+ }
if (localName.equals("provider"))
{
String specVersion = null;
Modified: stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd
===================================================================
--- stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd 2007-12-05 10:10:32
UTC (rev 5187)
+++ stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd 2007-12-05 12:55:00
UTC (rev 5188)
@@ -71,6 +71,14 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
+ <xsd:element name="backports-server"
type="tns:backportsServerType" minOccurs="0"
maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+ Backports server configuration to be used for addressable clients.
+ Users must always configure backports server on client machines.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
<xsd:element name="provider" type="tns:providerType">
<xsd:annotation>
<xsd:documentation>
@@ -94,6 +102,23 @@
</xsd:element>
</xsd:sequence>
</xsd:complexType>
+ <xsd:complexType name="backportsServerType">
+ <xsd:attribute name="host" type="xsd:string"
use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ Host name to be used for backports server. If not specified default one will be
detected.
+ Make sure you have DNS correctly configured so runtime is able to detect your
real hostname.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="port" type="xsd:int"
use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Port number to be used for backports server.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
<xsd:complexType name="msgStoreType">
<xsd:sequence>
<xsd:element name="config-file" type="xsd:string">
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java 2007-12-05
10:10:32 UTC (rev 5187)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java 2007-12-05
12:55:00 UTC (rev 5188)
@@ -26,14 +26,12 @@
import javax.xml.namespace.QName;
-import org.jboss.ws.extensions.wsrm.RMDeliveryAssurance;
-import org.jboss.ws.extensions.wsrm.RMDeliveryQuality;
+import org.jboss.ws.extensions.wsrm.config.RMBackPortsServerConfig;
import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
import org.jboss.ws.extensions.wsrm.config.RMMessageStoreConfig;
import org.jboss.ws.extensions.wsrm.config.RMConfig;
import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
import org.jboss.ws.extensions.wsrm.config.RMProviderConfig;
-import org.jboss.ws.extensions.wsrm.spi.RMProvider;
import org.jboss.ws.metadata.config.EndpointProperty;
import org.jboss.ws.metadata.config.JBossWSConfigFactory;
import org.jboss.ws.metadata.config.jaxrpc.CommonConfigJAXRPC;
@@ -157,5 +155,8 @@
assertEquals(port2.getPortName(), new QName("http://custom/namespace/",
"Port2"));
assertEquals(port2.getDeliveryAssurance().getInOrder(), "true");
assertEquals(port2.getDeliveryAssurance().getQuality(), "ExactlyOnce");
+ RMBackPortsServerConfig backportsServer = wsrmConfig.getBackPortsServer();
+ assertEquals(backportsServer.getHost(), "realhostname.realdomain");
+ assertEquals(backportsServer.getPort(), "9999");
}
}
Modified: stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml
===================================================================
---
stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml 2007-12-05
10:10:32 UTC (rev 5187)
+++
stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml 2007-12-05
12:55:00 UTC (rev 5188)
@@ -46,6 +46,7 @@
<config-name>Standard WSRM Endpoint</config-name>
<reliable-messaging>
<delivery-assurance inOrder="true"
quality="AtLeastOnce"/>
+ <backports-server host="realhostname.realdomain"
port="9999"/>
<provider
specVersion="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<message-store
Modified:
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml
===================================================================
---
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml 2007-12-05
10:10:32 UTC (rev 5187)
+++
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml 2007-12-05
12:55:00 UTC (rev 5188)
@@ -10,6 +10,7 @@
<config-name>Standard WSRM Client</config-name>
<reliable-messaging>
<delivery-assurance inOrder="true"
quality="AtLeastOnce"/>
+ <backports-server port="7777"/>
<provider
specVersion="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<message-store id="wsrmStoreId"
class="custom.MessageStoreImpl">
<config-file>META-INF/config.xml</config-file>