use of org.hyperledger.besu.services.PicoCLIOptionsImpl in project besu by hyperledger.
the class ThreadBesuNodeRunner method buildPluginContext.
private BesuPluginContextImpl buildPluginContext(final BesuNode node, final StorageServiceImpl storageService, final SecurityModuleServiceImpl securityModuleService, final BesuConfiguration commonPluginConfiguration) {
final CommandLine commandLine = new CommandLine(CommandSpec.create());
final BesuPluginContextImpl besuPluginContext = new BesuPluginContextImpl();
besuPluginContext.addService(StorageService.class, storageService);
besuPluginContext.addService(SecurityModuleService.class, securityModuleService);
besuPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));
final Path pluginsPath = node.homeDirectory().resolve("plugins");
final File pluginsDirFile = pluginsPath.toFile();
if (!pluginsDirFile.isDirectory()) {
pluginsDirFile.mkdirs();
pluginsDirFile.deleteOnExit();
}
System.setProperty("besu.plugins.dir", pluginsPath.toString());
besuPluginContext.registerPlugins(pluginsPath);
commandLine.parseArgs(node.getConfiguration().getExtraCLIOptions().toArray(new String[0]));
besuPluginContext.addService(BesuConfiguration.class, commonPluginConfiguration);
// register built-in plugins
new RocksDBPlugin().register(besuPluginContext);
return besuPluginContext;
}
use of org.hyperledger.besu.services.PicoCLIOptionsImpl in project besu by hyperledger.
the class BesuCommand method preparePlugins.
private void preparePlugins() {
besuPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));
besuPluginContext.addService(SecurityModuleService.class, securityModuleService);
besuPluginContext.addService(StorageService.class, storageService);
besuPluginContext.addService(MetricCategoryRegistry.class, metricCategoryRegistry);
besuPluginContext.addService(PermissioningService.class, permissioningService);
besuPluginContext.addService(PrivacyPluginService.class, privacyPluginService);
besuPluginContext.addService(RpcEndpointService.class, rpcEndpointServiceImpl);
// register built-in plugins
new RocksDBPlugin().register(besuPluginContext);
new InMemoryStoragePlugin().register(besuPluginContext);
besuPluginContext.registerPlugins(pluginsDir());
metricCategoryRegistry.getMetricCategories().forEach(metricCategoryConverter::addRegistryCategory);
// register default security module
securityModuleService.register(DEFAULT_SECURITY_MODULE, Suppliers.memoize(this::defaultSecurityModule));
}
Aggregations