Switching to new smart-executor-api
This commit is contained in:
parent
d95378e839
commit
c2950bd135
|
@ -0,0 +1,4 @@
|
||||||
|
groupId=${groupId}
|
||||||
|
artifactId=${artifactId}
|
||||||
|
version=${version}
|
||||||
|
description=${description}
|
|
@ -4,7 +4,7 @@ import java.text.DateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.gcube.accounting.aggregator.aggregation.AggregationType;
|
import org.gcube.accounting.aggregator.aggregation.AggregationType;
|
||||||
import org.gcube.accounting.aggregator.plugin.AccountingAggregatorPluginDeclaration;
|
import org.gcube.accounting.aggregator.plugin.AccountingAggregatorPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -13,7 +13,7 @@ public abstract class DirectoryStructure<D> {
|
||||||
|
|
||||||
public D getTargetFolder(AggregationType aggregationType, Date aggregationStartDate) throws Exception {
|
public D getTargetFolder(AggregationType aggregationType, Date aggregationStartDate) throws Exception {
|
||||||
D root = getRoot();
|
D root = getRoot();
|
||||||
D aggregatorPluginDirectory = createDirectory(root, AccountingAggregatorPluginDeclaration.NAME);
|
D aggregatorPluginDirectory = createDirectory(root, AccountingAggregatorPlugin.NAME);
|
||||||
D aggregationTypeDirectory = createDirectory(aggregatorPluginDirectory, aggregationType.name());
|
D aggregationTypeDirectory = createDirectory(aggregatorPluginDirectory, aggregationType.name());
|
||||||
DateFormat dateFormat = aggregationType.getDateFormat();
|
DateFormat dateFormat = aggregationType.getDateFormat();
|
||||||
String dateString = dateFormat.format(aggregationStartDate);
|
String dateString = dateFormat.format(aggregationStartDate);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
* @author Alessandro Pieve (ISTI - CNR)
|
* @author Alessandro Pieve (ISTI - CNR)
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public class AccountingAggregatorPlugin extends Plugin<AccountingAggregatorPluginDeclaration> {
|
public class AccountingAggregatorPlugin extends Plugin {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(AccountingAggregatorPlugin.class);
|
private static Logger logger = LoggerFactory.getLogger(AccountingAggregatorPlugin.class);
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ public class AccountingAggregatorPlugin extends Plugin<AccountingAggregatorPlugi
|
||||||
RecordUtility.addRecordPackage(AggregatedServiceUsageRecord.class.getPackage());
|
RecordUtility.addRecordPackage(AggregatedServiceUsageRecord.class.getPackage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String NAME = "Accounting-Aggregator-Plugin";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key to indicate {@link AggregationType}
|
* Key to indicate {@link AggregationType}
|
||||||
*/
|
*/
|
||||||
|
@ -93,8 +95,8 @@ public class AccountingAggregatorPlugin extends Plugin<AccountingAggregatorPlugi
|
||||||
LOCAL_TIME_DATE_FORMAT = new SimpleDateFormat(LOCAL_TIME_DATE_FORMAT_PATTERN);
|
LOCAL_TIME_DATE_FORMAT = new SimpleDateFormat(LOCAL_TIME_DATE_FORMAT_PATTERN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountingAggregatorPlugin(AccountingAggregatorPluginDeclaration pluginDeclaration) {
|
public AccountingAggregatorPlugin() {
|
||||||
super(pluginDeclaration);
|
super();
|
||||||
RegexRulesAggregator.getInstance();
|
RegexRulesAggregator.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +214,7 @@ public class AccountingAggregatorPlugin extends Plugin<AccountingAggregatorPlugi
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() throws Exception {
|
protected void onStop() throws Exception {
|
||||||
logger.trace("Stopping execution of {}, UUID : {}", AccountingAggregatorPluginDeclaration.NAME, this.uuid);
|
logger.trace("Stopping execution of {}, UUID : {}", getName(), this.uuid);
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.accounting.aggregator.plugin;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.gcube.vremanagement.executor.plugin.Plugin;
|
|
||||||
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Alessandro Pieve (ISTI - CNR)
|
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
|
||||||
*/
|
|
||||||
public class AccountingAggregatorPluginDeclaration implements PluginDeclaration {
|
|
||||||
/**
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(AccountingAggregatorPlugin.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin name used by the Executor to retrieve this class
|
|
||||||
*/
|
|
||||||
public static final String NAME = "Accounting-Aggregator-Plugin";
|
|
||||||
|
|
||||||
public static final String DESCRIPTION = "This plugin is used to aggregate accounting records";
|
|
||||||
|
|
||||||
public static final String VERSION = "1.0.0";
|
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
logger.debug(String.format("%s initialized", AccountingAggregatorPlugin.class.getSimpleName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return DESCRIPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getSupportedCapabilities() {
|
|
||||||
Map<String, String> discoveredCapabilities = new HashMap<String, String>();
|
|
||||||
return discoveredCapabilities;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
|
||||||
@Override
|
|
||||||
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation() {
|
|
||||||
return AccountingAggregatorPlugin.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "AccountingAggregatorPluginDeclaration [getName()=" + getName()
|
|
||||||
+ ", getDescription()=" + getDescription() + ", getVersion()="
|
|
||||||
+ getVersion() + ", getSupportedCapabilities()="
|
|
||||||
+ getSupportedCapabilities() + ", getPluginImplementation()="
|
|
||||||
+ getPluginImplementation() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1 +1 @@
|
||||||
org.gcube.accounting.aggregator.plugin.AccountingAggregatorPluginDeclaration
|
org.gcube.accounting.aggregator.plugin.AccountingAggregatorPlugin
|
|
@ -60,8 +60,8 @@ public class AccountingAggregatorPluginTest extends ContextTest {
|
||||||
inputs.put(AccountingAggregatorPlugin.AGGREGATION_END_DATE_INPUT_PARAMETER, aggregationEndDate);
|
inputs.put(AccountingAggregatorPlugin.AGGREGATION_END_DATE_INPUT_PARAMETER, aggregationEndDate);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AccountingAggregatorPlugin plugin = new AccountingAggregatorPlugin(null);
|
AccountingAggregatorPlugin plugin = new AccountingAggregatorPlugin();
|
||||||
logger.debug("Going to launch {} with inputs {}", AccountingAggregatorPluginDeclaration.NAME, inputs);
|
logger.debug("Going to launch {} with inputs {}", plugin.getName(), inputs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ public class AccountingAggregatorPluginTest extends ContextTest {
|
||||||
logger.trace("{} : {}", AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER, aggregationEndDate);
|
logger.trace("{} : {}", AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER, aggregationEndDate);
|
||||||
inputs.put(AccountingAggregatorPlugin.AGGREGATION_END_DATE_INPUT_PARAMETER, aggregationEndDate);
|
inputs.put(AccountingAggregatorPlugin.AGGREGATION_END_DATE_INPUT_PARAMETER, aggregationEndDate);
|
||||||
|
|
||||||
AccountingAggregatorPlugin plugin = new AccountingAggregatorPlugin(null);
|
AccountingAggregatorPlugin plugin = new AccountingAggregatorPlugin();
|
||||||
logger.debug("Going to launch {} with inputs {}", AccountingAggregatorPluginDeclaration.NAME, inputs);
|
logger.debug("Going to launch {} with inputs {}",plugin.getName(), inputs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue