Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2013-01-20 23:42:44 +0000
committerslewis2013-01-20 23:42:44 +0000
commit2d50f085fa317aaf1b718bbe663561cc0b2677ab (patch)
tree76fd03099b90ac4a774cfb429bc5bb7b468f5b92 /server-side
parent19489cdd881495055b68ce02efa4d72615f524ad (diff)
downloadorg.eclipse.ecf-2d50f085fa317aaf1b718bbe663561cc0b2677ab.tar.gz
org.eclipse.ecf-2d50f085fa317aaf1b718bbe663561cc0b2677ab.tar.xz
org.eclipse.ecf-2d50f085fa317aaf1b718bbe663561cc0b2677ab.zip
Fixes for generic server packages
Diffstat (limited to 'server-side')
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/GenericServerContainerGroupFactory.java19
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/SSLGenericServerContainerGroupFactory.java125
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/GenericServerContainerGroup.java7
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroup.java6
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroupFactory.java9
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/SSLGenericServerContainerGroup.java4
6 files changed, 38 insertions, 132 deletions
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/GenericServerContainerGroupFactory.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/GenericServerContainerGroupFactory.java
index 67ac827ba..f91e877d2 100644
--- a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/GenericServerContainerGroupFactory.java
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/GenericServerContainerGroupFactory.java
@@ -61,10 +61,26 @@ public class GenericServerContainerGroupFactory implements IGenericServerContain
}
}
+ boolean isSSLTransportSpecified(Map defaultContainerProperties) {
+ boolean sslTransport = false;
+ if (defaultContainerProperties != null) {
+ Object sslTransportPropValue = defaultContainerProperties.get(IGenericServerContainerGroupFactory.SSL_TRANSPORT_PROPERTY);
+ if (sslTransportPropValue instanceof Boolean)
+ sslTransport = ((Boolean) sslTransportPropValue).booleanValue();
+ else if (sslTransportPropValue instanceof String)
+ sslTransport = Boolean.parseBoolean((String) sslTransportPropValue);
+
+ }
+ return sslTransport;
+ }
+
/**
* @throws GenericServerContainerGroupCreateException
*/
protected IGenericServerContainerGroup createGenericServerContainerGroup(SCGData scgdata, Map defaultContainerProperties) throws GenericServerContainerGroupCreateException {
+ boolean sslTransport = isSSLTransportSpecified(defaultContainerProperties);
+ if (sslTransport)
+ return new SSLGenericServerContainerGroup(scgdata.getHostname(), scgdata.getPort(), defaultContainerProperties);
return new GenericServerContainerGroup(scgdata.getHostname(), scgdata.getPort(), defaultContainerProperties);
}
@@ -119,7 +135,4 @@ public class GenericServerContainerGroupFactory implements IGenericServerContain
}
}
- public boolean isSecureTransport() {
- return false;
- }
}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/SSLGenericServerContainerGroupFactory.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/SSLGenericServerContainerGroupFactory.java
deleted file mode 100644
index 9653b12ed..000000000
--- a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/SSLGenericServerContainerGroupFactory.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2010 Composent, Inc. and others. All rights reserved. This
-* program and the accompanying materials are made available under the terms of
-* the Eclipse Public License v1.0 which accompanies this distribution, and is
-* available at http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Composent, Inc. - initial API and implementation
-******************************************************************************/
-package org.eclipse.ecf.internal.server.generic;
-
-import java.util.*;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.ecf.server.generic.*;
-
-public class SSLGenericServerContainerGroupFactory implements IGenericServerContainerGroupFactory {
-
- class SCGData {
- private String hostname;
- private int port;
-
- SCGData(String hostname, int port) {
- Assert.isNotNull(hostname);
- Assert.isTrue(port > 0);
- this.hostname = hostname;
- this.port = port;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public int getPort() {
- return port;
- }
-
- public boolean equals(Object other) {
- if (!(other instanceof SCGData))
- return false;
- SCGData o = (SCGData) other;
- if (this.hostname.equals(o.hostname) && this.port == o.port)
- return true;
- return false;
- }
-
- public int hashCode() {
- return this.hostname.hashCode() ^ this.port;
- }
- }
-
- private Hashtable serverContainerGroups = new Hashtable();
-
- public IGenericServerContainerGroup createContainerGroup(String hostname, int port, Map defaultContainerProperties) throws GenericServerContainerGroupCreateException {
- synchronized (serverContainerGroups) {
- SCGData scgdata = new SCGData(hostname, port);
- if (serverContainerGroups.contains(scgdata))
- throw new GenericServerContainerGroupCreateException("Cannot container group hostname=" + hostname + " port=" + port + " already exists"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- IGenericServerContainerGroup scg = createGenericServerContainerGroup(scgdata, defaultContainerProperties);
- serverContainerGroups.put(scgdata, scg);
- return scg;
- }
- }
-
- /**
- * @throws GenericServerContainerGroupCreateException
- */
- protected IGenericServerContainerGroup createGenericServerContainerGroup(SCGData scgdata, Map defaultContainerProperties) throws GenericServerContainerGroupCreateException {
- return new SSLGenericServerContainerGroup(scgdata.getHostname(), scgdata.getPort(), defaultContainerProperties);
- }
-
- public IGenericServerContainerGroup createContainerGroup(String hostname, int port) throws GenericServerContainerGroupCreateException {
- return createContainerGroup(hostname, port, null);
- }
-
- public IGenericServerContainerGroup createContainerGroup(String hostname) throws GenericServerContainerGroupCreateException {
- return createContainerGroup(hostname, DEFAULT_SECURE_PORT);
- }
-
- public void close() {
- synchronized (serverContainerGroups) {
- for (Iterator i = serverContainerGroups.keySet().iterator(); i.hasNext();) {
- SCGData scgdata = (SCGData) i.next();
- IGenericServerContainerGroup scg = (IGenericServerContainerGroup) serverContainerGroups.get(scgdata);
- // call close
- scg.close();
- }
- }
- serverContainerGroups.clear();
- }
-
- public IGenericServerContainerGroup getContainerGroup(String hostname, int port) {
- if (hostname == null)
- return null;
- SCGData scgdata = new SCGData(hostname, port);
- synchronized (serverContainerGroups) {
- return (IGenericServerContainerGroup) serverContainerGroups.get(scgdata);
- }
- }
-
- public IGenericServerContainerGroup[] getContainerGroups() {
- List results = new ArrayList();
- synchronized (serverContainerGroups) {
- for (Iterator i = serverContainerGroups.keySet().iterator(); i.hasNext();) {
- SCGData scgdata = (SCGData) i.next();
- IGenericServerContainerGroup gscg = (IGenericServerContainerGroup) serverContainerGroups.get(scgdata);
- if (gscg != null)
- results.add(gscg);
- }
- }
- return (IGenericServerContainerGroup[]) results.toArray(new IGenericServerContainerGroup[] {});
- }
-
- public IGenericServerContainerGroup removeContainerGroup(String hostname, int port) {
- if (hostname == null)
- return null;
- SCGData scgdata = new SCGData(hostname, port);
- synchronized (serverContainerGroups) {
- return (IGenericServerContainerGroup) serverContainerGroups.remove(scgdata);
- }
- }
-
- public boolean isSecureTransport() {
- return true;
- }
-}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/GenericServerContainerGroup.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/GenericServerContainerGroup.java
index d9ef3b722..789d53407 100644
--- a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/GenericServerContainerGroup.java
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/GenericServerContainerGroup.java
@@ -183,4 +183,11 @@ public class GenericServerContainerGroup implements IGenericServerContainerGroup
}
}
+ /**
+ * @since 6.0
+ */
+ public boolean isSSLTransport() {
+ return false;
+ }
+
}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroup.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroup.java
index afa0b58b5..faf82dea2 100644
--- a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroup.java
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroup.java
@@ -130,4 +130,10 @@ public interface IGenericServerContainerGroup {
* </ol>
*/
public void close();
+
+ /**
+ * @since 6.0
+ */
+ public boolean isSSLTransport();
+
}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroupFactory.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroupFactory.java
index ad43537c7..e78e1042e 100644
--- a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroupFactory.java
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/IGenericServerContainerGroupFactory.java
@@ -30,6 +30,11 @@ public interface IGenericServerContainerGroupFactory {
public int DEFAULT_SECURE_PORT = 4282;
/**
+ * @since 6.0
+ */
+ public static final String SSL_TRANSPORT_PROPERTY = "org.eclipse.ecf.server.generic.sslTransport"; //$NON-NLS-1$
+
+ /**
* Create a new container group given a hostname, port, and a Map of default container properties.
* @param hostname the hostname associated with the new container group. Must not be <code>null</code>.
* @param port the port that the new container group will listen on (once {@link IGenericServerContainerGroup#startListening()}
@@ -93,8 +98,4 @@ public interface IGenericServerContainerGroupFactory {
*/
public IGenericServerContainerGroup removeContainerGroup(String hostname, int port);
- /**
- * @since 6.0
- */
- public boolean isSecureTransport();
}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/SSLGenericServerContainerGroup.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/SSLGenericServerContainerGroup.java
index 75594a24a..31d139854 100644
--- a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/SSLGenericServerContainerGroup.java
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/SSLGenericServerContainerGroup.java
@@ -183,4 +183,8 @@ public class SSLGenericServerContainerGroup implements IGenericServerContainerGr
}
}
+ public boolean isSSLTransport() {
+ return true;
+ }
+
}

Back to the top