PageRenderTime 4149ms CodeModel.GetById 37ms RepoModel.GetById 1ms app.codeStats 0ms

/org.gatherdata.data.dynamic/src/main/java/org/gatherdata/data/dynamic/osgi/OSGiActivator.java

https://github.com/gatherdata/gather-data
Java | 54 lines | 29 code | 9 blank | 16 comment | 0 complexity | 80e8d2447e4e03b28bd87331cf15dcb0 MD5 | raw file
  1. /**
  2. * The contents of this file are subject to the AED Public Use License Agreement, Version 1.0 (the "License");
  3. * use in any manner is strictly prohibited except in compliance with the terms of the License.
  4. * The License is available at http://gatherdata.org/license.
  5. *
  6. * Copyright (c) AED. All Rights Reserved
  7. */
  8. package org.gatherdata.data.dynamic.osgi;
  9. import java.util.Dictionary;
  10. import java.util.Properties;
  11. import org.gatherdata.data.dynamic.DynamicTableService;
  12. import org.gatherdata.data.dynamic.internal.ExampleServiceImpl;
  13. import org.ops4j.peaberry.Export;
  14. import org.osgi.framework.BundleActivator;
  15. import org.osgi.framework.BundleContext;
  16. import com.google.inject.Inject;
  17. import static com.google.inject.Guice.createInjector;
  18. import static org.ops4j.peaberry.Peaberry.osgiModule;
  19. /**
  20. * Extension of the default OSGi bundle activator
  21. */
  22. public final class OSGiActivator
  23. implements BundleActivator
  24. {
  25. @Inject
  26. Export<DynamicTableService> tableService;
  27. /**
  28. * Called whenever the OSGi framework starts our bundle
  29. */
  30. public void start( BundleContext bc )
  31. throws Exception
  32. {
  33. createInjector(osgiModule(bc), new GuiceBindingModule()).injectMembers(this);
  34. ExampleServiceImpl testService = new ExampleServiceImpl();
  35. testService.tryItOut(this.getClass().getClassLoader(), tableService.get());
  36. }
  37. /**
  38. * Called whenever the OSGi framework stops our bundle
  39. */
  40. public void stop( BundleContext bc )
  41. throws Exception
  42. {
  43. ;
  44. }
  45. }