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.

PluginLoader.java 1.6KB

11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. import java.nio.file.Path;
  18. /**
  19. * Load all information (classes) needed by a plugin.
  20. * <p>
  21. * The plugin loader is responsible for creating a class loader for a plugin
  22. * and loading all classes/resources needed by the plugin.
  23. *
  24. * @author Decebal Suiu
  25. */
  26. public interface PluginLoader {
  27. /**
  28. * Returns {@code true} if this loader is applicable to the given plugin path.
  29. * This is used to select the appropriate loader for a given plugin path.
  30. *
  31. * @param pluginPath the plugin path
  32. * @return true if this loader is applicable to the given {@link Path}
  33. */
  34. boolean isApplicable(Path pluginPath);
  35. /**
  36. * Load all information (classes) needed by a plugin.
  37. *
  38. * @param pluginPath the plugin path
  39. * @param pluginDescriptor the plugin descriptor
  40. * @return the class loader for the plugin
  41. */
  42. ClassLoader loadPlugin(Path pluginPath, PluginDescriptor pluginDescriptor);
  43. }