Skip to content

Commit 2902751

Browse files
committed
allow implementor to skip reloading
1 parent f3d016d commit 2902751

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ private String getClassName(JarEntry f) {
337337

338338
/**
339339
* Perform custom operations before the plugins are loaded.
340+
* <p>
341+
* If this function returns {@code null}, the reloading is completely skipped and {@link #afterReload(Object)}
342+
* is never called.
340343
*
341344
* @return the implementor can generate custom data which will be later passed to {@link #afterReload(Object)}
342345
*/
@@ -347,6 +350,9 @@ private String getClassName(JarEntry f) {
347350
* <p>
348351
* When this is invoked, all plugins has been loaded into the memory and for each available plugin
349352
* the {@link #classLoaded(Object, Object)} was invoked.
353+
* <p>
354+
* When {@link #beforeReload()} returns {@code null}, the reloading is skipped, and this method is
355+
* never called.
350356
*
351357
* @param data a custom data created with {@link #beforeReload()}
352358
*/
@@ -363,6 +369,12 @@ public final void reload() {
363369
// notify the implementing class that the reload is about to begin
364370
final DataType localData = beforeReload();
365371

372+
if (localData == null) {
373+
// the implementor does not want to reload the plugins
374+
LOGGER.log(Level.WARNING, "Loading plugins from {0} as instructed by the implementer's class", pluginDirectory);
375+
return;
376+
}
377+
366378
try {
367379
if (pluginDirectory == null || !pluginDirectory.isDirectory() || !pluginDirectory.canRead()) {
368380
LOGGER.log(Level.WARNING, "Plugin directory not found or not readable: {0}.", pluginDirectory);

opengrok-web/src/main/webapp/list.jsp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,8 @@ Click <a href="<%= rawPath %>">download <%= basename %></a><%
247247
}
248248
} else {
249249
// requesting a previous revision or needed to generate xref on the fly (economy mode).
250-
<<<<<<< HEAD
251-
AnalyzerFactory a = AnalyzerGuru.find(basename);
252-
Genre g = AnalyzerGuru.getGenre(a);
253-
=======
254250
AnalyzerFactory a = cfg.getEnv().getAnalyzerGuru().find(basename);
255251
AbstractAnalyzer.Genre g = cfg.getEnv().getAnalyzerGuru().getGenre(a);
256-
>>>>>>> Introducing an plugin framework for analyzers
257252
String error = null;
258253
if (g == Genre.PLAIN || g == Genre.HTML || g == null) {
259254
InputStream in = null;

0 commit comments

Comments
 (0)