/src/nz/net/kallisti/emusicj/EMusicJ.java

https://gitlab.com/eythian/emusicj · Java · 80 lines · 25 code · 7 blank · 48 comment · 0 complexity · dc40280386676c84462a085820d0eb61 MD5 · raw file

  1. /*
  2. eMusic/J - a Free software download manager for emusic.com
  3. http://www.kallisti.net.nz/emusicj
  4. Copyright (C) 2005, 2006 Robin Sheat
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. package nz.net.kallisti.emusicj;
  18. import nz.net.kallisti.emusicj.bindings.Bindings;
  19. import nz.net.kallisti.emusicj.bindings.EmusicjBindings;
  20. import nz.net.kallisti.emusicj.controller.IEmusicjController;
  21. import nz.net.kallisti.emusicj.view.IEmusicjView;
  22. import com.google.inject.Guice;
  23. import com.google.inject.Injector;
  24. import com.google.inject.Stage;
  25. /**
  26. * <p>
  27. * This is the main class for the eMusic/J downloader. It doesn't do a whole lot
  28. * except for start the other parts of the system going. This involves creating
  29. * an instance of the controller, and giving it a view to use.
  30. * </p>
  31. *
  32. * <p>
  33. * $Id$
  34. * </p>
  35. *
  36. * @author robin
  37. */
  38. public class EMusicJ {
  39. /**
  40. * Initialises the components of the system.
  41. *
  42. * @param args
  43. * command line parameters.
  44. */
  45. public EMusicJ(String[] args) {
  46. Injector injector = Guice.createInjector(Stage.PRODUCTION,
  47. new Bindings(), new EmusicjBindings());
  48. IEmusicjView view = injector.getInstance(IEmusicjView.class);
  49. view.setState(IEmusicjView.ViewState.STARTUP);
  50. IEmusicjController controller = injector
  51. .getInstance(IEmusicjController.class);
  52. startApp(controller, args);
  53. }
  54. /**
  55. * This may be overridden to provide custom starters for other platforms
  56. *
  57. * @param controller
  58. * the application controller
  59. * @param args
  60. * the command line arguments
  61. */
  62. public void startApp(IEmusicjController controller, String[] args) {
  63. controller.run(args);
  64. }
  65. public static void main(String[] args) {
  66. new EMusicJ(args);
  67. }
  68. }