463 lines
18 KiB
Java
463 lines
18 KiB
Java
***REMOVED***
|
|
|
|
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
|
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
|
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
|
|
|
***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.net.MalformedURLException;
|
|
***REMOVED***
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedHashMap;
|
|
***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;
|
|
|
|
***REMOVED***
|
|
import org.gcube.common.resources.gcore.GenericResource;
|
|
import org.gcube.common.resources.gcore.Resources;
|
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
|
***REMOVED***
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
|
***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.RegistryPublisherFactory;
|
|
import org.gcube.informationsystem.publisher.ScopedPublisher;
|
|
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
|
***REMOVED***
|
|
***REMOVED***
|
|
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;
|
|
|
|
***REMOVED***
|
|
|
|
public class DMPMClientConfigurator {
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(DMPMClientConfigurator.class);
|
|
|
|
public String getStagingHost() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/ghost/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getProdHost() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/ghost/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingAlgorithmsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.algorithms-list/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getStageRepository() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.software.repo/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getGhostAlgoDirectory() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.algo.ghost.repo/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingLinuxCompiledDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-linux-compiled/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingPreInstalledDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-pre-installed/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingRBDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-r-blackbox/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingCRANDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-r/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingJavaDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-java/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingKWDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-knime-workflow/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingOctaveDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-octave/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingPythonDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-python/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNStagingWCDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/stage/svn.stage.deps-windows-compiled/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdAlgorithmsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.algorithms-list/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getProdRepository() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.software.repo/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getProdGhostAlgoDirectory() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.algo.ghost.repo/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdLinuxCompiledDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-linux-compiled/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdPreInstalledDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-pre-installed/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdRBDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-r-blackbox/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdCRANDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-r/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdJavaDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-java/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdKWDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-knime-workflow/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdOctaveDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-octave/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdPythonDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-python/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNProdWCDepsList() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource/Profile/Body/prod/svn.prod.deps-windows-compiled/text()");
|
|
DiscoveryClient<String> client = client();
|
|
List<String> ds = client.submit(query);
|
|
for (String a : ds) {
|
|
ghost = a;
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
public String getSVNRepository() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource");
|
|
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
|
List<GenericResource> ds = client.submit(query);
|
|
for (GenericResource a : ds) {
|
|
ghost = a.profile().body().getElementsByTagName("svn.repository").item(0).getTextContent();
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
***REMOVED*** public String getSVNRepo() {
|
|
***REMOVED*** ***REMOVED*** TODO Auto-generated method stub
|
|
***REMOVED***
|
|
***REMOVED*** String ghost = "";
|
|
***REMOVED*** SimpleQuery query = queryFor(GenericResource.class);
|
|
***REMOVED*** query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource");
|
|
***REMOVED*** DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
|
***REMOVED*** List<GenericResource> ds = client.submit(query);
|
|
***REMOVED*** for (GenericResource a : ds) {
|
|
***REMOVED*** ghost = a.profile().body().getElementsByTagName("svn_repo").item(0).getTextContent();
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED*** return ghost;
|
|
***REMOVED******REMOVED***
|
|
|
|
public String getSVNMainAlgoRepo() {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
String ghost = "";
|
|
SimpleQuery query = queryFor(GenericResource.class);
|
|
query.addCondition("$resource/Profile/SecondaryType/text() eq 'DMPMConfigurator'").setResult("$resource");
|
|
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
|
List<GenericResource> ds = client.submit(query);
|
|
for (GenericResource a : ds) {
|
|
ghost = a.profile().body().getElementsByTagName("svn.algo.main.repo").item(0).getTextContent();
|
|
***REMOVED***
|
|
return ghost.trim();
|
|
***REMOVED***
|
|
|
|
|
|
public static void main(String[] args) throws IOException, SVNException {
|
|
DMPMClientConfigurator a = new DMPMClientConfigurator();
|
|
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
|
***REMOVED***SecurityTokenProvider.instance.set("708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548");
|
|
|
|
System.out.println(a.getSVNProdCRANDepsList());
|
|
***REMOVED***System.out.println(a.getRepo());
|
|
***REMOVED***System.out.println(a.getAlgoRepo());
|
|
***REMOVED***System.out.println(a.getSVNRepo());
|
|
|
|
***REMOVED***
|
|
***REMOVED***
|