Skip to content

Commit

Permalink
configurable indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
schlotze authored and reimer-atb committed Jun 29, 2022
1 parent 1ea53f1 commit 34f3f7f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ protected ThreadedMonitor(final DataSource dataSource,

public abstract void monitor() throws Exception;

protected abstract boolean isIndexEnabled();

public final void stop() {
// if (this.isRunning()) {
this.shutdown();
Expand Down Expand Up @@ -160,8 +162,10 @@ protected final void parseAndAnalyse(final P objectToParse,
if (parser.parse(objectToParse)) {
final Document document = parser.getDocument();
this.raiseParsedEvent(objectToParse, document);
this.indexer.addDocumentToIndex(document);
this.raiseIndexedEvent(document);
if (isIndexEnabled()) {
this.indexer.addDocumentToIndex(document);
this.raiseIndexedEvent(document);
}
final List<A> analysedModels = analyser.analyse(objectToParse);
this.raiseAnalysedEvent(analysedModels, objectToParse, analyser.getDocument());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ protected InterpreterConfiguration getInterpreterConfiguration() {
return this.interpreter.getConfiguration("monitoring-config.xml");
}

@Override
protected boolean isIndexEnabled() {
return false;
}

@Override
protected void doMonitor(final InterpreterConfiguration setting) {
if (setting != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public final void run() {
}
}

@Override
protected boolean isIndexEnabled() {
return true;
}

@Override
public final void monitor() throws Exception {
this.logger.info("Starting monitoring for path " + this.pathToMonitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ protected InterpreterConfiguration getInterpreterConfiguration() {
return this.interpreter.getConfigurations().isEmpty() ? null : this.interpreter.getConfigurations().get(0);
}

@Override
protected boolean isIndexEnabled() {
return false;
}

@Override
protected void doMonitor(final InterpreterConfiguration setting) throws Exception {
if (setting != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ protected long getScheduleInitialDelay() {
return this.dataSource.getStartDelay() != null ? this.dataSource.getStartDelay() : getSchedulePeriod();
}

@Override
protected boolean isIndexEnabled() {
return false;
}

@Override
protected void doMonitor(final InterpreterConfiguration setting) {
if (setting != null) {
Expand Down

0 comments on commit 34f3f7f

Please sign in to comment.