git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@152602 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bf15cee6bc
commit
b1b51eb9b0
|
@ -19,8 +19,11 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.NewCookie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ggiammat on 5/9/17.
|
* Created by ggiammat on 5/9/17.
|
||||||
*/
|
*/
|
||||||
|
@ -378,17 +381,19 @@ public class SVNUpdater {
|
||||||
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");
|
||||||
|
|
||||||
***REMOVED*** check if the algorithm is already in the list (match the class
|
|
||||||
***REMOVED*** name)
|
List<String> newContent = new LinkedList<>(Arrays.asList(lines));
|
||||||
|
|
||||||
|
***REMOVED*** check if the algorithm is already in the list (match the class name) and delete the content
|
||||||
for (String l : lines) {
|
for (String l : lines) {
|
||||||
if (l.contains(algorithm.getClazz())) {
|
if (l.contains(algorithm.getClazz())) {
|
||||||
System.out.println("Not updating algorithm list beacuse already present");
|
newContent.remove(l);
|
||||||
return;
|
***REMOVED***System.out.println("Not updating algorithm list beacuse already present");
|
||||||
|
***REMOVED***return;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
***REMOVED*** the algorithm is not in the list. Add it
|
***REMOVED*** the algorithm is not in the list or must be overwritten cause some modification. Add it
|
||||||
List<String> newContent = new LinkedList<>(Arrays.asList(lines));
|
|
||||||
newContent.add(this.generateAlgorithmEntry(algorithm, targetVRE, category,algorithm_type, env));
|
newContent.add(this.generateAlgorithmEntry(algorithm, targetVRE, category,algorithm_type, env));
|
||||||
***REMOVED*** Collections.sort(newContent);
|
***REMOVED*** Collections.sort(newContent);
|
||||||
|
|
||||||
|
@ -425,6 +430,8 @@ public class SVNUpdater {
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String category, String algorithm_type,String env) {
|
public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String category, String algorithm_type,String env) {
|
||||||
|
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer("| ");
|
StringBuffer sb = new StringBuffer("| ");
|
||||||
sb.append(algorithm.getName() + " | ");
|
sb.append(algorithm.getName() + " | ");
|
||||||
sb.append(algorithm.getFullname() + " | ");
|
sb.append(algorithm.getFullname() + " | ");
|
||||||
|
@ -434,6 +441,7 @@ public class SVNUpdater {
|
||||||
+ algorithm.getClazz() + " " + targetVRE + " " + algorithm_type + " N "
|
+ algorithm.getClazz() + " " + targetVRE + " " + algorithm_type + " N "
|
||||||
+ algorithm.getPackageURL() + " \"" + algorithm.getDescription() + "\" </notextile> | ");
|
+ algorithm.getPackageURL() + " \"" + algorithm.getDescription() + "\" </notextile> | ");
|
||||||
sb.append("none | ");
|
sb.append("none | ");
|
||||||
|
sb.append(timestamp + " | ");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
@ -638,10 +646,10 @@ public class SVNUpdater {
|
||||||
SVNUpdater c = new SVNUpdater(sc);
|
SVNUpdater c = new SVNUpdater(sc);
|
||||||
|
|
||||||
***REMOVED***File a = new File("/home/ngalante/Desktop/testCiro");
|
***REMOVED***File a = new File("/home/ngalante/Desktop/testCiro");
|
||||||
File b = new File ("/home/ngalante/Desktop/testB");
|
***REMOVED***File b = new File ("/home/ngalante/Desktop/testB");
|
||||||
|
|
||||||
***REMOVED***c.updateAlgorithmFiles(a);
|
***REMOVED***c.updateAlgorithmFiles(a);
|
||||||
c.updateAlgorithmFiles(b);
|
***REMOVED***c.updateAlgorithmFiles(b);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue