You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UpdateComponent.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (c) 2006-2014 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.updater;
  23. /**
  24. * The update component interface defines the methods needed to be implemented by updatable
  25. * components. The components handle determining the current version and installing updated files.
  26. */
  27. public interface UpdateComponent {
  28. /**
  29. * Retrieves the name of this component.
  30. *
  31. * @return This component's name
  32. */
  33. String getName();
  34. /**
  35. * A user-friendly name displayed for the component.
  36. *
  37. * @return This component's user-friendly name
  38. */
  39. String getFriendlyName();
  40. /**
  41. * A user-friendly version displayed for the component.
  42. *
  43. * @return This component's user-friendly version
  44. *
  45. * @since 0.6
  46. */
  47. String getFriendlyVersion();
  48. /**
  49. * Retrieves the currently installed version of this component.
  50. *
  51. * @return This component's current version
  52. *
  53. * @since 0.6.3m1
  54. */
  55. Version getVersion();
  56. /**
  57. * Provisionally indicates if this component will require a client restart. The result of
  58. * {@link #doInstall(java.lang.String)} ultimately decides if the client requires a restart.
  59. *
  60. * @return True if the client requires a restart
  61. *
  62. * @since 0.6.4
  63. */
  64. boolean requiresRestart();
  65. /**
  66. * Indicates if this component will require a manual install.
  67. *
  68. * @return True if the component requires a manual install
  69. *
  70. * @since 0.6.4
  71. */
  72. boolean requiresManualInstall();
  73. /**
  74. * Generates manual installation instructions given that the update has been downloaded to the
  75. * specified temporary path.
  76. *
  77. * @param path The full path to the downloaded data
  78. *
  79. * @return Return manual instructions for this plugin
  80. *
  81. * @since 0.6.4
  82. */
  83. String getManualInstructions(final String path);
  84. /**
  85. * Installs the updated version of this component. After the update has been installed, the
  86. * component is responsible for deleting the specified file.
  87. *
  88. * @param path The full path to the downloaded data
  89. *
  90. * @return True if a client restart is needed, false otherwise
  91. *
  92. * @throws java.lang.Exception If any error occurred
  93. */
  94. boolean doInstall(String path) throws Exception; //NOPMD
  95. }