This commit is contained in:
Ciro Formisano 2017-12-20 11:01:01 +00:00
parent 623ff51624
commit 929e74f355
23 changed files with 138 additions and 174 deletions

View File

@ -10,13 +10,19 @@ import java.util.Vector;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role; import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
***REMOVED***
***REMOVED***
public class AlgorithmPackage { public class AlgorithmPackage {
private Algorithm algorithm; private Algorithm algorithm;
private boolean includeAlgorithmDependencies; private boolean includeAlgorithmDependencies;
public AlgorithmPackage(Algorithm a,boolean includeAlgorithmDependencies) { private Logger logger;
this.algorithm = a;
public AlgorithmPackage(Algorithm a,boolean includeAlgorithmDependencies)
{
this.logger = LoggerFactory.getLogger(AlgorithmPackage.class);
this.algorithm = a;
this.includeAlgorithmDependencies = includeAlgorithmDependencies; this.includeAlgorithmDependencies = includeAlgorithmDependencies;
***REMOVED*** ***REMOVED***
@ -61,12 +67,13 @@ public class AlgorithmPackage {
Role r = tm.fillRoleTemplate(template, dictionary); Role r = tm.fillRoleTemplate(template, dictionary);
r.setName(roleName); r.setName(roleName);
out.add(r); out.add(r);
***REMOVED*** else { ***REMOVED*** else
System.out.println("WARNING: template is null"); {
this.logger.warn("WARNING: template is null");
***REMOVED*** ***REMOVED***
***REMOVED*** catch (NoSuchElementException e) { ***REMOVED*** catch (NoSuchElementException e) {
***REMOVED*** e.printStackTrace(); ***REMOVED*** e.printStackTrace();
System.out.println("WARNING: no template found for " + roleName); this.logger.warn("WARNING: no template found for " + roleName);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
return out; return out;

View File

@ -6,16 +6,20 @@ import java.util.Vector;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role; import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
***REMOVED***
public class CustomDependencyPackage extends DependencyPackage { public class CustomDependencyPackage extends DependencyPackage {
public CustomDependencyPackage(Dependency d) { ***REMOVED***
super(d);
public CustomDependencyPackage(Dependency dependency)
{
super(dependency);
***REMOVED*** ***REMOVED***
private String getCustomRepositoryLocation(String ansibleRoot) { ***REMOVED*** private String getCustomRepositoryLocation(String ansibleRoot) {
return ansibleRoot+"/custom"; ***REMOVED*** return ansibleRoot+"/custom";
***REMOVED*** ***REMOVED*** ***REMOVED***
/* /*
public void serializeTo(String ansibleRoot) { public void serializeTo(String ansibleRoot) {
@ -54,7 +58,7 @@ public class CustomDependencyPackage extends DependencyPackage {
***REMOVED*** ***REMOVED***
***REMOVED*** catch (NoSuchElementException e) { ***REMOVED*** catch (NoSuchElementException e) {
***REMOVED*** e.printStackTrace(); ***REMOVED*** e.printStackTrace();
System.out.println("WARNING: no custom role found for " + roleName); this.logger.warn("WARNING: no custom role found for " + roleName);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
return out; return out;

View File

@ -10,11 +10,7 @@ import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleSeriali
public class CustomRoleManager { public class CustomRoleManager {
private String root;
public CustomRoleManager() {
***REMOVED***
public String getRoot() { public String getRoot() {
String input = AnsibleBridge.class.getClassLoader().getResource("custom").getPath(); String input = AnsibleBridge.class.getClassLoader().getResource("custom").getPath();

View File

@ -8,13 +8,18 @@ import java.util.Vector;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role; import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
***REMOVED***
***REMOVED***
public class DependencyPackage { public class DependencyPackage {
***REMOVED***
private Dependency dependency; private Dependency dependency;
public DependencyPackage(Dependency d) { public DependencyPackage(Dependency dependency) {
this.dependency = d; this.dependency = dependency;
this.logger = LoggerFactory.getLogger(DependencyPackage.class);
***REMOVED*** ***REMOVED***
protected Map<String, String> getDictionary(Dependency d) { protected Map<String, String> getDictionary(Dependency d) {
@ -42,11 +47,11 @@ public class DependencyPackage {
r.setName(roleName); r.setName(roleName);
out.add(r); out.add(r);
***REMOVED*** else { ***REMOVED*** else {
System.out.println("WARNING: template is null"); this.logger.warn("WARNING: template is null");
***REMOVED*** ***REMOVED***
***REMOVED*** catch (NoSuchElementException e) { ***REMOVED*** catch (NoSuchElementException e) {
***REMOVED*** e.printStackTrace(); ***REMOVED*** e.printStackTrace();
System.out.println("WARNING: no template found for " + roleName); this.logger.warn("WARNING: no template found for " + roleName);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
return out; return out;

View File

@ -4,8 +4,8 @@ import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
public class OSDependencyPackage extends DependencyPackage { public class OSDependencyPackage extends DependencyPackage {
public OSDependencyPackage(Dependency d) { public OSDependencyPackage(Dependency dependency) {
super(d); super(dependency);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***

View File

@ -2,7 +2,6 @@ package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.template;
import java.io.File; import java.io.File;
***REMOVED*** ***REMOVED***
import java.io.InputStream;
import java.util.Collection; import java.util.Collection;
import java.util.Vector; import java.util.Vector;

View File

@ -4,28 +4,10 @@ import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
***REMOVED*** ***REMOVED***
import java.io.ByteArrayOutputStream;
import java.io.File;
***REMOVED***
import java.io.InputStream;
***REMOVED***
import java.io.PrintStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.net.MalformedURLException;
***REMOVED***
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
***REMOVED*** ***REMOVED***
***REMOVED***
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector; import java.util.Vector;
***REMOVED*** ***REMOVED***
@ -35,11 +17,6 @@ import org.gcube.common.resources.gcore.ServiceEndpoint;
***REMOVED*** ***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
***REMOVED*** ***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.comparator.HostComparator;
import org.gcube.dataanalysis.dataminer.poolmanager.service.DataminerPoolManager;
import org.gcube.informationsystem.publisher.AdvancedScopedPublisher; import org.gcube.informationsystem.publisher.AdvancedScopedPublisher;
import org.gcube.informationsystem.publisher.RegistryPublisherFactory; import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
import org.gcube.informationsystem.publisher.ScopedPublisher; import org.gcube.informationsystem.publisher.ScopedPublisher;
@ -48,24 +25,15 @@ import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery; import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.wc.ISVNOptions;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
***REMOVED***
public class ISClient { public class ISClient {
private static final Logger LOGGER = LoggerFactory.getLogger(ISClient.class); ***REMOVED***
public ISClient() {
this.logger = LoggerFactory.getLogger(ISClient.class);
***REMOVED***
public Host getDataminer(String hostname) { public Host getDataminer(String hostname) {
Host h = new Host(); Host h = new Host();
@ -196,11 +164,11 @@ public class ISClient {
ScopedPublisher scopedPublisher = RegistryPublisherFactory.scopedPublisher(); ScopedPublisher scopedPublisher = RegistryPublisherFactory.scopedPublisher();
AdvancedScopedPublisher advancedScopedPublisher = new AdvancedScopedPublisher(scopedPublisher); AdvancedScopedPublisher advancedScopedPublisher = new AdvancedScopedPublisher(scopedPublisher);
String id = resource.id(); String id = resource.id();
LOGGER.debug("Trying to remove {***REMOVED*** with ID {***REMOVED*** from {***REMOVED***", resource.getClass().getSimpleName(), id, this.logger.info("Trying to remove {***REMOVED*** with ID {***REMOVED*** from {***REMOVED***", resource.getClass().getSimpleName(), id,
ScopeProvider.instance.get()); ScopeProvider.instance.get());
***REMOVED*** scopedPublisher.remove(resource, scopes); ***REMOVED*** scopedPublisher.remove(resource, scopes);
advancedScopedPublisher.forceRemove(resource); advancedScopedPublisher.forceRemove(resource);
LOGGER.debug("{***REMOVED*** with ID {***REMOVED*** removed successfully", resource.getClass().getSimpleName(), id); this.logger.info("{***REMOVED*** with ID {***REMOVED*** removed successfully", resource.getClass().getSimpleName(), id);
***REMOVED*** ***REMOVED***
public void publishScopedResource(GenericResource a, List<String> scopes) public void publishScopedResource(GenericResource a, List<String> scopes)
@ -210,11 +178,11 @@ public class ISClient {
ScopedPublisher scopedPublisher = RegistryPublisherFactory.scopedPublisher(); ScopedPublisher scopedPublisher = RegistryPublisherFactory.scopedPublisher();
try { try {
System.out.println(scopes); this.logger.debug(scopes.toString());
System.out.println(stringWriter); this.logger.debug(stringWriter.toString());
scopedPublisher.create(a, scopes); scopedPublisher.create(a, scopes);
***REMOVED*** catch (RegistryNotFoundException e) { ***REMOVED*** catch (RegistryNotFoundException e) {
System.out.println(e); this.logger.error("Registry not found",e);
throw e; throw e;
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***

View File

@ -11,7 +11,8 @@ import org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration.Config
***REMOVED*** ***REMOVED***
import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNException;
public class DMPMClientConfiguratorManager{ public class DMPMClientConfiguratorManager
{
private final Logger logger; private final Logger logger;
private Properties defaultAdmins; private Properties defaultAdmins;
private String admins; private String admins;

View File

@ -3,36 +3,21 @@ package org.gcube.dataanalysis.dataminer.poolmanager.clients.configurations;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
public abstract class AbstractConfiguration { public abstract class AbstractConfiguration
{
private String host; private String host;
private String algorithmsList; private String algorithmsList;
private String softwareRepo; private String softwareRepo;
private String ghostRepo; private String ghostRepo;
private String depsLinuxCompiled; private String depsLinuxCompiled;
private String depsPreInstalled; private String depsPreInstalled;
private String depsRBlackbox; private String depsRBlackbox;
private String depsR; private String depsR;
private String depsJava; private String depsJava;
private String depsKnimeWorkflow; private String depsKnimeWorkflow;
private String depsOctave; private String depsOctave;
private String depsPython; private String depsPython;
private String depsWindowsCompiled; private String depsWindowsCompiled;

View File

@ -3,9 +3,7 @@ package org.gcube.dataanalysis.dataminer.poolmanager.datamodel;
public class Action { public class Action {
private String name; private String name;
private String description; private String description;
private String script; private String script;
public String getName() { public String getName() {

View File

@ -9,36 +9,24 @@ import java.util.Vector;
public class Algorithm { public class Algorithm {
private String username; private String username;
private String fullname; private String fullname;
private String email; private String email;
private String language; private String language;
private String name; private String name;
private String description; private String description;
private String clazz; private String clazz;
private String category; private String category;
private String algorithmType; private String algorithmType;
private String skipJava; private String skipJava;
private String packageURL; private String packageURL;
private Collection<Action> actions; private Collection<Action> actions;
private Collection<Dependency> dependencies; private Collection<Dependency> dependencies;
public Algorithm() { public Algorithm() {
this.actions = new Vector<>(); this.actions = new Vector<>();
this.dependencies = new Vector<>(); this.dependencies = new Vector<>();
Dependency p = new Dependency(); ***REMOVED*** Dependency p = new Dependency();
***REMOVED***init with default values ***REMOVED***init with default values
this.skipJava = "N"; this.skipJava = "N";

View File

@ -6,39 +6,46 @@ import java.util.Vector;
public class AlgorithmSet { public class AlgorithmSet {
private String name; private String name;
private Collection<Algorithm> algorithms; private Collection<Algorithm> algorithms;
public AlgorithmSet() { public AlgorithmSet()
{
this.algorithms = new Vector<>(); this.algorithms = new Vector<>();
***REMOVED*** ***REMOVED***
public String getName() { public String getName()
{
return name; return name;
***REMOVED*** ***REMOVED***
public void setName(String name) { public void setName(String name)
{
this.name = name; this.name = name;
***REMOVED*** ***REMOVED***
public Collection<Algorithm> getAlgorithms() { public Collection<Algorithm> getAlgorithms()
{
return new Vector<>(algorithms); return new Vector<>(algorithms);
***REMOVED*** ***REMOVED***
public void addAlgorithm(Algorithm algoritm) { public void addAlgorithm(Algorithm algoritm)
{
this.algorithms.add(algoritm); this.algorithms.add(algoritm);
***REMOVED*** ***REMOVED***
public Boolean hasAlgorithm(Algorithm algorithm) { public Boolean hasAlgorithm(Algorithm algorithm)
{
for (Algorithm a : this.algorithms) { for (Algorithm a : this.algorithms) {
if (a.getName().equals(algorithm.getName())) { if (a.getName().equals(algorithm.getName()))
{
return true; return true;
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
return false; return false;
***REMOVED*** ***REMOVED***
public String toString() { public String toString()
{
String out = "ALGOSET: " + this.name + "\n"; String out = "ALGOSET: " + this.name + "\n";
for(Algorithm a:this.algorithms) { for(Algorithm a:this.algorithms) {
out+=a+"\n"; out+=a+"\n";

View File

@ -25,40 +25,49 @@ public class Cluster {
*/ */
private Collection<AlgorithmSet> algoSets; private Collection<AlgorithmSet> algoSets;
public Cluster() { public Cluster()
{
this.hosts = new Vector<>(); this.hosts = new Vector<>();
this.algoSets = new Vector<>(); this.algoSets = new Vector<>();
***REMOVED*** ***REMOVED***
public void addAlgorithmSet(AlgorithmSet set) { public void addAlgorithmSet(AlgorithmSet set)
{
this.algoSets.add(set); this.algoSets.add(set);
***REMOVED*** ***REMOVED***
public void addHost(Host host) { public void addHost(Host host)
{
this.hosts.add(host); this.hosts.add(host);
***REMOVED*** ***REMOVED***
public Collection<Host> getHosts() { public Collection<Host> getHosts()
{
return hosts; return hosts;
***REMOVED*** ***REMOVED***
public String getName() { public String getName()
{
return name; return name;
***REMOVED*** ***REMOVED***
public void setName(String name) { public void setName(String name)
{
this.name = name; this.name = name;
***REMOVED*** ***REMOVED***
public String getDescription() { public String getDescription()
{
return description; return description;
***REMOVED*** ***REMOVED***
public void setDescription(String description) { public void setDescription(String description)
{
this.description = description; this.description = description;
***REMOVED*** ***REMOVED***
public Collection<AlgorithmSet> getAlgorithmSets() { public Collection<AlgorithmSet> getAlgorithmSets()
{
return algoSets; return algoSets;
***REMOVED*** ***REMOVED***

View File

@ -3,10 +3,10 @@ package org.gcube.dataanalysis.dataminer.poolmanager.datamodel;
public class Dependency { public class Dependency {
private String name; private String name;
private String type; private String type;
public String getName() { public String getName()
{
return name; return name;
***REMOVED*** ***REMOVED***

View File

@ -11,7 +11,7 @@ public class Host {
***REMOVED*** ***REMOVED***
public Host() { public Host() {
***REMOVED*** TODO Auto-generated constructor stub
***REMOVED*** ***REMOVED***
public String getFullyQualifiedName() { public String getFullyQualifiedName() {

View File

@ -10,9 +10,10 @@ import java.util.Vector;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import org.apache.commons.lang.StringEscapeUtils;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
***REMOVED***
***REMOVED***
public class AlgorithmPackageParser { public class AlgorithmPackageParser {
@ -20,35 +21,32 @@ public class AlgorithmPackageParser {
* The name of the file containing algorithm metadata. Expected in the root * The name of the file containing algorithm metadata. Expected in the root
* directory of the package. * directory of the package.
*/ */
private static final String METADATA_FILE_NAME = "Info.txt"; private final String METADATA_FILE_NAME = "Info.txt",
METADATA_USERNAME = "Username",
METADATA_FULLNAME = "Full Name",
METADATA_EMAIL = "Email",
METADATA_LANGUAGE = "Language",
METADATA_CATEGORY = "Algorithm Category",
METADATA_ALGORITHM_NAME = "Algorithm Name",
METADATA_ALGORITHM_DESCRIPTION = "Algorithm Description",
METADATA_CLASS_NAME = "Class Name",
private static final String METADATA_USERNAME = "Username"; ***REMOVED*** private static final String METADATA_PACKAGES = "Packages";
private static final String METADATA_FULLNAME = "Full Name"; METADATA_KEY_VALUE_SEPARATOR = ":";
private static final String METADATA_EMAIL = "Email"; private final int BUFFER_SIZE = 4096;
private Logger logger;
private static final String METADATA_LANGUAGE = "Language"; public AlgorithmPackageParser() {
this.logger = LoggerFactory.getLogger(AlgorithmPackageParser.class);
private static final String METADATA_CATEGORY = "Algorithm Category"; ***REMOVED***
private static final String METADATA_ALGORITHM_NAME = "Algorithm Name";
private static final String METADATA_ALGORITHM_DESCRIPTION = "Algorithm Description";
private static final String METADATA_CLASS_NAME = "Class Name";
private static final String METADATA_PACKAGES = "Packages";
private static final String METADATA_KEY_VALUE_SEPARATOR = ":";
private static final int BUFFER_SIZE = 4096;
public Algorithm parsePackage(String url) throws IOException { public Algorithm parsePackage(String url) throws IOException {
String packageMetadata = this.getPackageMetadata(url); String packageMetadata = this.getPackageMetadata(url);
if (packageMetadata == null) { if (packageMetadata == null) {
System.out.println("WARNING: No metadata found for " + url); this.logger.warn("WARNING: No metadata found for " + url);
return null; return null;
***REMOVED*** else { ***REMOVED*** else {
Map<String, List<String>> parsedMetadata = this.parseMetadata(packageMetadata); Map<String, List<String>> parsedMetadata = this.parseMetadata(packageMetadata);
@ -125,7 +123,7 @@ public class AlgorithmPackageParser {
out.put(key, values); out.put(key, values);
***REMOVED*** ***REMOVED***
values.add(value); values.add(value);
System.out.println(key + METADATA_KEY_VALUE_SEPARATOR + " " + values); this.logger.debug(key + METADATA_KEY_VALUE_SEPARATOR + " " + values);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
return out; return out;

View File

@ -35,18 +35,17 @@ import java.net.UnknownHostException;
import java.util.Set; import java.util.Set;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.AlgorithmSet;
import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNException;
public interface PoolManager { public interface PoolManager
{
String addAlgorithmToVRE(Algorithm algo, String vre, boolean test ) throws IOException, InterruptedException; String addAlgorithmToVRE(Algorithm algo, String vre, boolean test ) throws IOException, InterruptedException;
String addAlgorithmToHost(Algorithm algo, String host,boolean test) throws IOException, InterruptedException;
String addAlgorithmToHost(Algorithm algo, String host,boolean test) throws IOException, InterruptedException;
String stageAlgorithm(String algorithmPackageURL) throws IOException, InterruptedException; String stageAlgorithm(String algorithmPackageURL) throws IOException, InterruptedException;
String publishAlgorithm(String algorithmPackageURL, String targetVREToken, String targetVRE) throws IOException, InterruptedException;
String publishAlgorithm(String algorithmPackageURL, String targetVREToken, String targetVRE) throws IOException, InterruptedException;
Algorithm extractAlgorithm(String url) throws IOException; Algorithm extractAlgorithm(String url) throws IOException;
@ -61,6 +60,7 @@ public interface PoolManager {
void addAlgToIs(Algorithm algo); void addAlgToIs(Algorithm algo);
Set<Algorithm> getAlgoFromIs(); Set<Algorithm> getAlgoFromIs();
List<String> updateSVN(String file, List<String> ldep) throws SVNException, IOException; List<String> updateSVN(String file, List<String> ldep) throws SVNException, IOException;

View File

@ -24,20 +24,18 @@ import org.gcube.dataanalysis.dataminer.poolmanager.util.AlgorithmBuilder;
import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNException;
@Path("/") @Path("/")
public class RestPoolManager implements PoolManager { public class RestPoolManager implements PoolManager
{
***REMOVED***@Context ServletContext context; ***REMOVED***@Context ServletContext context;
private final Logger logger; private final Logger logger;
private DataminerPoolManager service; private DataminerPoolManager service;
***REMOVED***@Context ***REMOVED***@Context
***REMOVED***private ApplicationContext context = ContextProvider.get(); ***REMOVED***private ApplicationContext context = ContextProvider.get();
public RestPoolManager() { public RestPoolManager()
{
this.logger = LoggerFactory.getLogger(RestPoolManager.class); this.logger = LoggerFactory.getLogger(RestPoolManager.class);
this.service = new DataminerPoolManager(); this.service = new DataminerPoolManager();

View File

@ -30,7 +30,7 @@ public class DataminerPoolManager {
this.svnUpdaterStaging = new SVNUpdaterStaging(); this.svnUpdaterStaging = new SVNUpdaterStaging();
this.svnUpdaterProduction = new SVNUpdaterProduction(); this.svnUpdaterProduction = new SVNUpdaterProduction();
***REMOVED*** catch (SVNException e) { ***REMOVED*** catch (SVNException e) {
e.printStackTrace(); this.logger.error("SVN Exception",e);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***

View File

@ -81,7 +81,6 @@ public abstract class CheckMethod {
String operatorName = line.substring(line.indexOf(">") + 1); String operatorName = line.substring(line.indexOf(">") + 1);
operatorName = operatorName.substring(0, operatorName.indexOf("<")); operatorName = operatorName.substring(0, operatorName.indexOf("<"));
this.logger.debug("Operator "+operatorName); this.logger.debug("Operator "+operatorName);
System.out.println(" " + operatorName);
URL innerRequestURL = new URL(baseDescriptionRequest + operatorName); URL innerRequestURL = new URL(baseDescriptionRequest + operatorName);
BufferedReader innerBufferedReader = new BufferedReader( BufferedReader innerBufferedReader = new BufferedReader(
new InputStreamReader(innerRequestURL.openStream())); new InputStreamReader(innerRequestURL.openStream()));
@ -225,12 +224,9 @@ public abstract class CheckMethod {
session.connect(); session.connect();
Channel channel = session.openChannel(SFTP_PROTOCOL); Channel channel = session.openChannel(SFTP_PROTOCOL);
channel.connect(); channel.connect();
System.out.println("shell channel connected...."); this.logger.debug("shell channel connected....");
ChannelSftp c = (ChannelSftp) channel; ChannelSftp c = (ChannelSftp) channel;
this.logger.debug(path);
System.out.println(path);
try { try {
c.lstat(path); c.lstat(path);

View File

@ -4,21 +4,24 @@ import static org.gcube.common.authorization.client.Constants.authorizationServi
***REMOVED*** ***REMOVED***
import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.authorization.library.AuthorizationEntry;
***REMOVED***
***REMOVED***
public class CheckPermission { public class CheckPermission {
public CheckPermission() { private static final Logger logger = LoggerFactory.getLogger(CheckPermission.class);
***REMOVED***
public static boolean apply(String VREToken, String vre) throws ObjectNotFound, Exception {
public static boolean apply(String VREToken, String vre) throws ObjectNotFound, Exception
{
AuthorizationEntry entry = authorizationService().get(VREToken); AuthorizationEntry entry = authorizationService().get(VREToken);
if (entry.getContext().equals(vre)) { if (entry.getContext().equals(vre)) {
System.out.println("Authorization OK!"); logger.info("Authorization OK!");
return true; return true;
***REMOVED*** ***REMOVED***
System.out.println("Not a valid token recognized for the VRE: "+vre); logger.info("Not a valid token recognized for the VRE: "+vre);
return false; return false;
***REMOVED*** ***REMOVED***

View File

@ -310,7 +310,7 @@ public abstract class SVNUpdater {
sb.append("none | "); sb.append("none | ");
sb.append(this.getTimeZone() + " | "); sb.append(this.getTimeZone() + " | ");
System.out.println("Algo details: "+sb.toString()); this.logger.info("Algo details: "+sb.toString());
return sb.toString(); return sb.toString();
***REMOVED*** ***REMOVED***
@ -419,7 +419,7 @@ public abstract class SVNUpdater {
boolean check = false; boolean check = false;
try { try {
System.out.println("Checking dependencies list: " + file); this.logger.info("Checking dependencies list: " + file);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
String lines[] = byteArrayOutputStream.toString().split("\\r?\\n"); String lines[] = byteArrayOutputStream.toString().split("\\r?\\n");
@ -448,8 +448,10 @@ public abstract class SVNUpdater {
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED*** ***REMOVED*** ***REMOVED***
***REMOVED*** catch (Exception a) { ***REMOVED*** catch (Exception a)
a.getMessage(); {
this.logger.error(a.getMessage(),a);
***REMOVED*** ***REMOVED***
return check; return check;
@ -458,7 +460,7 @@ public abstract class SVNUpdater {
public void updateSVN(String file, Collection<Dependency> deps) { public void updateSVN(String file, Collection<Dependency> deps) {
try { try {
System.out.println("Updating dependencies list: " + file); this.logger.info("Updating dependencies list: " + file);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
@ -537,7 +539,7 @@ public abstract class SVNUpdater {
Date fromDate = formatter.parse(cal.getTime().toString()); Date fromDate = formatter.parse(cal.getTime().toString());
TimeZone central = TimeZone.getTimeZone("UTC"); TimeZone central = TimeZone.getTimeZone("UTC");
formatter.setTimeZone(central); formatter.setTimeZone(central);
System.out.println(formatter.format(fromDate)); this.logger.info(formatter.format(fromDate));
return formatter.format(fromDate); return formatter.format(fromDate);
***REMOVED*** ***REMOVED***

View File

@ -209,7 +209,7 @@ public class SendMail {
HttpGet getReq = new HttpGet(serviceAddress); HttpGet getReq = new HttpGet(serviceAddress);
getReq.setHeader("accept", JSON_MIME_TYPE); getReq.setHeader("accept", JSON_MIME_TYPE);
getReq.setHeader("content-type", JSON_MIME_TYPE); getReq.setHeader("content-type", JSON_MIME_TYPE);
System.out.println(EntityUtils.toString(client.execute(getReq).getEntity())); this.logger.info(EntityUtils.toString(client.execute(getReq).getEntity()));
return EntityUtils.toString(client.execute(getReq).getEntity()); return EntityUtils.toString(client.execute(getReq).getEntity());