commit 496a092007dd681174f709bc23bb3f18361b2337 Author: Luca Frosini Date: Thu Jan 21 10:58:32 2016 +0000 Moved project from private branch to trunk git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/is-sweeper-se-plugin@122411 82a268e6-3cf1-43bd-a215-b396298e98cf diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..4201ad7 --- /dev/null +++ b/.classpath @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..24d07a1 --- /dev/null +++ b/.project @@ -0,0 +1,36 @@ + + + is-sweeper-se-plugin + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..443e085 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..e535934 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,6 @@ + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..1b22d70 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/distro/INSTALL b/distro/INSTALL new file mode 100644 index 0000000..e0b544a --- /dev/null +++ b/distro/INSTALL @@ -0,0 +1 @@ +Used as a plugin of SmartExecutor \ No newline at end of file diff --git a/distro/LICENSE b/distro/LICENSE new file mode 100644 index 0000000..bd0c2b4 --- /dev/null +++ b/distro/LICENSE @@ -0,0 +1,8 @@ +gCube System - License +------------------------------------------------------------ + +The gCube/gCore software is licensed as Free Open Source software conveying to +the EUPL (http://ec.europa.eu/idabc/eupl). +The software and documentation is provided by its authors/distributors "as is" +and no expressed or implied warranty is given for its use, quality or fitness +for a particular case. diff --git a/distro/MAINTAINERS b/distro/MAINTAINERS new file mode 100644 index 0000000..ba9c41c --- /dev/null +++ b/distro/MAINTAINERS @@ -0,0 +1,2 @@ +Luca Frosini (luca.frosini@isti.cnr.it), CNR Pisa, +Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" \ No newline at end of file diff --git a/distro/README b/distro/README new file mode 100644 index 0000000..8ae8c28 --- /dev/null +++ b/distro/README @@ -0,0 +1,41 @@ +The gCube System - Smart Executor Plugin + +------------------------------------------------------------ + +This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), +D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), +and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1). + + +Authors +------- + +* Luca Frosini (luca.frosini@isti.cnr.it), CNR Pisa, + Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo". + + +Version and Release Date +------------------------ + +v. 1.0.0 * First release + +Description +----------- +${description} + + +Download information +-------------------- +${scm.url} + + +Documentation +------------- + + + +Licensing +--------- + +This software is licensed under the terms you may find in the file named "LICENSE" in this directory. + diff --git a/distro/changelog.xml b/distro/changelog.xml new file mode 100644 index 0000000..99653cc --- /dev/null +++ b/distro/changelog.xml @@ -0,0 +1,5 @@ + + + First Release + + \ No newline at end of file diff --git a/distro/descriptor.xml b/distro/descriptor.xml new file mode 100644 index 0000000..c468f13 --- /dev/null +++ b/distro/descriptor.xml @@ -0,0 +1,48 @@ + + servicearchive + + tar.gz + + / + + + ${distroDirectory} + / + true + + README + LICENSE + INSTALL + MAINTAINERS + changelog.xml + + 755 + true + + + target/apidocs + /${artifactId}/doc/api + true + 755 + + + + + ${distroDirectory}/profile.xml + ./ + true + + + target/${build.finalName}.jar + /${artifactId} + + + ${distroDirectory}/svnpath.txt + /${artifactId} + true + + + \ No newline at end of file diff --git a/distro/profile.xml b/distro/profile.xml new file mode 100644 index 0000000..ef3a69e --- /dev/null +++ b/distro/profile.xml @@ -0,0 +1,27 @@ + + + + Service + + {description} + VREManagement + ${artifactId} + 1.0.0 + + + {description} + ${artifactId} + ${version} + + ${groupId} + ${artifactId} + ${version} + + library + + ${build.finalName}.jar + + + + + \ No newline at end of file diff --git a/distro/svnpath.txt b/distro/svnpath.txt new file mode 100644 index 0000000..edacb04 --- /dev/null +++ b/distro/svnpath.txt @@ -0,0 +1 @@ +${scm.url} \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..1aeaefc --- /dev/null +++ b/pom.xml @@ -0,0 +1,136 @@ + + 4.0.0 + + + org.gcube.tools + maven-parent + 1.0.0 + + + org.gcube.information-system + is-sweeper-se-plugin + 1.0.0-SNAPSHOT + IS Sweeper Smart Executor Plugin + Smart Executor Plugin to run Sweeper. Normally is launched as Scheduled Task + + + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId} + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId} + https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId} + + + + + + org.gcube.distribution + maven-smartgears-bom + LATEST + pom + import + + + + + + UTF-8 + src/main/resources/META-INF/services + distro + + + + + org.gcube.vremanagement + smart-executor-api + [1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + org.slf4j + slf4j-api + provided + + + + + org.gcube.resources + registry-publisher + test + + + org.gcube.core + common-encryption + test + + + org.gcube.core + common-scope + test + + + org.gcube.vremanagement + smart-executor-client + [1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT) + test + + + junit + junit + 4.11 + test + + + ch.qos.logback + logback-classic + 1.0.13 + test + + + + + + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-assembly-plugin + + + ${distroDirectory}/descriptor.xml + + + + + servicearchive + install + + single + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + jar-with-dependencies + + + + + package + + single + + + + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/vremanagement/smartexecutor/sweeper/ScheduledTaskSweeperPlugin.java b/src/main/java/org/gcube/vremanagement/smartexecutor/sweeper/ScheduledTaskSweeperPlugin.java new file mode 100644 index 0000000..0009092 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/smartexecutor/sweeper/ScheduledTaskSweeperPlugin.java @@ -0,0 +1,40 @@ +package org.gcube.vremanagement.smartexecutor.sweeper; + +import java.util.Map; + +import org.gcube.vremanagement.executor.plugin.Plugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + */ +public class ScheduledTaskSweeperPlugin extends Plugin { + + /** + * Logger + */ + private static Logger logger = LoggerFactory.getLogger(ScheduledTaskSweeperPlugin.class); + + public ScheduledTaskSweeperPlugin(ScheduledTaskSweeperPluginDeclaration pluginDeclaration) { + super(pluginDeclaration); + logger.debug("contructor"); + } + + /**{@inheritDoc}*/ + @Override + public void launch(Map inputs) throws Exception { + logger.debug("Launching {} execution", ScheduledTaskSweeperPluginDeclaration.NAME); + // No inputs needed + logger.debug("{} execution finished", ScheduledTaskSweeperPluginDeclaration.NAME); + } + + /**{@inheritDoc}*/ + @Override + protected void onStop() throws Exception { + logger.debug("onStop()"); + + Thread.currentThread().interrupt(); + } + +} diff --git a/src/main/java/org/gcube/vremanagement/smartexecutor/sweeper/ScheduledTaskSweeperPluginDeclaration.java b/src/main/java/org/gcube/vremanagement/smartexecutor/sweeper/ScheduledTaskSweeperPluginDeclaration.java new file mode 100644 index 0000000..19eda6a --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/smartexecutor/sweeper/ScheduledTaskSweeperPluginDeclaration.java @@ -0,0 +1,76 @@ +/** + * + */ +package org.gcube.vremanagement.smartexecutor.sweeper; + +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; + +/** + * Scheduled Task Sweeper find orphaned scheduled task on SmartExecutor + * persistence and make them available. This requires interaction with + * SmartExecutor Persistence and with IS t find orphaned Running Instances + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + */ +public class ScheduledTaskSweeperPluginDeclaration implements PluginDeclaration { + + /** + * Logger + */ + private static Logger logger = LoggerFactory.getLogger(ScheduledTaskSweeperPlugin.class); + + /** + * Plugin name used by the Executor to retrieve this class + */ + public static final String NAME = "ScheduledTaskSweeper"; + public static final String DESCRIPTION = + "Scheduled Task Sweeper find orphaned scheduled task on SmartExecutor " + + "persistence and make them available. This requires interaction with " + + "SmartExecutor Persistence and with IS to find orphaned Running " + + "Instances"; + public static final String VERSION = "1.0.0"; + + /**{@inheritDoc}*/ + @Override + public void init() { + logger.debug(String.format("%s initialized", ScheduledTaskSweeperPlugin.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 getSupportedCapabilities() { + Map discoveredCapabilities = new HashMap(); + // No capabilities to discover + return discoveredCapabilities; + } + + /**{@inheritDoc}*/ + @Override + public Class> getPluginImplementation() { + return ScheduledTaskSweeperPlugin.class; + } + +} diff --git a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration new file mode 100644 index 0000000..8cd9035 --- /dev/null +++ b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration @@ -0,0 +1 @@ +org.gcube.vremanagement.smartexecutor.sweeper.ScheduledTaskSweeperPluginDeclaration \ No newline at end of file