Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/osgi
diff options
context:
space:
mode:
authorslewis2018-04-12 15:42:19 -0400
committerslewis2018-04-12 15:42:19 -0400
commitdf6af6281b609790e363388259edc378e4071d48 (patch)
treeb29513f609c12e71512760dbb1d0cd84b3957190 /osgi
parent126be81906342f84d67f1244a28af30ffa8261e1 (diff)
downloadorg.eclipse.ecf-df6af6281b609790e363388259edc378e4071d48.tar.gz
org.eclipse.ecf-df6af6281b609790e363388259edc378e4071d48.tar.xz
org.eclipse.ecf-df6af6281b609790e363388259edc378e4071d48.zip
Added to flexibility of HostContainerSelector behavior.
Diffstat (limited to 'osgi')
-rw-r--r--osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF2
-rw-r--r--osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/pom.xml2
-rw-r--r--osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractHostContainerSelector.java67
3 files changed, 59 insertions, 12 deletions
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF
index efd5a7ddd..cc5d5d660 100644
--- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF
+++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %bundle.name
Bundle-SymbolicName: org.eclipse.ecf.osgi.services.remoteserviceadmin
Automatic-Module-Name: org.eclipse.ecf.osgi.services.remoteserviceadmin
-Bundle-Version: 4.6.200.qualifier
+Bundle-Version: 4.6.300.qualifier
Bundle-Activator: org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.Activator
Bundle-Vendor: %bundle.provider
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/pom.xml b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/pom.xml
index 1af9d8ac6..de7e3dbb2 100644
--- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/pom.xml
+++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.ecf</groupId>
<artifactId>org.eclipse.ecf.osgi.services.remoteserviceadmin</artifactId>
- <version>4.6.200-SNAPSHOT</version>
+ <version>4.6.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractHostContainerSelector.java b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractHostContainerSelector.java
index eb560f725..50cb6d4b5 100644
--- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractHostContainerSelector.java
+++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractHostContainerSelector.java
@@ -37,6 +37,7 @@ import org.osgi.framework.ServiceReference;
/**
* Abstract superclass for host container selectors...i.e. implementers of
* {@link IHostContainerSelector}.
+ * @since 4.6
*
*/
public abstract class AbstractHostContainerSelector extends
@@ -44,16 +45,51 @@ public abstract class AbstractHostContainerSelector extends
private static final String REQUIRE_SERVER_PROP = "org.eclipse.ecf.osgi.service.remoteserviceadmin.hostcontainerselector.requireserver"; //$NON-NLS-1$
private static final String EXCLUDED_DESCRIPTIONS_PROP = "org.eclipse.ecf.osgi.service.remoteserviceadmin.hostcontainerselector.excludeddescriptions"; //$NON-NLS-1$
- private boolean defaultRequireServer = new Boolean(System.getProperty(REQUIRE_SERVER_PROP,"true")); //$NON-NLS-1$
+ // Default is now to require that ContainerTypeDesription.isServer() returns true
+ // If this is set to false (via system property REQUIRE_SERVER_PROP being set to false, or at runtime via
+ // setRequireServer(false), then the description isServer() will not be considered when a
+ // container type description is considered for export
+ private boolean requireServer = new Boolean(System.getProperty(REQUIRE_SERVER_PROP,"true")); //$NON-NLS-1$
+ // It's possible to exclude container type descriptions from comsideration for export by
+ // setting excludedDescriptions. This can be done by setting the system property EXCLUDED_DESCRIPTIONS_PROP
+ // to a comma-separated list of container type description names...e.g. -Dorg.eclipse.ecf.osgi.service.remoteserviceadmin.hostcontainerselector.excludeddescriptions=ecf.generic.client,ecf.xmlrpc.client
private List<String> excludedDescriptions;
protected String[] defaultConfigTypes;
+ /**
+ * @since 4.6
+ */
+ protected void setExcludedDescriptions(List<String> excludedDescriptions) {
+ this.excludedDescriptions = (excludedDescriptions == null)?Collections.EMPTY_LIST:excludedDescriptions;
+ }
+
+ /**
+ * @since 4.6
+ */
+ protected List<String> getExcludedDescriptions() {
+ return this.excludedDescriptions;
+ }
+
+ /**
+ * @since 4.6
+ */
+ protected void setRequireServer(boolean requireServerDescriptionForExport) {
+ this.requireServer = requireServerDescriptionForExport;
+ }
+
+ /**
+ * @since 4.6
+ */
+ protected boolean getRequireServerDescription() {
+ return this.requireServer;
+ }
+
public AbstractHostContainerSelector(String[] defaultConfigTypes) {
this.defaultConfigTypes = defaultConfigTypes;
String propValue = System.getProperty(EXCLUDED_DESCRIPTIONS_PROP);
String[] excludedVals = (propValue==null)?new String[0]:propValue.trim().split(","); //$NON-NLS-1$
- this.excludedDescriptions = Arrays.asList(excludedVals);
+ setExcludedDescriptions(Arrays.asList(excludedVals));
}
/**
@@ -184,12 +220,11 @@ public abstract class AbstractHostContainerSelector extends
ContainerTypeDescription description, String[] requiredConfigTypes,
String[] requiredServiceIntents) {
- return matchHostSupportedConfigTypes(requiredConfigTypes, description)
- && matchHostSupportedIntents(requiredServiceIntents,
- description, container)
+ return matchRequireServer(description) && matchNotExcluded(description)
+ && matchHostSupportedConfigTypes(requiredConfigTypes, description)
+ && matchHostSupportedIntents(requiredServiceIntents, description, container)
&& matchHostContainerID(serviceReference, properties, container)
- && matchHostContainerToConnectTarget(serviceReference,
- properties, container);
+ && matchHostContainerToConnectTarget(serviceReference, properties, container);
}
/**
@@ -339,8 +374,20 @@ public abstract class AbstractHostContainerSelector extends
* @since 4.6
*/
protected boolean matchRequireServer(ContainerTypeDescription description) {
- boolean result = this.defaultRequireServer && description.isServer();
- LogUtility.trace("matchRequireServer", DebugOptions.CONTAINER_SELECTOR, this.getClass(), "description="+description.getName()+((result)?" matched require server":" DID NOT match require server")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ boolean result = false;
+ boolean require = getRequireServerDescription();
+ if (require) {
+ result = description.isServer();
+ LogUtility.trace("matchRequireServer", DebugOptions.CONTAINER_SELECTOR, this.getClass(), //$NON-NLS-1$
+ "Server is required for export, so description=" + description.getName() //$NON-NLS-1$
+ + ((result) ? " isServer() return true" : " IS NOT SERVER")); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ result = true;
+ LogUtility.trace("matchRequireServer", DebugOptions.CONTAINER_SELECTOR, this.getClass(), //$NON-NLS-1$
+ "Server is not required for export, so description=" + description.getName() //$NON-NLS-1$
+ + " is allowed to export"); //$NON-NLS-1$
+ return true;
+ }
return result;
}
@@ -348,7 +395,7 @@ public abstract class AbstractHostContainerSelector extends
* @since 4.6
*/
protected boolean matchNotExcluded(ContainerTypeDescription description) {
- boolean result = this.excludedDescriptions.contains(description.getName());
+ boolean result = getExcludedDescriptions().contains(description.getName());
LogUtility.trace("matchNotExcluded", DebugOptions.CONTAINER_SELECTOR, this.getClass(), "description="+description.getName()+((result)?" EXCLUDED via excludedDescriptions="+this.excludedDescriptions:" not excluded via excludedDescriptions="+this.excludedDescriptions)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
return !result;
}

Back to the top