summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-01-29 12:47:45 (EST)
committerChristian Campo2008-01-29 12:47:45 (EST)
commit3ccc0f4c75df0c8cce57c66be9a77209de4ec1d2 (patch)
tree3f1b8e666ea9956f0e32a9adbc9b8952fd9a9722
parent56c0b977a4284af947d6b1f3eb6378eacac32598 (diff)
downloadorg.eclipse.riena-3ccc0f4c75df0c8cce57c66be9a77209de4ec1d2.zip
org.eclipse.riena-3ccc0f4c75df0c8cce57c66be9a77209de4ec1d2.tar.gz
org.eclipse.riena-3ccc0f4c75df0c8cce57c66be9a77209de4ec1d2.tar.bz2
change to minimize the chance that ServiceInjector looses any services changes
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java
index 7c4b5d4..978e564 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java
@@ -43,6 +43,8 @@ public class ServiceInjector {
private String unbindMethod;
private String filter;
private String serviceId;
+ private boolean onlyInjectHighestRanking;
+ public final static String DEFAULT_RANKING = "-100";
/**
* public constructor for ServiceInjector. only used for testing
@@ -95,11 +97,11 @@ public class ServiceInjector {
this.serviceId = serviceId;
this.filter = filter;
if (!methodExists(target, bindMethod)) {
- System.out.println("bindMethod '" + bindMethod + "' does not exist");
+ System.out.println("bindMethod '" + bindMethod + "' does not exist in target class: " + target.getClass().getName());
throw new AssertionError("bindMethod does not exist");
}
if (!methodExists(target, unbindMethod)) {
- System.out.println("unbindMethod '" + unbindMethod + "' does not exist");
+ System.out.println("unbindMethod '" + unbindMethod + "' does not exist in target class: " + target.getClass().getName());
throw new AssertionError("unbindMethod does not exist");
}
this.bindMethod = bindMethod;
@@ -127,13 +129,17 @@ public class ServiceInjector {
try {
// try to find the service initial
ServiceReference[] serviceRefs = context.getServiceReferences(serviceId, filter);
+ // add an service listener for register or unregister
+ // register the service listener before we go through the reference
+ // list since its very more likely that no service is registered
+ // between getServiceReferences and addServiceListener
+ context.addServiceListener(serviceListner, filter);
+ // then go through the list of references
if (serviceRefs != null) {
for (ServiceReference serviceRef : serviceRefs) {
bind(serviceRef);
}
}
- // add an service listener for register or unregister
- context.addServiceListener(serviceListner, filter);
} catch (InvalidSyntaxException e) {
e.printStackTrace();
}