Author: david.lloyd(a)jboss.com
Date: 2010-03-08 21:13:45 -0500 (Mon, 08 Mar 2010)
New Revision: 5806
Modified:
remoting-mc-int/trunk/pom.xml
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java
remoting-mc-int/trunk/src/main/resources/META-INF/jboss-remoting_3_1.xsd
Log:
Updates for Beta2
Modified: remoting-mc-int/trunk/pom.xml
===================================================================
--- remoting-mc-int/trunk/pom.xml 2010-03-08 23:32:07 UTC (rev 5805)
+++ remoting-mc-int/trunk/pom.xml 2010-03-09 02:13:45 UTC (rev 5806)
@@ -31,16 +31,16 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<name>JBoss Remoting Metadata</name>
<artifactId>jboss-remoting-metadata</artifactId>
<packaging>jar</packaging>
<version>3.1.0.Beta1-SNAPSHOT</version>
<dependencies>
<dependency>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
- <version>3.1.0.Beta1</version>
+ <version>3.1.0.Beta2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.xnio</groupId>
Modified:
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java
===================================================================
---
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java 2010-03-08
23:32:07 UTC (rev 5805)
+++
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java 2010-03-09
02:13:45 UTC (rev 5806)
@@ -34,6 +34,8 @@
@XmlType(name = "endpoint", propOrder = {})
public final class EndpointMetaData {
private RefMetaData executor;
+ private RefMetaData tcpConnector;
+ private RefMetaData sslConnector;
private List<OptionMetaData> options = new ArrayList<OptionMetaData>();
private String name;
private boolean defaultFlag = false;
@@ -51,6 +53,24 @@
return options;
}
+ public RefMetaData getTcpConnector() {
+ return tcpConnector;
+ }
+
+ @XmlElement(name = "tcp-connector", required = true)
+ public void setTcpConnector(final RefMetaData tcpConnector) {
+ this.tcpConnector = tcpConnector;
+ }
+
+ public RefMetaData getSslConnector() {
+ return sslConnector;
+ }
+
+ @XmlElement(name = "ssl-connector")
+ public void setSslConnector(final RefMetaData sslConnector) {
+ this.sslConnector = sslConnector;
+ }
+
@XmlElementWrapper(name = "options")
@XmlElement(name = "option", type = OptionMetaData.class)
public void setOptions(final List<OptionMetaData> options) {
Modified:
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java
===================================================================
---
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java 2010-03-08
23:32:07 UTC (rev 5805)
+++
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java 2010-03-09
02:13:45 UTC (rev 5806)
@@ -22,12 +22,21 @@
package org.jboss.remoting3.metadata;
+import java.io.IOException;
import java.net.InetSocketAddress;
+import java.util.concurrent.Executor;
import org.jboss.remoting3.Endpoint;
+import org.jboss.remoting3.Remoting;
import org.jboss.remoting3.UnknownURISchemeException;
+import org.jboss.remoting3.remote.RemoteProtocol;
+import org.jboss.remoting3.spi.ConnectionProvider;
+import org.jboss.remoting3.spi.ConnectionProviderContext;
+import org.jboss.remoting3.spi.ConnectionProviderFactory;
import org.jboss.remoting3.spi.NetworkServerProvider;
import org.jboss.xnio.ChannelListener;
import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.SslTcpConnector;
+import org.jboss.xnio.TcpConnector;
import org.jboss.xnio.channels.ConnectedStreamChannel;
/**
@@ -39,4 +48,20 @@
public static ChannelListener<ConnectedStreamChannel<InetSocketAddress>>
createServer(Endpoint endpoint, String protocol, OptionMap optionMap) throws
UnknownURISchemeException {
return endpoint.getConnectionProviderInterface(protocol,
NetworkServerProvider.class).getServerListener(optionMap);
}
+
+ public static Endpoint createEndpoint(final String name, final TcpConnector
tcpConnector, final SslTcpConnector sslConnector, final Executor executor, final OptionMap
optionMap) throws IOException {
+
+ final Endpoint endpoint = Remoting.createEndpoint(name, executor, optionMap);
+ endpoint.addConnectionProvider("remote", new
ConnectionProviderFactory() {
+ public ConnectionProvider createInstance(final ConnectionProviderContext
context) {
+ return RemoteProtocol.getRemoteConnectionProvider(context,
tcpConnector);
+ }
+ });
+ if (sslConnector != null) endpoint.addConnectionProvider("remote+ssl",
new ConnectionProviderFactory() {
+ public ConnectionProvider createInstance(final ConnectionProviderContext
context) {
+ return RemoteProtocol.getRemoteConnectionProvider(context,
sslConnector);
+ }
+ });
+ return endpoint;
+ }
}
Modified:
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java
===================================================================
---
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java 2010-03-08
23:32:07 UTC (rev 5805)
+++
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java 2010-03-09
02:13:45 UTC (rev 5806)
@@ -12,12 +12,16 @@
import org.jboss.remoting3.Connection;
import org.jboss.remoting3.Endpoint;
import org.jboss.remoting3.Remoting;
+import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.RequestListener;
import org.jboss.remoting3.security.SimpleClientCallbackHandler;
import org.jboss.xb.annotations.JBossXmlSchema;
import org.jboss.xnio.ChannelListener;
import org.jboss.xnio.Option;
import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.Options;
+import org.jboss.xnio.SslTcpConnector;
+import org.jboss.xnio.TcpConnector;
import org.jboss.xnio.metadata.OptionMetaData;
import javax.xml.bind.annotation.XmlElement;
@@ -192,9 +196,12 @@
builder.ignoreDestroy();
builder.ignoreStart();
builder.setStop("close");
- builder.setFactoryClass(Remoting.class.getName());
+ builder.setFactoryClass(RemotingHelper.class.getName());
builder.setFactoryMethod("createEndpoint");
builder.addConstructorParameter(String.class.getName(), name);
+ builder.addConstructorParameter(TcpConnector.class.getName(),
builder.createInject(endpointMetaData.getTcpConnector().getName()));
+ final RefMetaData sslRef = endpointMetaData.getSslConnector();
+ builder.addConstructorParameter(SslTcpConnector.class.getName(), sslRef ==
null ? builder.createNull() : builder.createInject(sslRef.getName()));
builder.addConstructorParameter(Executor.class.getName(),
builder.createInject(endpointMetaData.getExecutor().getName()));
builder.addConstructorParameter(OptionMap.class.getName(),
createOptionMap(endpointMetaData.getOptions()));
metaDataList.add(builder.getBeanMetaData());
@@ -206,7 +213,19 @@
if (options.isEmpty()) return OptionMap.EMPTY;
final OptionMap.Builder builder = OptionMap.builder();
for (OptionMetaData option : options) {
- final Option<?> real = Option.fromString(option.getClassName() +
"." + option.getName(), Remoting.class.getClassLoader());
+ final String className = option.getClassName();
+ final Option<?> real;
+ if (className == null || className.length() == 0) {
+ Option<?> test;
+ try {
+ test = Option.fromString(RemotingOptions.class.getName() +
"." + option.getName(), Remoting.class.getClassLoader());
+ } catch (IllegalArgumentException e) {
+ test = Option.fromString(Options.class.getName() + "." +
option.getName(), Remoting.class.getClassLoader());
+ }
+ real = test;
+ } else {
+ real = Option.fromString(className + "." + option.getName(),
Remoting.class.getClassLoader());
+ }
builder.parse(real, option.getValue());
}
return builder.getMap();
Modified: remoting-mc-int/trunk/src/main/resources/META-INF/jboss-remoting_3_1.xsd
===================================================================
--- remoting-mc-int/trunk/src/main/resources/META-INF/jboss-remoting_3_1.xsd 2010-03-08
23:32:07 UTC (rev 5805)
+++ remoting-mc-int/trunk/src/main/resources/META-INF/jboss-remoting_3_1.xsd 2010-03-09
02:13:45 UTC (rev 5806)
@@ -36,7 +36,6 @@
<xs:element name="server" type="server"/>
<xs:element name="connection" type="connection"/>
<xs:element name="endpoint" type="endpoint"/>
- <xs:element name="protocol-service"
type="protocol-service"/>
</xs:choice>
<xs:attribute name="endpoint" type="xs:string"
use="optional"/>
</xs:complexType>
@@ -96,6 +95,8 @@
<xs:all>
<xs:element name="executor" type="ref"/>
<xs:element name="options" type="xnio:optionsType"
minOccurs="0"/>
+ <xs:element name="tcp-connector" type="ref"/>
+ <xs:element name="ssl-connector" type="ref"
minOccurs="0"/>
</xs:all>
<xs:attribute name="name" type="xs:string"
use="required"/>
<xs:attribute name="default" type="xs:boolean"
use="optional" default="false"/>
@@ -104,11 +105,4 @@
<xs:complexType name="ref">
<xs:attribute name="name" type="xs:string"
use="required"/>
</xs:complexType>
-
- <xs:complexType name="protocol-service">
- <xs:attribute name="type" type="xs:string"
use="required"/>
- <xs:attribute name="name" type="xs:string"
use="required"/>
- <xs:attribute name="register-as" type="xs:string"
use="required"/>
- </xs:complexType>
-
</xs:schema>