diff options
author | slewis | 2018-04-04 23:45:15 +0000 |
---|---|---|
committer | slewis | 2018-04-04 23:45:15 +0000 |
commit | 1e55810220d5c6fab6741707d4beef67a18da94a (patch) | |
tree | 5034456f706df9d0c4016b48051dd9cc51d5bac7 | |
parent | ed75d1ba124aa05c98cad16b67154500502d5ee0 (diff) | |
download | org.eclipse.ecf-1e55810220d5c6fab6741707d4beef67a18da94a.tar.gz org.eclipse.ecf-1e55810220d5c6fab6741707d4beef67a18da94a.tar.xz org.eclipse.ecf-1e55810220d5c6fab6741707d4beef67a18da94a.zip |
Added handling of service.intents for determining if osgi.async intent
is present. Also added debug output info for host container selector
service
Change-Id: Ib55613fd9714801a415c5d4e3f2cff038bc03536
3 files changed, 49 insertions, 7 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java index 51b8c818a..51dec6acc 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java @@ -468,7 +468,20 @@ public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteServ * @since 8.13 */ protected boolean isOSGIAsync() { - return getRemoteServiceReference().getProperty(Constants.OSGI_ASYNC_INTENT) != null; + IRemoteServiceReference ref = getRemoteServiceReference(); + // If osgi.async is set then it's yes + boolean osgiAsync = ref.getProperty(Constants.OSGI_ASYNC_INTENT) != null; + if (osgiAsync) + return true; + // If service.intents has values, and the osgi.async is present then it's also yes + String[] serviceIntents = (String[]) ref.getProperty(Constants.OSGI_SERVICE_INTENTS); + if (serviceIntents != null) { + List<String> il = Arrays.asList(serviceIntents); + if (il.contains(Constants.OSGI_ASYNC_INTENT)) + return true; + } + // otherwise no + return false; } /** diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/SharedObjectMsgEvent.java b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/SharedObjectMsgEvent.java index a7f066159..3f5c18b42 100644 --- a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/SharedObjectMsgEvent.java +++ b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/sharedobject/SharedObjectMsgEvent.java @@ -22,6 +22,9 @@ public class SharedObjectMsgEvent extends RemoteSharedObjectEvent { private static final long serialVersionUID = -8674874265514762123L; + /** + * @since 2.6 + */ public SharedObjectMsgEvent() { super(); } 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 19a352c79..17fdd7cd8 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 @@ -68,19 +68,25 @@ public abstract class AbstractHostContainerSelector extends return results; for (int i = 0; i < containers.length; i++) { + ID cID = containers[i].getID(); + trace("selectExistingHostContainers","Considering existing container="+cID); //$NON-NLS-1$ //$NON-NLS-2$ // Check to make sure it's a rs container adapter. If it's not go // onto next one IRemoteServiceContainerAdapter adapter = hasRemoteServiceContainerAdapter(containers[i]); - if (adapter == null) + if (adapter == null) { + trace("selectExistingHostContainers","Existing container="+cID+" does not implement IRemoteServiceContainerAdapter"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ continue; + } // Get container type description and intents ContainerTypeDescription description = getContainerTypeDescription(containers[i]); // If it has no description go onto next - if (description == null) + if (description == null) { + trace("selectExistingHostContainers","Existing container="+cID+" does not have container type description"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ continue; - + } // http://bugs.eclipse.org/331532 if (!description.isServer()) { + trace("selectExistingHostContainers","Existing container="+cID+" is not server"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ continue; } @@ -233,11 +239,14 @@ public abstract class AbstractHostContainerSelector extends // endpoint (see section 122.5.1) if (requiredConfigTypes == null) return true; + trace("matchHostSupportedConfigTypes","description="+containerTypeDescription.getName()+" testing for requiredConfigTypes"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // Get supported config types for this description String[] supportedConfigTypes = getSupportedConfigTypes(containerTypeDescription); // If it doesn't support anything, return false - if (supportedConfigTypes == null || supportedConfigTypes.length == 0) + if (supportedConfigTypes == null || supportedConfigTypes.length == 0) { + trace("matchHostSupportedConfigTypes","No supported configs found for description="+containerTypeDescription.getName()); //$NON-NLS-1$ //$NON-NLS-2$ return false; + } // Turn supported config types for this description into list List supportedConfigTypesList = Arrays.asList(supportedConfigTypes); List requiredConfigTypesList = Arrays.asList(requiredConfigTypes); @@ -246,6 +255,8 @@ public abstract class AbstractHostContainerSelector extends boolean result = false; for (Iterator i = requiredConfigTypesList.iterator(); i.hasNext();) result |= supportedConfigTypesList.contains(i.next()); + if (!result) + trace("matchHostSupportedConfigTypes","description="+containerTypeDescription.getName()+" does not support all required config types"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; } @@ -276,6 +287,7 @@ public abstract class AbstractHostContainerSelector extends } else { // See if we have a match for (int i = 0; i < descriptions.length; i++) { + trace("createAndConfigureHostContainers","Considering description="+descriptions[i]); //$NON-NLS-1$ //$NON-NLS-2$ IRemoteServiceContainer matchingContainer = createMatchingContainer( descriptions[i], serviceReference, properties, serviceExportedInterfaces, requiredConfigs, @@ -391,6 +403,10 @@ public abstract class AbstractHostContainerSelector extends ServiceReference serviceReference, Map<String, Object> properties, ContainerTypeDescription containerTypeDescription, String[] intents) throws SelectContainerException { + trace("createRSContainer", //$NON-NLS-1$ + "Creating container instance for ref=" + serviceReference + ";properties=" + properties //$NON-NLS-1$ //$NON-NLS-2$ + + ";description=" + containerTypeDescription.getName() + ";intents=" //$NON-NLS-1$ //$NON-NLS-2$ + + ((intents == null) ? "" : Arrays.asList(intents).toString())); //$NON-NLS-1$ IContainer container = createContainer(serviceReference, properties, containerTypeDescription, intents); if (container == null) @@ -447,10 +463,14 @@ public abstract class AbstractHostContainerSelector extends if (serviceRequiredIntents == null) return true; + trace("matchHostSupportedIntents","description="+containerTypeDescription.getName()+" testing for serviceRequiredIntents="+Arrays.asList(serviceRequiredIntents)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String[] supportedIntents = getSupportedIntents(containerTypeDescription); - if (supportedIntents == null) + if (supportedIntents == null) { + trace("matchHostSupportedIntents","description="+containerTypeDescription.getName()+" does not have any supported intents"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return false; + } // checks to see that containerTypeDescription supports requiredIntents boolean result = true; for (int i = 0; i < serviceRequiredIntents.length; i++) { @@ -463,8 +483,10 @@ public abstract class AbstractHostContainerSelector extends result &= found; } - if (!result) + if (!result) { + trace("matchHostSupportedIntents","description="+containerTypeDescription.getName()+" does not have all required intents"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return false; + } // If container is non-null, // check to see that it's ID is private. If it's not private, return null @@ -473,10 +495,14 @@ public abstract class AbstractHostContainerSelector extends if (ContainerInstantiatorUtils.containsPrivateIntent(serviceRequiredIntents)) ContainerInstantiatorUtils.checkPrivate(container.getID()); } catch (ContainerIntentException e) { + trace("matchHostSupportedIntents","container="+container.getID()+" does not have osgi private intent"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return false; } } + if (!result) { + trace("matchHostSupportedIntents","container="+container.getID()+" does not have all required intents"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } return result; } |