Refactoring the plugin implementations to have their own package.

Will keep the code more organized
This commit is contained in:
Arpit Mohan 2019-03-31 21:55:27 +05:30
parent 5570020f6d
commit c14b34193d
2 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,8 @@
package com.mobtools.server.services;
package com.mobtools.server.plugins;
import com.mobtools.server.domains.Query;
import com.mobtools.server.dtos.CommandQueryParams;
import com.mobtools.server.services.PluginExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@ -26,17 +26,17 @@ public abstract class PluginExecutor {
* @param params
* @return Flux<Object>
*/
abstract Flux<Object> execute(Query query, CommandQueryParams params);
protected abstract Flux<Object> execute(Query query, CommandQueryParams params);
/**
* This function should be run when the plugin is initialized
*/
abstract void init();
protected abstract void init();
/**
* This function should be run when the plugin is destroyed
*/
abstract void destroy();
protected abstract void destroy();
/**
* This function replaces the variables in the query commandTemplate with the actual params
@ -45,7 +45,7 @@ public abstract class PluginExecutor {
* @param query Query
* @param params CommandQueryParams
*/
Query replaceTemplate(Query query, CommandQueryParams params) {
protected Query replaceTemplate(Query query, CommandQueryParams params) {
MustacheFactory mf = new DefaultMustacheFactory();
Mustache mustache = mf.compile(new StringReader(query.getCommandTemplate()), "commandTemplate");
Writer writer = new StringWriter();