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.

HelloPlugin.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 2012 Decebal Suiu
  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.demo.hello;
  17. import org.slf4j.Logger;
  18. import org.slf4j.LoggerFactory;
  19. import org.pf4j.Extension;
  20. import org.pf4j.Plugin;
  21. import org.pf4j.PluginWrapper;
  22. import org.pf4j.demo.api.Greeting;
  23. /**
  24. * A very simple plugin.
  25. *
  26. * @author Decebal Suiu
  27. */
  28. public class HelloPlugin extends Plugin {
  29. private static final Logger logger = LoggerFactory.getLogger(HelloPlugin.class);
  30. public HelloPlugin(PluginWrapper wrapper) {
  31. super(wrapper);
  32. }
  33. @Override
  34. public void start() {
  35. logger.info("HelloPlugin.start()");
  36. }
  37. @Override
  38. public void stop() {
  39. logger.info("HelloPlugin.stop()");
  40. }
  41. @Extension(ordinal=1)
  42. public static class HelloGreeting implements Greeting {
  43. @Override
  44. public String getGreeting() {
  45. return "Hello";
  46. }
  47. }
  48. }