Switching to new smart-executor-api

This commit is contained in:
Luca Frosini 2020-09-30 12:13:23 +02:00
parent db5b25d796
commit bb4c66fa22
13 changed files with 111 additions and 141 deletions

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
.gitignore vendored
View File

@ -1 +1,2 @@
target
/.classpath

1
.settings/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/org.eclipse.jdt.core.prefs

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
groupId=${groupId}
artifactId=${artifactId}
version=${version}
description=${description}

57
pom.xml
View File

@ -35,14 +35,14 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>LATEST</version>
<version>2.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-smartgears-bom</artifactId>
<version>LATEST</version>
<version>2.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -102,7 +102,7 @@
<dependency>
<groupId>org.gcube.vremanagement</groupId>
<artifactId>smart-executor-api</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<version>[3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
@ -153,19 +153,60 @@
<version>${apache.http.version}</version>
</dependency>
</dependencies>
<build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${basedir}${file.separator}target${file.separator}libs</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeTypes>war</excludeTypes>
<stripVersion>false</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-uberjar</id>
<phase>install</phase>
<id>uberjar</id>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>uberjar.xml</descriptor>
</descriptors>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>make-servicearchive</id>
<phase>install</phase>
<id>tar.gz</id>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>tar-gz.xml</descriptor>
</descriptors>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

View File

@ -46,9 +46,10 @@ import org.slf4j.LoggerFactory;
/**
* The SocialDataIndexerPlugin synchronizes and indexes data coming from the cassandra
* cluster in the elasticsearch engine.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* @author Costantino Perciante at ISTI-CNR
* @author Luca Frosini (ISTI-CNR)
*/
public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDeclaration>{
public class SocialDataIndexerPlugin extends Plugin {
//Logger
private static Logger logger = LoggerFactory.getLogger(SocialDataIndexerPlugin.class);
@ -62,11 +63,8 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
private int count = 0;
public SocialDataIndexerPlugin(SocialDataIndexerPluginDeclaration pluginDeclaration){
super(pluginDeclaration);
public SocialDataIndexerPlugin(){
logger.debug("Constructor");
}
/**{@inheritDoc}

View File

@ -1,82 +0,0 @@
/**
*
*/
package org.gcube.socialnetworking.socialdataindexer;
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;
/**
* The social data indexer plugin declaration class.
* @author Costantino Perciante at ISTI-CNR
* (costantino.perciante@isti.cnr.it)
*
*/
public class SocialDataIndexerPluginDeclaration implements PluginDeclaration {
/**
* Logger
*/
private static Logger logger = LoggerFactory.getLogger(SocialDataIndexerPluginDeclaration.class);
/**
* Plugin name used by the Executor to retrieve this class
*/
public static final String NAME = "social-data-indexer-plugin";
public static final String DESCRIPTION = "The social-data-indexer-plugin has the role to index data contained into a Cassandra cluster using an Elasticsearch index to support full-text search.";
public static final String VERSION = "1.2.0";
/**{@inheritDoc}*/
@Override
public void init() {
logger.debug(String.format("%s initialized", SocialDataIndexerPluginDeclaration.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>();
// No capabilities to discover
return discoveredCapabilities;
}
/**{@inheritDoc}*/
@Override
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation() {
return SocialDataIndexerPlugin.class;
}
@Override
public String toString(){
return String.format("%s : %s - %s - %s - %s - %s",
this.getClass().getSimpleName(),
getName(), getVersion(), getDescription(),
getSupportedCapabilities(),
getPluginImplementation().getClass().getSimpleName());
}
}

View File

@ -76,9 +76,9 @@ public class SendNotification extends PluginStateNotification {
try(CloseableHttpClient httpClient = HttpClientBuilder.create().build()){
JSONObject obj = new JSONObject();
obj.put("job_id", pluginStateEvolution.getUuid().toString());
obj.put("job_id", pluginStateEvolution.getUUID().toString());
obj.put("recipient", recipient);
obj.put("job_name", pluginStateEvolution.getPluginDeclaration().getName());
obj.put("job_name", pluginStateEvolution.getPluginDefinition().getName());
obj.put("service_name", SERVICE_NAME);
// if(pluginStateEvolution.getPluginState().equals(PluginState.DONE))
// obj.put("status", "SUCCEEDED");

View File

@ -1 +1 @@
org.gcube.socialnetworking.socialdataindexer.SocialDataIndexerPluginDeclaration
org.gcube.socialnetworking.socialdataindexer.SocialDataIndexerPlugin

View File

@ -20,7 +20,7 @@ public class Tests {
logger.debug("Starting to test launch");
Map<String, Object> inputs = new HashMap<String, Object>();
inputs.put("scope", "gcube");
SocialDataIndexerPlugin plugin = new SocialDataIndexerPlugin(null);
SocialDataIndexerPlugin plugin = new SocialDataIndexerPlugin();
//uncomment for testing purpose
//plugin.launch(inputs);
logger.debug("-------------- launch test finished");

24
tar-gz.xml Normal file
View File

@ -0,0 +1,24 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>tar.gz</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>${file.separator}</baseDirectory>
<fileSets>
<fileSet>
<directory>target${file.separator}libs</directory>
<outputDirectory>${file.separator}</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>target${file.separator}${project.artifactId}-${project.version}.jar</source>
<filtered>true</filtered>
</file>
</files>
</assembly>

24
uberjar.xml Normal file
View File

@ -0,0 +1,24 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>uberjar</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory>${file.separator}</baseDirectory>
<fileSets>
<fileSet>
<directory>target${file.separator}libs</directory>
<outputDirectory>${file.separator}</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>target${file.separator}classes</directory>
<outputDirectory>${file.separator}</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
</assembly>