Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-03-16 14:54:21 -0400
committerslewis2018-03-16 14:54:21 -0400
commit6c57bb3fe5bdd051d9d30ba14a9684b3f9ed6f9a (patch)
treea453ba10990c4cd60adbff909e78d55a83b26d70 /framework/bundles
parenta01ef1f6885bd7630aa781afb0b4c45df0431548 (diff)
downloadorg.eclipse.ecf-6c57bb3fe5bdd051d9d30ba14a9684b3f9ed6f9a.tar.gz
org.eclipse.ecf-6c57bb3fe5bdd051d9d30ba14a9684b3f9ed6f9a.tar.xz
org.eclipse.ecf-6c57bb3fe5bdd051d9d30ba14a9684b3f9ed6f9a.zip
Additional fixes for bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=532205 Added api to RemoteServiceContainerInstantiator to support distribution providers Change-Id: I726a87e2d019da8fa582132e7332d4d895439ff9
Diffstat (limited to 'framework/bundles')
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF8
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java5
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java127
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/EndpointDescriptionPropertiesUtil.java5
4 files changed, 131 insertions, 14 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF
index b83913cb5..5a1746e1a 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF
@@ -9,11 +9,11 @@ Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
Eclipse-LazyStart: true
Export-Package: org.eclipse.ecf.internal.remoteservice;x-internal:=true,
- org.eclipse.ecf.remoteservice;version="7.3.0",
- org.eclipse.ecf.remoteservice.client;version="8.1.0",
+ org.eclipse.ecf.remoteservice;version="7.4.0",
+ org.eclipse.ecf.remoteservice.client;version="8.2.0",
org.eclipse.ecf.remoteservice.events;version="6.0.0",
- org.eclipse.ecf.remoteservice.provider;version="1.0.0",
- org.eclipse.ecf.remoteservice.util;version="8.2.0",
+ org.eclipse.ecf.remoteservice.provider;version="1.1.0",
+ org.eclipse.ecf.remoteservice.util;version="8.3.0",
org.eclipse.ecf.remoteservice.util.tracker;version="6.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.0.0,4.0.0)",
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java
index fe68bd38b..646beec43 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java
@@ -441,4 +441,9 @@ public interface Constants {
*/
public static final String OSGI_PRIVATE_INTENT = "osgi.private"; //$NON-NLS-1$
+ /**
+ * @since 8.13
+ */
+ public static final String OSGI_SERVICE_INTENTS = "service.intents"; //$NON-NLS-1$
+
}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java
index 608b73355..b2954ff68 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java
@@ -10,10 +10,10 @@ package org.eclipse.ecf.remoteservice.provider;
import java.util.*;
import org.eclipse.ecf.core.*;
-import org.eclipse.ecf.core.provider.BaseContainerInstantiator;
-import org.eclipse.ecf.core.provider.IRemoteServiceContainerInstantiator;
+import org.eclipse.ecf.core.provider.*;
import org.eclipse.ecf.remoteservice.Constants;
import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
+import org.eclipse.ecf.remoteservice.util.EndpointDescriptionPropertiesUtil;
/**
* @since 8.7
@@ -23,7 +23,7 @@ public abstract class RemoteServiceContainerInstantiator extends BaseContainerIn
protected static final String[] defaultSupportedAdapterTypes = new String[] {IContainer.class.getName(), IRemoteServiceContainerAdapter.class.getName()};
protected static final Class[][] defaultSupportedParameterTypes = new Class[][] {{Map.class}};
- protected static final String[] defaultSupportedIntents = new String[] {Constants.OSGI_BASIC_INTENT, "passByValue", "exactlyOnce", "ordered"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ protected static final String[] defaultSupportedIntents = new String[] {Constants.OSGI_BASIC_INTENT, "passByValue", "exactlyOnce", "ordered"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public String[] getSupportedAdapterTypes(ContainerTypeDescription description) {
return defaultSupportedAdapterTypes;
@@ -33,10 +33,6 @@ public abstract class RemoteServiceContainerInstantiator extends BaseContainerIn
return defaultSupportedParameterTypes;
}
- public String[] getSupportedIntents(ContainerTypeDescription description) {
- return defaultSupportedIntents;
- }
-
protected List<String> exporterConfigs;
protected Map<String, List<String>> exporterConfigToImporterConfigs;
@@ -99,4 +95,121 @@ public abstract class RemoteServiceContainerInstantiator extends BaseContainerIn
cce.setStackTrace(cause.getStackTrace());
throw cce;
}
+
+ /**
+ * @since 8.13
+ */
+ protected boolean supportsOSGIConfidentialIntent(ContainerTypeDescription description) {
+ return false;
+ }
+
+ /**
+ * @since 8.13
+ */
+ protected boolean supportsOSGIPrivateIntent(ContainerTypeDescription description) {
+ return false;
+ }
+
+ /**
+ * @since 8.13
+ */
+ protected boolean supportsOSGIAsyncIntent(ContainerTypeDescription description) {
+ return false;
+ }
+
+ public String[] getSupportedIntents(ContainerTypeDescription description) {
+ String[] s = defaultSupportedIntents;
+ if (supportsOSGIAsyncIntent(description))
+ s = addSupportedIntent(Constants.OSGI_ASYNC_INTENT, s);
+ if (supportsOSGIPrivateIntent(description))
+ s = addSupportedIntent(Constants.OSGI_PRIVATE_INTENT, s);
+ if (supportsOSGIConfidentialIntent(description))
+ s = addSupportedIntent(Constants.OSGI_CONFIDENTIAL_INTENT, s);
+ return s;
+ }
+
+ /**
+ * @since 8.13
+ */
+ public static String[] addSupportedIntent(String intent, String[] currentSupportedIntents) {
+ if (intent == null)
+ return currentSupportedIntents;
+ List<String> results = (currentSupportedIntents == null) ? new ArrayList<String>() : new ArrayList<String>(Arrays.asList(currentSupportedIntents));
+ results.add(intent);
+ return results.toArray(new String[results.size()]);
+ }
+
+ /**
+ * @since 8.13
+ */
+ public static String[] removeSupportedIntent(String intent, String[] currentSupportedIntents) {
+ if (intent == null)
+ return currentSupportedIntents;
+ List<String> results = (currentSupportedIntents == null) ? new ArrayList<String>() : new ArrayList<String>(Arrays.asList(currentSupportedIntents));
+ results.remove(intent);
+ return results.toArray(new String[results.size()]);
+ }
+
+ /**
+ * @since 8.13
+ */
+ public void checkPrivateHostname(ContainerTypeDescription description, String hostname) throws ContainerIntentException {
+ ContainerInstantiatorUtils.checkPrivate(hostname);
+ }
+
+ /**
+ * @since 8.13
+ */
+ protected List<String> getServiceIntents(ContainerTypeDescription description, Map<String, ?> properties) {
+ if (description != null) {
+ String[] supportedIntents = getSupportedIntents(description);
+ if (supportedIntents != null && properties != null)
+ return EndpointDescriptionPropertiesUtil.getStringPlusProperty(properties, Constants.OSGI_SERVICE_INTENTS);
+ }
+ return null;
+ }
+
+ /**
+ * @since 8.13
+ */
+ @SuppressWarnings("unused")
+ public boolean checkAsyncIntent(ContainerTypeDescription description, String hostname, Map<String, ?> properties) throws ContainerIntentException {
+ List<String> serviceIntents = getServiceIntents(description, properties);
+ if (serviceIntents != null && serviceIntents.contains(Constants.OSGI_PRIVATE_INTENT))
+ return true;
+ return false;
+ }
+
+ /**
+ * @since 8.13
+ */
+ public boolean checkPrivateIntent(ContainerTypeDescription description, String hostname, Map<String, ?> properties) throws ContainerIntentException {
+ List<String> serviceIntents = getServiceIntents(description, properties);
+ if (serviceIntents != null && serviceIntents.contains(Constants.OSGI_PRIVATE_INTENT)) {
+ checkPrivateHostname(description, hostname);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @since 8.13
+ */
+ public boolean checkConfidentialIntent(ContainerTypeDescription description, String uri, Map<String, ?> properties) throws ContainerIntentException {
+ List<String> serviceIntents = getServiceIntents(description, properties);
+ if (serviceIntents != null && serviceIntents.contains(Constants.OSGI_CONFIDENTIAL_INTENT)) {
+ checkConfidentialURI(description, uri);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @since 8.13
+ */
+ public void checkConfidentialURI(ContainerTypeDescription description, String uri) throws ContainerIntentException {
+ if (uri != null && uri.startsWith("https")) //$NON-NLS-1$
+ return;
+ throw new ContainerIntentException(Constants.OSGI_CONFIDENTIAL_INTENT, "provider=" + description.getName() + " failed confientiality check for uri=" + uri); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/EndpointDescriptionPropertiesUtil.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/EndpointDescriptionPropertiesUtil.java
index 609a4bde1..cb941fd5b 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/EndpointDescriptionPropertiesUtil.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/EndpointDescriptionPropertiesUtil.java
@@ -55,8 +55,7 @@ public class EndpointDescriptionPropertiesUtil {
}
}
- @SuppressWarnings("cast")
- public static List getStringPlusProperty(Map properties, String key) {
+ public static List<String> getStringPlusProperty(Map<String, ?> properties, String key) {
Object value = properties.get(key);
if (value == null) {
return Collections.EMPTY_LIST;
@@ -83,7 +82,7 @@ public class EndpointDescriptionPropertiesUtil {
for (Iterator iter = values.iterator(); iter.hasNext();) {
Object v = iter.next();
if (v instanceof String) {
- result.add((String) v);
+ result.add(v);
}
}
return Collections.unmodifiableList(result);

Back to the top