Mercurial > hg > release > thermostat-1.0
changeset 387:6ce7d8ac30b9
Merge
author | Roman Kennke <rkennke@redhat.com> |
---|---|
date | Tue, 19 Jun 2012 13:53:54 +0200 |
parents | 42939a012ddf (current diff) 5383cde331c8 (diff) |
children | 5b3cb3635fca |
files | |
diffstat | 9 files changed, 46 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/client/core/src/main/java/com/redhat/thermostat/client/internal/UiFacadeFactory.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/internal/UiFacadeFactory.java Tue Jun 19 13:53:54 2012 +0200 @@ -60,10 +60,13 @@ void addVmInformationService(VmInformationService vmInfoService); + void removeVmInformationService(VmInformationService vmInfoService); + Collection<VMContextAction> getVMContextActions(); void addVMContextAction(VMContextAction service); public void shutdown(); public void awaitShutdown() throws InterruptedException; + }
--- a/client/core/src/main/java/com/redhat/thermostat/client/internal/UiFacadeFactoryImpl.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/internal/UiFacadeFactoryImpl.java Tue Jun 19 13:53:54 2012 +0200 @@ -100,6 +100,11 @@ } @Override + public void removeVmInformationService(VmInformationService vmInfoService) { + vmInformationServices.remove(vmInfoService); + } + + @Override public Collection<VMContextAction> getVMContextActions() { return contextAction; }
--- a/client/core/src/main/java/com/redhat/thermostat/client/internal/osgi/VmInformationServiceTracker.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/internal/osgi/VmInformationServiceTracker.java Tue Jun 19 13:53:54 2012 +0200 @@ -58,8 +58,14 @@ @Override public Object addingService(ServiceReference reference) { - VmInformationService service = (VmInformationService) context.getService(reference); + VmInformationService service = (VmInformationService) super.addingService(reference); uiFacadeFactory.addVmInformationService(service); return service; } + + @Override + public void removedService(ServiceReference reference, Object service) { + uiFacadeFactory.removeVmInformationService((VmInformationService)service); + super.removedService(reference, service); + } }
--- a/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/VmInformationService.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/VmInformationService.java Tue Jun 19 13:53:54 2012 +0200 @@ -40,5 +40,7 @@ public interface VmInformationService { + boolean isApplicableFor(VmRef ref); + VmInformationServiceController getInformationServiceController(VmRef ref); }
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmInformationController.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmInformationController.java Tue Jun 19 13:53:54 2012 +0200 @@ -69,10 +69,12 @@ Collection<VmInformationService> vmInfoServices = uiFacadeFactory.getVmInformationServices(); for (VmInformationService vmInfoService : vmInfoServices) { - VmInformationServiceController ctrl = vmInfoService.getInformationServiceController(vmRef); - String name = ctrl.getLocalizedName(); - Component viewComp = ctrl.getComponent(); - view.addChildView(name, viewComp); + if (vmInfoService.isApplicableFor(vmRef)) { + VmInformationServiceController ctrl = vmInfoService.getInformationServiceController(vmRef); + String name = ctrl.getLocalizedName(); + Component viewComp = ctrl.getComponent(); + view.addChildView(name, viewComp); + } } }
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpAction.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumpAction.java Tue Jun 19 13:53:54 2012 +0200 @@ -52,7 +52,7 @@ /** * Implements the {@link VMContextAction} entry point to provide a kill switch - * for the currently selected Virtual Machine. + * for the currently selected Virtual Machine. */ public class HeapDumpAction implements VMContextAction { @@ -79,7 +79,7 @@ @Override public void execute(VmRef reference) { ApplicationContext.getInstance().getViewFactory().setViewClass(HeapView.class, HeapSwingView.class); - context.registerService(VmInformationService.class.getName(), new HeapDumperService(), null); + context.registerService(VmInformationService.class.getName(), new HeapDumperService(reference), null); } @Override
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumperService.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/HeapDumperService.java Tue Jun 19 13:53:54 2012 +0200 @@ -42,8 +42,19 @@ public class HeapDumperService implements VmInformationService { + private VmRef vmRef; + + public HeapDumperService(VmRef reference) { + this.vmRef = reference; + } + @Override public VmInformationServiceController getInformationServiceController(VmRef ref) { return new HeapDumpController(ref); } + + @Override + public boolean isApplicableFor(VmRef ref) { + return vmRef.equals(ref); + } }
--- a/client/memory-stats-panel/src/main/java/com/redhat/thermostat/client/stats/memory/MemoryStatsService.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/memory-stats-panel/src/main/java/com/redhat/thermostat/client/stats/memory/MemoryStatsService.java Tue Jun 19 13:53:54 2012 +0200 @@ -46,4 +46,9 @@ public VmInformationServiceController getInformationServiceController(VmRef ref) { return new MemoryStatsController(ref); } + + @Override + public boolean isApplicableFor(VmRef ref) { + return true; + } }
--- a/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatService.java Tue Jun 19 13:51:52 2012 +0200 +++ b/client/vmclassstat/src/main/java/com/redhat/thermostat/client/vmclassstat/VmClassStatService.java Tue Jun 19 13:53:54 2012 +0200 @@ -47,4 +47,9 @@ return new VmClassStatController(ref); } + @Override + public boolean isApplicableFor(VmRef ref) { + return true; + } + }