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.

PluginState.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2012-present the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.pf4j;
  17. /**
  18. * @author Decebal Suiu
  19. */
  20. public class PluginState {
  21. /**
  22. * The runtime knows the plugin is there. It knows about the plugin path, the plugin descriptor.
  23. */
  24. public static final PluginState CREATED = new PluginState("CREATED");
  25. /**
  26. * The plugin cannot be used.
  27. */
  28. public static final PluginState DISABLED = new PluginState("DISABLED");
  29. /**
  30. * The plugin is created. All the dependencies are created and resolved.
  31. * The plugin is ready to be started.
  32. */
  33. public static final PluginState RESOLVED = new PluginState("RESOLVED");
  34. /**
  35. * The {@link Plugin#start()} has executed. A started plugin may contribute extensions.
  36. */
  37. public static final PluginState STARTED = new PluginState("STARTED");
  38. /**
  39. * The {@link Plugin#stop()} has executed.
  40. */
  41. public static final PluginState STOPPED = new PluginState("STOPPED");
  42. private String status;
  43. private PluginState(String status) {
  44. this.status = status;
  45. }
  46. @Override
  47. public boolean equals(Object o) {
  48. if (this == o) return true;
  49. if (o == null || getClass() != o.getClass()) return false;
  50. PluginState that = (PluginState) o;
  51. return status.equals(that.status);
  52. }
  53. @Override
  54. public int hashCode() {
  55. return status.hashCode();
  56. }
  57. @Override
  58. public String toString() {
  59. return status;
  60. }
  61. }