Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-03-24 16:16:45 +0000
committerEike Stepper2020-03-24 16:16:45 +0000
commit2b493f78abedf6edcb6710e74708272deadf163c (patch)
tree117c119ec7fff43e7835ef57c49a9ee441950aae
parent850a75fe1a44b4245f4bcffcfd9d7e8b49746e8d (diff)
downloadcdo-2b493f78abedf6edcb6710e74708272deadf163c.tar.gz
cdo-2b493f78abedf6edcb6710e74708272deadf163c.tar.xz
cdo-2b493f78abedf6edcb6710e74708272deadf163c.zip
[561421] Provide configurable AcceptorDescriptionParsers for the TransportConfigurator
https://bugs.eclipse.org/bugs/show_bug.cgi?id=561421
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.master/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.product/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.product/pom.xml2
-rw-r--r--plugins/org.eclipse.net4j.http.server/plugin.xml4
-rw-r--r--plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/internal/server/HTTPAcceptor.java27
-rw-r--r--plugins/org.eclipse.net4j.jvm/.settings/.api_filters22
-rw-r--r--plugins/org.eclipse.net4j.jvm/plugin.xml4
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java27
-rw-r--r--plugins/org.eclipse.net4j.tcp/plugin.xml26
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java30
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLAcceptor.java29
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java2
-rw-r--r--plugins/org.eclipse.net4j.ws/plugin.xml4
-rw-r--r--plugins/org.eclipse.net4j.ws/src/org/eclipse/net4j/internal/ws/WSAcceptor.java28
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportConfigurator.java48
21 files changed, 227 insertions, 42 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF
index 0e74c60639..624fc7e2e6 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.master;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.1.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
index 27526095a7..65b63a4128 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
@@ -8,6 +8,8 @@
<acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/>
<!-- Examples:
+ <acceptor type="ws" name="cdo_acceptor"/>
+ <acceptor type="jvm" name="cdo_acceptor"/>
<acceptor type="ssl" listenAddr="0.0.0.0" port="2036"/>
<acceptor type="http"/>
-->
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/pom.xml b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/pom.xml
index a11b9827cb..c03534406b 100644
--- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.examples.master</artifactId>
- <version>4.2.0-SNAPSHOT</version>
+ <version>4.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF
index 0e74c60639..624fc7e2e6 100644
--- a/plugins/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.master/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.master;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.1.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
index 27526095a7..65b63a4128 100644
--- a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml
@@ -8,6 +8,8 @@
<acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/>
<!-- Examples:
+ <acceptor type="ws" name="cdo_acceptor"/>
+ <acceptor type="jvm" name="cdo_acceptor"/>
<acceptor type="ssl" listenAddr="0.0.0.0" port="2036"/>
<acceptor type="http"/>
-->
diff --git a/plugins/org.eclipse.emf.cdo.examples.master/pom.xml b/plugins/org.eclipse.emf.cdo.examples.master/pom.xml
index a11b9827cb..c03534406b 100644
--- a/plugins/org.eclipse.emf.cdo.examples.master/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.examples.master/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.examples.master</artifactId>
- <version>4.2.0-SNAPSHOT</version>
+ <version>4.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.server.product/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.product/META-INF/MANIFEST.MF
index 83848adbac..8b3383498a 100644
--- a/plugins/org.eclipse.emf.cdo.server.product/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.product/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server.product;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.1.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml
index 75ebfa4163..0c8788bda5 100644
--- a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml
+++ b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml
@@ -8,6 +8,8 @@
<acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/>
<!-- Examples:
+ <acceptor type="ws" name="cdo_acceptor"/>
+ <acceptor type="jvm" name="cdo_acceptor"/>
<acceptor type="ssl" listenAddr="0.0.0.0" port="2036"/>
<acceptor type="http"/>
-->
diff --git a/plugins/org.eclipse.emf.cdo.server.product/pom.xml b/plugins/org.eclipse.emf.cdo.server.product/pom.xml
index 42fca66be6..7c6ba54ce3 100644
--- a/plugins/org.eclipse.emf.cdo.server.product/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.server.product/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.server.product</artifactId>
- <version>4.2.0-SNAPSHOT</version>
+ <version>4.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.net4j.http.server/plugin.xml b/plugins/org.eclipse.net4j.http.server/plugin.xml
index 30230cedf2..444e2e2b35 100644
--- a/plugins/org.eclipse.net4j.http.server/plugin.xml
+++ b/plugins/org.eclipse.net4j.http.server/plugin.xml
@@ -16,6 +16,10 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
+ class="org.eclipse.net4j.http.internal.server.HTTPAcceptor$DescriptionParserFactory"
+ productGroup="org.eclipse.net4j.acceptorDescriptionParsers"
+ type="jvm"/>
+ <factory
class="org.eclipse.net4j.http.internal.server.HTTPAcceptorFactory"
productGroup="org.eclipse.net4j.acceptors"
type="http"/>
diff --git a/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/internal/server/HTTPAcceptor.java b/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/internal/server/HTTPAcceptor.java
index 4dc250d08f..b463d362df 100644
--- a/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/internal/server/HTTPAcceptor.java
+++ b/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/internal/server/HTTPAcceptor.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.net4j.http.internal.server;
+import org.eclipse.net4j.TransportConfigurator.AcceptorDescriptionParser;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.http.common.IHTTPConnector;
import org.eclipse.net4j.http.internal.common.HTTPConnector;
@@ -19,6 +20,7 @@ import org.eclipse.net4j.http.server.IHTTPAcceptor;
import org.eclipse.net4j.http.server.INet4jTransportServlet;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.concurrent.Worker;
+import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -29,6 +31,8 @@ import org.eclipse.net4j.util.security.IRandomizer;
import org.eclipse.spi.net4j.Acceptor;
import org.eclipse.spi.net4j.InternalConnector;
+import org.w3c.dom.Element;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
@@ -269,4 +273,27 @@ public class HTTPAcceptor extends Acceptor implements IHTTPAcceptor, INet4jTrans
return maxIdleTime;
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class DescriptionParserFactory extends AcceptorDescriptionParser.Factory implements AcceptorDescriptionParser
+ {
+ public DescriptionParserFactory()
+ {
+ super(HTTPAcceptorFactory.TYPE);
+ }
+
+ @Override
+ public AcceptorDescriptionParser create(String description) throws ProductCreationException
+ {
+ return this;
+ }
+
+ @Override
+ public String getAcceptorDescription(Element acceptorConfig)
+ {
+ return null;
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.jvm/.settings/.api_filters b/plugins/org.eclipse.net4j.jvm/.settings/.api_filters
index 15052b0959..328fae4cc8 100644
--- a/plugins/org.eclipse.net4j.jvm/.settings/.api_filters
+++ b/plugins/org.eclipse.net4j.jvm/.settings/.api_filters
@@ -1,27 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.net4j.jvm" version="2">
- <resource path="src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java" type="org.eclipse.net4j.internal.jvm.JVMAcceptor">
- <filter id="574619656">
- <message_arguments>
- <message_argument value="IJVMAcceptor"/>
- <message_argument value="JVMAcceptor"/>
- </message_arguments>
- </filter>
- <filter id="643842064">
- <message_arguments>
- <message_argument value="JVMServerConnector"/>
- <message_argument value="JVMAcceptor"/>
- <message_argument value="handleAccept(JVMClientConnector)"/>
- </message_arguments>
- </filter>
- <filter id="643846161">
- <message_arguments>
- <message_argument value="JVMClientConnector"/>
- <message_argument value="JVMAcceptor"/>
- <message_argument value="handleAccept(JVMClientConnector)"/>
- </message_arguments>
- </filter>
- </resource>
<resource path="src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactory.java" type="org.eclipse.net4j.internal.jvm.JVMAcceptorFactory">
<filter id="643842064">
<message_arguments>
diff --git a/plugins/org.eclipse.net4j.jvm/plugin.xml b/plugins/org.eclipse.net4j.jvm/plugin.xml
index 581c29b3d1..5313ea08f7 100644
--- a/plugins/org.eclipse.net4j.jvm/plugin.xml
+++ b/plugins/org.eclipse.net4j.jvm/plugin.xml
@@ -16,6 +16,10 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
+ class="org.eclipse.net4j.internal.jvm.JVMAcceptor$DescriptionParserFactory"
+ productGroup="org.eclipse.net4j.acceptorDescriptionParsers"
+ type="jvm"/>
+ <factory
class="org.eclipse.net4j.internal.jvm.JVMAcceptorFactory"
productGroup="org.eclipse.net4j.acceptors"
type="jvm"/>
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
index 51cac6fbf4..7972d72d4d 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
@@ -10,11 +10,15 @@
*/
package org.eclipse.net4j.internal.jvm;
+import org.eclipse.net4j.TransportConfigurator.AcceptorDescriptionParser;
import org.eclipse.net4j.jvm.IJVMAcceptor;
import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.spi.net4j.Acceptor;
+import org.w3c.dom.Element;
+
import java.text.MessageFormat;
/**
@@ -78,4 +82,27 @@ public class JVMAcceptor extends Acceptor implements IJVMAcceptor
JVMAcceptorManager.INSTANCE.deregisterAcceptor(this);
super.doDeactivate();
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class DescriptionParserFactory extends AcceptorDescriptionParser.Factory implements AcceptorDescriptionParser
+ {
+ public DescriptionParserFactory()
+ {
+ super(JVMAcceptorFactory.TYPE);
+ }
+
+ @Override
+ public AcceptorDescriptionParser create(String description) throws ProductCreationException
+ {
+ return this;
+ }
+
+ @Override
+ public String getAcceptorDescription(Element acceptorConfig)
+ {
+ return acceptorConfig.getAttribute("name"); //$NON-NLS-1$
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.tcp/plugin.xml b/plugins/org.eclipse.net4j.tcp/plugin.xml
index c54ef87c84..55e991c2f3 100644
--- a/plugins/org.eclipse.net4j.tcp/plugin.xml
+++ b/plugins/org.eclipse.net4j.tcp/plugin.xml
@@ -16,13 +16,13 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
- class="org.eclipse.net4j.internal.tcp.ssl.SSLAcceptorFactory"
- productGroup="org.eclipse.net4j.acceptors"
- type="ssl"/>
+ class="org.eclipse.net4j.internal.tcp.TCPSelectorFactory"
+ productGroup="org.eclipse.net4j.selectors"
+ type="tcp"/>
<factory
- class="org.eclipse.net4j.internal.tcp.ssl.SSLConnectorFactory"
- productGroup="org.eclipse.net4j.connectors"
- type="ssl"/>
+ class="org.eclipse.net4j.internal.tcp.TCPAcceptor$DescriptionParserFactory"
+ productGroup="org.eclipse.net4j.acceptorDescriptionParsers"
+ type="tcp"/>
<factory
class="org.eclipse.net4j.internal.tcp.TCPAcceptorFactory"
productGroup="org.eclipse.net4j.acceptors"
@@ -32,9 +32,17 @@
productGroup="org.eclipse.net4j.connectors"
type="tcp"/>
<factory
- class="org.eclipse.net4j.internal.tcp.TCPSelectorFactory"
- productGroup="org.eclipse.net4j.selectors"
- type="tcp"/>
+ class="org.eclipse.net4j.internal.tcp.ssl.SSLAcceptor$DescriptionParserFactory"
+ productGroup="org.eclipse.net4j.acceptorDescriptionParsers"
+ type="ssl"/>
+ <factory
+ class="org.eclipse.net4j.internal.tcp.ssl.SSLAcceptorFactory"
+ productGroup="org.eclipse.net4j.acceptors"
+ type="ssl"/>
+ <factory
+ class="org.eclipse.net4j.internal.tcp.ssl.SSLConnectorFactory"
+ productGroup="org.eclipse.net4j.connectors"
+ type="ssl"/>
</extension>
<extension
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
index d4d281398e..b825560660 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
@@ -11,17 +11,22 @@
*/
package org.eclipse.net4j.internal.tcp;
+import org.eclipse.net4j.TransportConfigurator.AcceptorDescriptionParser;
import org.eclipse.net4j.internal.tcp.bundle.OM;
import org.eclipse.net4j.tcp.ITCPAcceptor;
import org.eclipse.net4j.tcp.ITCPPassiveSelectorListener;
import org.eclipse.net4j.tcp.ITCPSelector;
+import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.concurrent.Worker;
+import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.spi.net4j.Acceptor;
+import org.w3c.dom.Element;
+
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -302,4 +307,29 @@ public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPPassiveSe
selectionKey = null;
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class DescriptionParserFactory extends AcceptorDescriptionParser.Factory implements AcceptorDescriptionParser
+ {
+ public DescriptionParserFactory()
+ {
+ super(TCPUtil.FACTORY_TYPE);
+ }
+
+ @Override
+ public AcceptorDescriptionParser create(String description) throws ProductCreationException
+ {
+ return this;
+ }
+
+ @Override
+ public String getAcceptorDescription(Element acceptorConfig)
+ {
+ String listenAddr = acceptorConfig.getAttribute("listenAddr"); //$NON-NLS-1$
+ String port = acceptorConfig.getAttribute("port"); //$NON-NLS-1$
+ return (listenAddr == null ? "" : listenAddr) + (port == null ? "" : ":" + port); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLAcceptor.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLAcceptor.java
index 768c369715..c9321ecfb2 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLAcceptor.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLAcceptor.java
@@ -11,8 +11,12 @@
*/
package org.eclipse.net4j.internal.tcp.ssl;
+import org.eclipse.net4j.TransportConfigurator.AcceptorDescriptionParser;
import org.eclipse.net4j.internal.tcp.TCPAcceptor;
import org.eclipse.net4j.internal.tcp.TCPConnector;
+import org.eclipse.net4j.util.factory.ProductCreationException;
+
+import org.w3c.dom.Element;
import java.text.MessageFormat;
@@ -34,4 +38,29 @@ public class SSLAcceptor extends TCPAcceptor
{
return new SSLServerConnector(this);
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class DescriptionParserFactory extends AcceptorDescriptionParser.Factory implements AcceptorDescriptionParser
+ {
+ public DescriptionParserFactory()
+ {
+ super(SSLAcceptorFactory.TYPE);
+ }
+
+ @Override
+ public AcceptorDescriptionParser create(String description) throws ProductCreationException
+ {
+ return this;
+ }
+
+ @Override
+ public String getAcceptorDescription(Element acceptorConfig)
+ {
+ String listenAddr = acceptorConfig.getAttribute("listenAddr"); //$NON-NLS-1$
+ String port = acceptorConfig.getAttribute("port"); //$NON-NLS-1$
+ return (listenAddr == null ? "" : listenAddr) + (port == null ? "" : ":" + port); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java
index 3a830fcf96..d542c3de16 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java
@@ -181,7 +181,7 @@ public abstract class AbstractPlatform implements OMPlatform
try
{
URI uri = new URI(state);
- state = new File(new File(uri), ".metadata").getAbsolutePath(); //$NON-NLS-1$ ;
+ state = new File(new File(uri), ".metadata").getAbsolutePath(); //$NON-NLS-1$
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.ws/plugin.xml b/plugins/org.eclipse.net4j.ws/plugin.xml
index 5ba3143ab2..9b06b2d012 100644
--- a/plugins/org.eclipse.net4j.ws/plugin.xml
+++ b/plugins/org.eclipse.net4j.ws/plugin.xml
@@ -16,6 +16,10 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
+ class="org.eclipse.net4j.internal.ws.WSAcceptor$DescriptionParserFactory"
+ productGroup="org.eclipse.net4j.acceptorDescriptionParsers"
+ type="ws"/>
+ <factory
class="org.eclipse.net4j.internal.ws.WSAcceptorFactory"
productGroup="org.eclipse.net4j.acceptors"
type="ws"/>
diff --git a/plugins/org.eclipse.net4j.ws/src/org/eclipse/net4j/internal/ws/WSAcceptor.java b/plugins/org.eclipse.net4j.ws/src/org/eclipse/net4j/internal/ws/WSAcceptor.java
index 96523923e4..229330b11c 100644
--- a/plugins/org.eclipse.net4j.ws/src/org/eclipse/net4j/internal/ws/WSAcceptor.java
+++ b/plugins/org.eclipse.net4j.ws/src/org/eclipse/net4j/internal/ws/WSAcceptor.java
@@ -10,13 +10,18 @@
*/
package org.eclipse.net4j.internal.ws;
+import org.eclipse.net4j.TransportConfigurator.AcceptorDescriptionParser;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.concurrent.Worker;
+import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.ws.IWSAcceptor;
+import org.eclipse.net4j.ws.WSUtil;
import org.eclipse.net4j.ws.jetty.Net4jWebSocket;
import org.eclipse.spi.net4j.Acceptor;
+import org.w3c.dom.Element;
+
import java.text.MessageFormat;
/**
@@ -90,4 +95,27 @@ public class WSAcceptor extends Acceptor implements IWSAcceptor
WSAcceptorManager.INSTANCE.deregisterAcceptor(this);
super.doDeactivate();
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class DescriptionParserFactory extends AcceptorDescriptionParser.Factory implements AcceptorDescriptionParser
+ {
+ public DescriptionParserFactory()
+ {
+ super(WSUtil.FACTORY_TYPE);
+ }
+
+ @Override
+ public AcceptorDescriptionParser create(String description) throws ProductCreationException
+ {
+ return this;
+ }
+
+ @Override
+ public String getAcceptorDescription(Element acceptorConfig)
+ {
+ return acceptorConfig.getAttribute("name"); //$NON-NLS-1$
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportConfigurator.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportConfigurator.java
index 20dafd0f01..77acd3d3bf 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportConfigurator.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportConfigurator.java
@@ -15,8 +15,10 @@ import org.eclipse.net4j.channel.IChannelMultiplexer;
import org.eclipse.net4j.connector.IServerConnector;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.wrapping.StreamWrapperInjector;
+import org.eclipse.net4j.util.container.FactoryNotFoundException;
import org.eclipse.net4j.util.container.IElementProcessor;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.util.io.IStreamWrapper;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.security.INegotiator;
@@ -102,10 +104,23 @@ public class TransportConfigurator
protected IAcceptor configureAcceptor(Element acceptorConfig)
{
String type = acceptorConfig.getAttribute("type"); //$NON-NLS-1$
- // TODO Make the following dependent on the "type" attribute value
- String listenAddr = acceptorConfig.getAttribute("listenAddr"); //$NON-NLS-1$
- String port = acceptorConfig.getAttribute("port"); //$NON-NLS-1$
- String description = (listenAddr == null ? "" : listenAddr) + (port == null ? "" : ":" + port); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String description = acceptorConfig.getAttribute("description"); //$NON-NLS-1$
+ if (description == null || description.isEmpty())
+ {
+ try
+ {
+ AcceptorDescriptionParser parser = (AcceptorDescriptionParser)container.getElement(AcceptorDescriptionParser.Factory.PRODUCT_GROUP, type, null, true);
+ description = parser.getAcceptorDescription(acceptorConfig);
+ }
+ catch (FactoryNotFoundException | ProductCreationException ex)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(ex);
+ }
+ }
+ }
+
Acceptor acceptor = (Acceptor)container.getElement(AcceptorFactory.PRODUCT_GROUP, type, description, false);
NodeList negotiatorConfigs = acceptorConfig.getElementsByTagName("negotiator"); //$NON-NLS-1$
@@ -218,6 +233,31 @@ public class TransportConfigurator
/**
* @author Eike Stepper
+ * @since 4.10
+ */
+ public interface AcceptorDescriptionParser
+ {
+ public String getAcceptorDescription(Element acceptorConfig);
+
+ /**
+ * @author Eike Stepper
+ */
+ public static abstract class Factory extends org.eclipse.net4j.util.factory.Factory
+ {
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.acceptorDescriptionParsers";
+
+ public Factory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+
+ @Override
+ public abstract AcceptorDescriptionParser create(String description) throws ProductCreationException;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
*/
private static final class AcceptorStreamWrapperInjector extends StreamWrapperInjector
{

Back to the top