git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@160699 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1460808417
commit
f1eb9b8e1e
|
@ -10,13 +10,19 @@ import org.gcube.common.scope.api.ScopeProvider;
|
|||
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AlgorithmPackage {
|
||||
|
||||
private Algorithm algorithm;
|
||||
private boolean includeAlgorithmDependencies;
|
||||
public AlgorithmPackage(Algorithm a,boolean includeAlgorithmDependencies) {
|
||||
this.algorithm = a;
|
||||
private Logger logger;
|
||||
|
||||
public AlgorithmPackage(Algorithm a,boolean includeAlgorithmDependencies)
|
||||
{
|
||||
this.logger = LoggerFactory.getLogger(AlgorithmPackage.class);
|
||||
this.algorithm = a;
|
||||
this.includeAlgorithmDependencies = includeAlgorithmDependencies;
|
||||
|
||||
}
|
||||
|
@ -61,12 +67,13 @@ public class AlgorithmPackage {
|
|||
Role r = tm.fillRoleTemplate(template, dictionary);
|
||||
r.setName(roleName);
|
||||
out.add(r);
|
||||
} else {
|
||||
System.out.println("WARNING: template is null");
|
||||
} else
|
||||
{
|
||||
this.logger.warn("WARNING: template is null");
|
||||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
// e.printStackTrace();
|
||||
System.out.println("WARNING: no template found for " + roleName);
|
||||
this.logger.warn("WARNING: no template found for " + roleName);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
|
|
@ -6,16 +6,20 @@ import java.util.Vector;
|
|||
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class CustomDependencyPackage extends DependencyPackage {
|
||||
|
||||
public CustomDependencyPackage(Dependency d) {
|
||||
super(d);
|
||||
private Logger logger;
|
||||
|
||||
public CustomDependencyPackage(Dependency dependency)
|
||||
{
|
||||
super(dependency);
|
||||
}
|
||||
|
||||
private String getCustomRepositoryLocation(String ansibleRoot) {
|
||||
return ansibleRoot+"/custom";
|
||||
}
|
||||
// private String getCustomRepositoryLocation(String ansibleRoot) {
|
||||
// return ansibleRoot+"/custom";
|
||||
// }
|
||||
|
||||
/*
|
||||
public void serializeTo(String ansibleRoot) {
|
||||
|
@ -54,7 +58,7 @@ public class CustomDependencyPackage extends DependencyPackage {
|
|||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
// e.printStackTrace();
|
||||
System.out.println("WARNING: no custom role found for " + roleName);
|
||||
this.logger.warn("WARNING: no custom role found for " + roleName);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
|
|
@ -10,11 +10,7 @@ import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleSeriali
|
|||
|
||||
public class CustomRoleManager {
|
||||
|
||||
private String root;
|
||||
|
||||
public CustomRoleManager() {
|
||||
|
||||
}
|
||||
|
||||
public String getRoot() {
|
||||
String input = AnsibleBridge.class.getClassLoader().getResource("custom").getPath();
|
||||
|
|
|
@ -8,13 +8,18 @@ import java.util.Vector;
|
|||
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DependencyPackage {
|
||||
|
||||
private Logger logger;
|
||||
|
||||
private Dependency dependency;
|
||||
|
||||
public DependencyPackage(Dependency d) {
|
||||
this.dependency = d;
|
||||
public DependencyPackage(Dependency dependency) {
|
||||
this.dependency = dependency;
|
||||
this.logger = LoggerFactory.getLogger(DependencyPackage.class);
|
||||
}
|
||||
|
||||
protected Map<String, String> getDictionary(Dependency d) {
|
||||
|
@ -42,11 +47,11 @@ public class DependencyPackage {
|
|||
r.setName(roleName);
|
||||
out.add(r);
|
||||
} else {
|
||||
System.out.println("WARNING: template is null");
|
||||
this.logger.warn("WARNING: template is null");
|
||||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
// e.printStackTrace();
|
||||
System.out.println("WARNING: no template found for " + roleName);
|
||||
this.logger.warn("WARNING: no template found for " + roleName);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
|
|
@ -4,8 +4,8 @@ import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
|||
|
||||
public class OSDependencyPackage extends DependencyPackage {
|
||||
|
||||
public OSDependencyPackage(Dependency d) {
|
||||
super(d);
|
||||
public OSDependencyPackage(Dependency dependency) {
|
||||
super(dependency);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.template;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Vector;
|
||||
|
||||
|
|
|
@ -13,13 +13,21 @@ import org.gcube.common.scope.api.ScopeProvider;
|
|||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Cluster;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.util.CheckPermission;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
|
||||
public class HAProxy {
|
||||
|
||||
private Logger logger;
|
||||
|
||||
private CSVReader reader;
|
||||
|
||||
public HAProxy() {
|
||||
this.logger = LoggerFactory.getLogger(HAProxy.class);
|
||||
}
|
||||
|
||||
// public Cluster getClusterByHProxy() throws IOException {
|
||||
// Cluster cl = new Cluster();
|
||||
// String HProxy = ISClient.getHProxy();
|
||||
|
@ -121,11 +129,11 @@ public class HAProxy {
|
|||
Host b = new Host();
|
||||
b.setName(nextLine[1]);
|
||||
out.add(b);
|
||||
System.out.println(b.getFullyQualifiedName());
|
||||
this.logger.info(b.getFullyQualifiedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println(out);
|
||||
this.logger.info(out.toString());
|
||||
return out;
|
||||
|
||||
}
|
||||
|
|
|
@ -3,29 +3,11 @@ package org.gcube.dataanalysis.dataminer.poolmanager.clients;
|
|||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.io.StringWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
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 org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
|
@ -34,12 +16,7 @@ import org.gcube.common.resources.gcore.Resources;
|
|||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Cluster;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
|
||||
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.RegistryPublisherFactory;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.tmatesoft.svn.core.SVNDepth;
|
||||
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;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
|
||||
public class ISClient {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ISClient.class);
|
||||
private Logger logger;
|
||||
|
||||
public ISClient() {
|
||||
this.logger = LoggerFactory.getLogger(ISClient.class);
|
||||
}
|
||||
|
||||
|
||||
public Host getDataminer(String hostname) {
|
||||
Host h = new Host();
|
||||
|
@ -196,11 +164,11 @@ public class ISClient {
|
|||
ScopedPublisher scopedPublisher = RegistryPublisherFactory.scopedPublisher();
|
||||
AdvancedScopedPublisher advancedScopedPublisher = new AdvancedScopedPublisher(scopedPublisher);
|
||||
String id = resource.id();
|
||||
LOGGER.debug("Trying to remove {} with ID {} from {}", resource.getClass().getSimpleName(), id,
|
||||
this.logger.info("Trying to remove {} with ID {} from {}", resource.getClass().getSimpleName(), id,
|
||||
ScopeProvider.instance.get());
|
||||
// scopedPublisher.remove(resource, scopes);
|
||||
advancedScopedPublisher.forceRemove(resource);
|
||||
LOGGER.debug("{} with ID {} removed successfully", resource.getClass().getSimpleName(), id);
|
||||
this.logger.info("{} with ID {} removed successfully", resource.getClass().getSimpleName(), id);
|
||||
}
|
||||
|
||||
public void publishScopedResource(GenericResource a, List<String> scopes)
|
||||
|
@ -210,11 +178,11 @@ public class ISClient {
|
|||
|
||||
ScopedPublisher scopedPublisher = RegistryPublisherFactory.scopedPublisher();
|
||||
try {
|
||||
System.out.println(scopes);
|
||||
System.out.println(stringWriter);
|
||||
this.logger.debug(scopes.toString());
|
||||
this.logger.debug(stringWriter.toString());
|
||||
scopedPublisher.create(a, scopes);
|
||||
} catch (RegistryNotFoundException e) {
|
||||
System.out.println(e);
|
||||
this.logger.error("Registry not found",e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
|
||||
public class DMPMClientConfiguratorManager{
|
||||
public class DMPMClientConfiguratorManager
|
||||
{
|
||||
private final Logger logger;
|
||||
private Properties defaultAdmins;
|
||||
private String admins;
|
||||
|
|
|
@ -3,36 +3,21 @@ package org.gcube.dataanalysis.dataminer.poolmanager.clients.configurations;
|
|||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
|
||||
public abstract class AbstractConfiguration {
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract class AbstractConfiguration
|
||||
{
|
||||
|
||||
private String host;
|
||||
|
||||
private String algorithmsList;
|
||||
|
||||
private String softwareRepo;
|
||||
|
||||
private String ghostRepo;
|
||||
|
||||
private String depsLinuxCompiled;
|
||||
|
||||
private String depsPreInstalled;
|
||||
|
||||
private String depsRBlackbox;
|
||||
|
||||
private String depsR;
|
||||
|
||||
private String depsJava;
|
||||
|
||||
private String depsKnimeWorkflow;
|
||||
|
||||
private String depsOctave;
|
||||
|
||||
private String depsPython;
|
||||
|
||||
private String depsWindowsCompiled;
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@ package org.gcube.dataanalysis.dataminer.poolmanager.datamodel;
|
|||
public class Action {
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private String script;
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -9,36 +9,24 @@ import java.util.Vector;
|
|||
public class Algorithm {
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
private String username;
|
||||
private String fullname;
|
||||
|
||||
private String email;
|
||||
|
||||
private String language;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private String clazz;
|
||||
|
||||
private String category;
|
||||
|
||||
private String algorithmType;
|
||||
|
||||
private String skipJava;
|
||||
|
||||
private String packageURL;
|
||||
|
||||
private Collection<Action> actions;
|
||||
|
||||
private Collection<Dependency> dependencies;
|
||||
|
||||
public Algorithm() {
|
||||
this.actions = new Vector<>();
|
||||
this.dependencies = new Vector<>();
|
||||
Dependency p = new Dependency();
|
||||
// Dependency p = new Dependency();
|
||||
|
||||
//init with default values
|
||||
this.skipJava = "N";
|
||||
|
|
|
@ -6,39 +6,46 @@ import java.util.Vector;
|
|||
public class AlgorithmSet {
|
||||
|
||||
private String name;
|
||||
|
||||
private Collection<Algorithm> algorithms;
|
||||
|
||||
public AlgorithmSet() {
|
||||
public AlgorithmSet()
|
||||
{
|
||||
this.algorithms = new Vector<>();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Collection<Algorithm> getAlgorithms() {
|
||||
public Collection<Algorithm> getAlgorithms()
|
||||
{
|
||||
return new Vector<>(algorithms);
|
||||
}
|
||||
|
||||
public void addAlgorithm(Algorithm algoritm) {
|
||||
public void addAlgorithm(Algorithm algoritm)
|
||||
{
|
||||
this.algorithms.add(algoritm);
|
||||
}
|
||||
|
||||
public Boolean hasAlgorithm(Algorithm algorithm) {
|
||||
public Boolean hasAlgorithm(Algorithm algorithm)
|
||||
{
|
||||
for (Algorithm a : this.algorithms) {
|
||||
if (a.getName().equals(algorithm.getName())) {
|
||||
if (a.getName().equals(algorithm.getName()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
public String toString()
|
||||
{
|
||||
String out = "ALGOSET: " + this.name + "\n";
|
||||
for(Algorithm a:this.algorithms) {
|
||||
out+=a+"\n";
|
||||
|
|
|
@ -25,40 +25,49 @@ public class Cluster {
|
|||
*/
|
||||
private Collection<AlgorithmSet> algoSets;
|
||||
|
||||
public Cluster() {
|
||||
public Cluster()
|
||||
{
|
||||
this.hosts = new Vector<>();
|
||||
this.algoSets = new Vector<>();
|
||||
}
|
||||
|
||||
public void addAlgorithmSet(AlgorithmSet set) {
|
||||
public void addAlgorithmSet(AlgorithmSet set)
|
||||
{
|
||||
this.algoSets.add(set);
|
||||
}
|
||||
|
||||
public void addHost(Host host) {
|
||||
public void addHost(Host host)
|
||||
{
|
||||
this.hosts.add(host);
|
||||
}
|
||||
|
||||
public Collection<Host> getHosts() {
|
||||
public Collection<Host> getHosts()
|
||||
{
|
||||
return hosts;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Collection<AlgorithmSet> getAlgorithmSets() {
|
||||
public Collection<AlgorithmSet> getAlgorithmSets()
|
||||
{
|
||||
return algoSets;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ package org.gcube.dataanalysis.dataminer.poolmanager.datamodel;
|
|||
public class Dependency {
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
public String getName() {
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class Host {
|
|||
}
|
||||
|
||||
public Host() {
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
}
|
||||
|
||||
public String getFullyQualifiedName() {
|
||||
|
|
|
@ -10,9 +10,10 @@ import java.util.Vector;
|
|||
import java.util.zip.ZipEntry;
|
||||
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.Dependency;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AlgorithmPackageParser {
|
||||
|
||||
|
@ -20,35 +21,32 @@ public class AlgorithmPackageParser {
|
|||
* The name of the file containing algorithm metadata. Expected in the root
|
||||
* 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";
|
||||
// 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";
|
||||
|
||||
private static final String METADATA_CATEGORY = "Algorithm Category";
|
||||
|
||||
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 AlgorithmPackageParser() {
|
||||
this.logger = LoggerFactory.getLogger(AlgorithmPackageParser.class);
|
||||
}
|
||||
|
||||
public Algorithm parsePackage(String url) throws IOException {
|
||||
String packageMetadata = this.getPackageMetadata(url);
|
||||
if (packageMetadata == null) {
|
||||
System.out.println("WARNING: No metadata found for " + url);
|
||||
this.logger.warn("WARNING: No metadata found for " + url);
|
||||
return null;
|
||||
} else {
|
||||
Map<String, List<String>> parsedMetadata = this.parseMetadata(packageMetadata);
|
||||
|
@ -125,7 +123,7 @@ public class AlgorithmPackageParser {
|
|||
out.put(key, values);
|
||||
}
|
||||
values.add(value);
|
||||
System.out.println(key + METADATA_KEY_VALUE_SEPARATOR + " " + values);
|
||||
this.logger.debug(key + METADATA_KEY_VALUE_SEPARATOR + " " + values);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
|
|
@ -35,18 +35,17 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.AlgorithmSet;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
|
||||
public interface PoolManager {
|
||||
|
||||
String addAlgorithmToVRE(Algorithm algo, String vre, boolean test ) throws IOException, InterruptedException;
|
||||
String addAlgorithmToHost(Algorithm algo, String host,boolean test) throws IOException, InterruptedException;
|
||||
public interface PoolManager
|
||||
{
|
||||
String addAlgorithmToVRE(Algorithm algo, String vre, boolean test ) throws IOException, InterruptedException;
|
||||
|
||||
String addAlgorithmToHost(Algorithm algo, String host,boolean test) 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;
|
||||
|
||||
|
@ -61,6 +60,7 @@ public interface PoolManager {
|
|||
void addAlgToIs(Algorithm algo);
|
||||
|
||||
Set<Algorithm> getAlgoFromIs();
|
||||
|
||||
List<String> updateSVN(String file, List<String> ldep) throws SVNException, IOException;
|
||||
|
||||
|
||||
|
|
|
@ -24,20 +24,18 @@ import org.slf4j.LoggerFactory;
|
|||
import org.tmatesoft.svn.core.SVNException;
|
||||
|
||||
@Path("/")
|
||||
public class RestPoolManager implements PoolManager {
|
||||
|
||||
|
||||
|
||||
public class RestPoolManager implements PoolManager
|
||||
{
|
||||
//@Context ServletContext context;
|
||||
|
||||
private final Logger logger;
|
||||
|
||||
private DataminerPoolManager service;
|
||||
|
||||
//@Context
|
||||
//private ApplicationContext context = ContextProvider.get();
|
||||
|
||||
public RestPoolManager() {
|
||||
public RestPoolManager()
|
||||
{
|
||||
this.logger = LoggerFactory.getLogger(RestPoolManager.class);
|
||||
this.service = new DataminerPoolManager();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class DataminerPoolManager {
|
|||
this.svnUpdaterStaging = new SVNUpdaterStaging();
|
||||
this.svnUpdaterProduction = new SVNUpdaterProduction();
|
||||
} catch (SVNException e) {
|
||||
e.printStackTrace();
|
||||
this.logger.error("SVN Exception",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ public abstract class CheckMethod {
|
|||
String operatorName = line.substring(line.indexOf(">") + 1);
|
||||
operatorName = operatorName.substring(0, operatorName.indexOf("<"));
|
||||
this.logger.debug("Operator "+operatorName);
|
||||
System.out.println(" " + operatorName);
|
||||
URL innerRequestURL = new URL(baseDescriptionRequest + operatorName);
|
||||
BufferedReader innerBufferedReader = new BufferedReader(
|
||||
new InputStreamReader(innerRequestURL.openStream()));
|
||||
|
@ -225,12 +224,9 @@ public abstract class CheckMethod {
|
|||
session.connect();
|
||||
Channel channel = session.openChannel(SFTP_PROTOCOL);
|
||||
channel.connect();
|
||||
System.out.println("shell channel connected....");
|
||||
|
||||
this.logger.debug("shell channel connected....");
|
||||
ChannelSftp c = (ChannelSftp) channel;
|
||||
|
||||
|
||||
System.out.println(path);
|
||||
this.logger.debug(path);
|
||||
|
||||
try {
|
||||
c.lstat(path);
|
||||
|
|
|
@ -4,21 +4,24 @@ import static org.gcube.common.authorization.client.Constants.authorizationServi
|
|||
|
||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class CheckPermission {
|
||||
|
||||
public CheckPermission() {
|
||||
}
|
||||
private static final Logger logger = LoggerFactory.getLogger(CheckPermission.class);
|
||||
|
||||
|
||||
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);
|
||||
if (entry.getContext().equals(vre)) {
|
||||
System.out.println("Authorization OK!");
|
||||
logger.info("Authorization OK!");
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ public abstract class SVNUpdater {
|
|||
sb.append("none | ");
|
||||
sb.append(this.getTimeZone() + " | ");
|
||||
|
||||
System.out.println("Algo details: "+sb.toString());
|
||||
this.logger.info("Algo details: "+sb.toString());
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ public abstract class SVNUpdater {
|
|||
|
||||
boolean check = false;
|
||||
try {
|
||||
System.out.println("Checking dependencies list: " + file);
|
||||
this.logger.info("Checking dependencies list: " + file);
|
||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
|
||||
String lines[] = byteArrayOutputStream.toString().split("\\r?\\n");
|
||||
|
@ -448,8 +448,10 @@ public abstract class SVNUpdater {
|
|||
}
|
||||
}
|
||||
// }
|
||||
} catch (Exception a) {
|
||||
a.getMessage();
|
||||
} catch (Exception a)
|
||||
{
|
||||
this.logger.error(a.getMessage(),a);
|
||||
|
||||
}
|
||||
|
||||
return check;
|
||||
|
@ -458,7 +460,7 @@ public abstract class SVNUpdater {
|
|||
|
||||
public void updateSVN(String file, Collection<Dependency> deps) {
|
||||
try {
|
||||
System.out.println("Updating dependencies list: " + file);
|
||||
this.logger.info("Updating dependencies list: " + file);
|
||||
|
||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
|
||||
|
@ -537,7 +539,7 @@ public abstract class SVNUpdater {
|
|||
Date fromDate = formatter.parse(cal.getTime().toString());
|
||||
TimeZone central = TimeZone.getTimeZone("UTC");
|
||||
formatter.setTimeZone(central);
|
||||
System.out.println(formatter.format(fromDate));
|
||||
this.logger.info(formatter.format(fromDate));
|
||||
return formatter.format(fromDate);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ public class SendMail {
|
|||
HttpGet getReq = new HttpGet(serviceAddress);
|
||||
getReq.setHeader("accept", 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());
|
||||
|
||||
|
|
Loading…
Reference in New Issue