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.

WelcomePlugin.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.demo.welcome;
  17. import org.apache.commons.lang3.StringUtils;
  18. import org.slf4j.Logger;
  19. import org.slf4j.LoggerFactory;
  20. import org.pf4j.Extension;
  21. import org.pf4j.Plugin;
  22. import org.pf4j.PluginWrapper;
  23. import org.pf4j.demo.api.Greeting;
  24. /**
  25. * @author Decebal Suiu
  26. */
  27. public class WelcomePlugin extends Plugin {
  28. private static final Logger logger = LoggerFactory.getLogger(WelcomePlugin.class);
  29. public WelcomePlugin(PluginWrapper wrapper) {
  30. super(wrapper);
  31. }
  32. @Override
  33. public void start() {
  34. logger.info("WelcomePlugin.start()");
  35. logger.info(StringUtils.upperCase("WelcomePlugin"));
  36. }
  37. @Override
  38. public void stop() {
  39. logger.info("WelcomePlugin.stop()");
  40. }
  41. @Extension
  42. public static class WelcomeGreeting implements Greeting {
  43. @Override
  44. public String getGreeting() {
  45. return "Welcome";
  46. }
  47. }
  48. }