Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public ConfigurationOverviewBuilder setEngineJwtFile(final String engineJwtFileP
/**
* Sets the environment variables.
*
* @param environment the enveironment variables
* @param environment the environment variables
* @return the builder
*/
public ConfigurationOverviewBuilder setEnvironment(final Map<String, String> environment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.services.BesuService;
import org.hyperledger.besu.plugin.services.PluginVersionsProvider;
import org.hyperledger.besu.util.log.FramedLogMessage;

import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -104,6 +105,9 @@ public <T extends BesuService> Optional<T> getService(final Class<T> serviceType
* @param pluginsDir the plugins dir
*/
public void registerPlugins(final Path pluginsDir) {
final List<String> lines = new ArrayList<>();
lines.add("plugins dir " + pluginsDir.toAbsolutePath());
lines.add("");
checkState(
state == Lifecycle.UNINITIALIZED,
"Besu plugins have already been registered. Cannot register additional plugins.");
Expand All @@ -120,19 +124,24 @@ public void registerPlugins(final Path pluginsDir) {
try {
plugin.register(this);
LOG.info("Registered plugin of type {}.", plugin.getClass().getName());
lines.add(String.format("SUCCESS %s", plugin.getClass().getSimpleName()));
addPluginVersion(plugin);
} catch (final Exception e) {
LOG.error(
"Error registering plugin of type "
+ plugin.getClass().getName()
+ ", start and stop will not be called.",
e);
lines.add(String.format("ERROR %s", plugin.getClass().getSimpleName()));
continue;
}
plugins.add(plugin);
}

LOG.debug("Plugin registration complete.");
lines.add("");
lines.add("TOTAL = " + plugins.size());
LOG.debug(FramedLogMessage.generate(lines));

state = Lifecycle.REGISTERED;
}
Expand Down Expand Up @@ -259,7 +268,7 @@ List<BesuPlugin> getPlugins() {

private Optional<ClassLoader> pluginDirectoryLoader(final Path pluginsDir) {
if (pluginsDir != null && pluginsDir.toFile().isDirectory()) {
LOG.debug("Searching for plugins in {}", pluginsDir.toAbsolutePath().toString());
LOG.debug("Searching for plugins in {}", pluginsDir.toAbsolutePath());

try (final Stream<Path> pluginFilesList = Files.list(pluginsDir)) {
final URL[] pluginJarURLs =
Expand Down