Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2011-01-06 22:00:02 -0500
committerslewis2011-01-06 22:00:02 -0500
commit0da0d2c4fa0e76ca5493d3cd44a838641c62eab8 (patch)
tree2841073ab6be8bf62409a64f1c467ca24ccdcf30 /incubation
parent140ee7659b48c4e1a62476f935e9eaec5f5b10d4 (diff)
downloadorg.eclipse.ecf-0da0d2c4fa0e76ca5493d3cd44a838641c62eab8.tar.gz
org.eclipse.ecf-0da0d2c4fa0e76ca5493d3cd44a838641c62eab8.tar.xz
org.eclipse.ecf-0da0d2c4fa0e76ca5493d3cd44a838641c62eab8.zip
rsa version handling additions
Diffstat (limited to 'incubation')
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
index 74699ffd4..b71df6b77 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
@@ -1102,16 +1102,18 @@ public class RemoteServiceAdmin implements
.getService();
}
- private Version getPackageVersion(Bundle registeringBundle,
- String packageName) {
- ExportedPackage[] exportedPackages = getPackageAdmin()
- .getExportedPackages(registeringBundle);
- if (exportedPackages == null)
- return null;
- for (int i = 0; i < exportedPackages.length; i++)
- if (exportedPackages[i].getName().equals(packageName))
- return exportedPackages[i].getVersion();
- return null;
+ private Version getPackageVersion(ServiceReference serviceReference, String serviceInterface, String packageName) {
+ Object service = getContext().getService(serviceReference);
+ if (service == null) return null;
+ Class[] interfaceClasses = service.getClass().getInterfaces();
+ if (interfaceClasses == null) return null;
+ Class interfaceClass = null;
+ for(int i=0; i < interfaceClasses.length; i++) {
+ if (interfaceClasses[i].getName().equals(serviceInterface)) interfaceClass = interfaceClasses[i];
+ }
+ if (interfaceClass == null) return null;
+ ExportedPackage exportedPackage = getExportedPackageForClass(getPackageAdmin(), interfaceClass);
+ return (exportedPackage == null)?null:exportedPackage.getVersion();
}
protected Map<String, Object> createExportEndpointDescriptionProperties(
@@ -1140,8 +1142,7 @@ public class RemoteServiceAdmin implements
String packageVersion = (String) PropertiesUtil.getPropertyValue(
serviceReference, overridingProperties, packageVersionKey);
if (packageVersion == null) {
- Version version = getPackageVersion(
- serviceReference.getBundle(), packageName);
+ Version version = getPackageVersion(serviceReference, exportedInterfaces[i], packageName);
if (version != null && !version.equals(Version.emptyVersion))
packageVersion = version.toString();
else

Back to the top