Code redesign
Refs #11756: Refactor DataHArvesterPlugin to support scheduled execution from smart-executor Task-Url: https://support.d4science.org/issues/11756 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@167596 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a91ece8a0f
commit
9db4794c16
|
@ -24,6 +24,10 @@ import org.gcube.vremanagement.executor.plugin.Plugin;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDeclaration> {
|
public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDeclaration> {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterPlugin.class);
|
private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterPlugin.class);
|
||||||
|
@ -70,15 +74,6 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final InheritableThreadLocal<ContextAuthorization> contextAuthorization = new InheritableThreadLocal<ContextAuthorization>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ContextAuthorization initialValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void launch(Map<String,Object> inputs) throws Exception {
|
public void launch(Map<String,Object> inputs) throws Exception {
|
||||||
|
|
|
@ -9,9 +9,14 @@ import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class DataHarvestPluginDeclaration implements PluginDeclaration {
|
public class DataHarvestPluginDeclaration implements PluginDeclaration {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(DataHarvestPluginDeclaration.class);
|
private static Logger logger = LoggerFactory.getLogger(DataHarvestPluginDeclaration.class);
|
||||||
|
|
||||||
public static final String NAME = "AccountingDataHarvester";
|
public static final String NAME = "AccountingDataHarvester";
|
||||||
public static final String DESCRIPTION = "Data Harvest for Accounting Summary Dashboard";
|
public static final String DESCRIPTION = "Data Harvest for Accounting Summary Dashboard";
|
||||||
public static final String VERSION = "1.0.0";
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
|
@ -15,6 +15,10 @@ import org.postgresql.util.PSQLException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class Dao {
|
public class Dao {
|
||||||
private Connection conn = null;
|
private Connection conn = null;
|
||||||
private static Logger logger = LoggerFactory.getLogger(Dao.class);
|
private static Logger logger = LoggerFactory.getLogger(Dao.class);
|
||||||
|
|
|
@ -5,12 +5,12 @@ package org.gcube.dataharvest.dao;
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public class DaoException extends Exception {
|
public class DaoException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6302570066137502483L;
|
private static final long serialVersionUID = -6302570066137502483L;
|
||||||
|
|
||||||
public DaoException() {
|
public DaoException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ public class DaoException extends Exception {
|
||||||
public DaoException(String message) {
|
public DaoException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DaoException(String message, Throwable throwable) {
|
public DaoException(String message, Throwable throwable) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,49 +4,48 @@ package org.gcube.dataharvest.dao;
|
||||||
* @author Eric Perrone (ISTI - CNR)
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DatabaseConnectionData {
|
public class DatabaseConnectionData {
|
||||||
|
|
||||||
protected String uri;
|
protected String uri;
|
||||||
protected String user;
|
protected String user;
|
||||||
protected String password;
|
protected String password;
|
||||||
|
|
||||||
public DatabaseConnectionData() {
|
public DatabaseConnectionData() {
|
||||||
this.uri = null;
|
this.uri = null;
|
||||||
this.user = null;
|
this.user = null;
|
||||||
this.password = null;
|
this.password = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatabaseConnectionData(String uri, String user, String password) {
|
public DatabaseConnectionData(String uri, String user, String password) {
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getURI() {
|
public String getURI() {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setURI(String uri) {
|
public void setURI(String uri) {
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUser() {
|
public String getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(String user) {
|
public void setUser(String user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.getClass().getSimpleName() + " [uri =" + uri + ", user=" + user + ", password=" + password + "]";
|
return this.getClass().getSimpleName() + " [uri =" + uri + ", user=" + user + ", password=" + password + "]";
|
||||||
|
|
|
@ -7,6 +7,10 @@ import org.gcube.dataharvest.datamodel.HarvestedData;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class DatabaseManager {
|
public class DatabaseManager {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(DatabaseManager.class);
|
private static Logger logger = LoggerFactory.getLogger(DatabaseManager.class);
|
||||||
|
|
|
@ -39,8 +39,9 @@ public class DatabaseParameterRetriever {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkParameter(String parameter, String parameterName, boolean localDB) throws DaoException {
|
protected void checkParameter(String parameter, String parameterName, boolean localDB) throws DaoException {
|
||||||
if(parameter ==null || parameter.isEmpty()) {
|
if(parameter == null || parameter.isEmpty()) {
|
||||||
throw new DaoException("DB " + parameterName + " cannot be null nor empty. Please check your " + (localDB ? "local configuration." : "ServiceEndpoint"));
|
throw new DaoException("DB " + parameterName + " cannot be null nor empty. Please check your "
|
||||||
|
+ (localDB ? "local configuration." : "ServiceEndpoint"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,15 +59,16 @@ public class DatabaseParameterRetriever {
|
||||||
uri = properties.getProperty(DB_URI);
|
uri = properties.getProperty(DB_URI);
|
||||||
username = properties.getProperty(DB_USERNAME);
|
username = properties.getProperty(DB_USERNAME);
|
||||||
password = properties.getProperty(DB_PASSWORD);
|
password = properties.getProperty(DB_PASSWORD);
|
||||||
}else {
|
} else {
|
||||||
try {
|
try {
|
||||||
String className = this.getClass().getSimpleName();
|
String className = this.getClass().getSimpleName();
|
||||||
|
|
||||||
SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class);
|
SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class);
|
||||||
query.addCondition(
|
query.addCondition(
|
||||||
String.format("$resource/Profile/Category/text() eq '%s'", SERVICE_ENDPOINT_CATEGORY));
|
String.format("$resource/Profile/Category/text() eq '%s'", SERVICE_ENDPOINT_CATEGORY));
|
||||||
query.addCondition(String.format("$resource/Profile/Name/text() eq '%s'", SERVICE_ENDPOINT_NAME));
|
query.addCondition(String.format("$resource/Profile/Name/text() eq '%s'", SERVICE_ENDPOINT_NAME));
|
||||||
query.addCondition(String.format("$resource/Profile/AccessPoint/Interface/Endpoint/@EntryName eq '%s'", className));
|
query.addCondition(String.format("$resource/Profile/AccessPoint/Interface/Endpoint/@EntryName eq '%s'",
|
||||||
|
className));
|
||||||
|
|
||||||
DiscoveryClient<ServiceEndpoint> client = ICFactory.clientFor(ServiceEndpoint.class);
|
DiscoveryClient<ServiceEndpoint> client = ICFactory.clientFor(ServiceEndpoint.class);
|
||||||
List<ServiceEndpoint> serviceEndpoints = client.submit(query);
|
List<ServiceEndpoint> serviceEndpoints = client.submit(query);
|
||||||
|
@ -75,7 +77,7 @@ public class DatabaseParameterRetriever {
|
||||||
}
|
}
|
||||||
|
|
||||||
Group<AccessPoint> accessPoints = serviceEndpoints.get(0).profile().accessPoints();
|
Group<AccessPoint> accessPoints = serviceEndpoints.get(0).profile().accessPoints();
|
||||||
|
|
||||||
for(AccessPoint accessPoint : accessPoints) {
|
for(AccessPoint accessPoint : accessPoints) {
|
||||||
if(accessPoint.name().compareTo(className) == 0) {
|
if(accessPoint.name().compareTo(className) == 0) {
|
||||||
uri = accessPoint.address();
|
uri = accessPoint.address();
|
||||||
|
@ -98,7 +100,7 @@ public class DatabaseParameterRetriever {
|
||||||
checkParameter(username, "Username", localDB);
|
checkParameter(username, "Username", localDB);
|
||||||
|
|
||||||
checkParameter(password, "Password", localDB);
|
checkParameter(password, "Password", localDB);
|
||||||
|
|
||||||
return new DatabaseConnectionData(uri, username, password);
|
return new DatabaseConnectionData(uri, username, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,12 @@ package org.gcube.dataharvest.datamodel;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class HarvestedData implements Serializable {
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public class HarvestedData implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +26,7 @@ public class HarvestedData implements Serializable {
|
||||||
public static int SOCIAL_LIKES = 10;
|
public static int SOCIAL_LIKES = 10;
|
||||||
public static int METHOD_INVOCATIONS = 11;
|
public static int METHOD_INVOCATIONS = 11;
|
||||||
public static int VISUAL_TOOLS = 12;
|
public static int VISUAL_TOOLS = 12;
|
||||||
|
|
||||||
private int dataType;
|
private int dataType;
|
||||||
private String context;
|
private String context;
|
||||||
private long measure;
|
private long measure;
|
||||||
|
@ -39,49 +43,48 @@ public class HarvestedData implements Serializable {
|
||||||
this.measure = measure;
|
this.measure = measure;
|
||||||
this.day = day;
|
this.day = day;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HarvestedData(int dataType, String context, long measure) {
|
public HarvestedData(int dataType, String context, long measure) {
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.measure = measure;
|
this.measure = measure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDataType(int dataType) {
|
public void setDataType(int dataType) {
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContext(String context) {
|
public void setContext(String context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMeasure(long measure) {
|
public void setMeasure(long measure) {
|
||||||
this.measure = measure;
|
this.measure = measure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDay(Date day) {
|
public void setDay(Date day) {
|
||||||
this.day = day;
|
this.day = day;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDataType() {
|
public int getDataType() {
|
||||||
return dataType;
|
return dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContext() {
|
public String getContext() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMeasure() {
|
public long getMeasure() {
|
||||||
return measure;
|
return measure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDay() {
|
public Date getDay() {
|
||||||
return day;
|
return day;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Harvest [context=" + context + ", dataType=" + dataType + ", measure=" + measure + "]";
|
return "Harvest [context=" + context + ", dataType=" + dataType + ", measure=" + measure + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,22 +19,19 @@ public abstract class BasicHarvester {
|
||||||
public Date startDate;
|
public Date startDate;
|
||||||
public Date endDate;
|
public Date endDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BasicHarvester(Date start, Date end) throws ParseException {
|
public BasicHarvester(Date start, Date end) throws ParseException {
|
||||||
startDate = start;
|
startDate = start;
|
||||||
endDate = end;
|
endDate = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCurrentContext(String token) throws Exception{
|
public static String getCurrentContext(String token) throws Exception {
|
||||||
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
|
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
|
||||||
String context = authorizationEntry.getContext();
|
String context = authorizationEntry.getContext();
|
||||||
logger.info("Context of token {} is {}", token, context);
|
logger.info("Context of token {} is {}", token, context);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setContext(String token) throws Exception {
|
||||||
public static void setContext(String token) throws Exception{
|
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
ScopeProvider.instance.set(getCurrentContext(token));
|
ScopeProvider.instance.set(getCurrentContext(token));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class SocialHarvester extends BasicHarvester {
|
public class SocialHarvester extends BasicHarvester {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(SocialHarvester.class);
|
private static Logger logger = LoggerFactory.getLogger(SocialHarvester.class);
|
||||||
|
|
|
@ -14,15 +14,18 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class VreUsersHarvester extends BasicHarvester {
|
public class VreUsersHarvester extends BasicHarvester {
|
||||||
|
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(VreUsersHarvester.class);
|
private static Logger logger = LoggerFactory.getLogger(VreUsersHarvester.class);
|
||||||
|
|
||||||
public VreUsersHarvester(Date start, Date end) throws ParseException {
|
public VreUsersHarvester(Date start, Date end) throws ParseException {
|
||||||
super(start, end);
|
super(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HarvestedData> getData() throws Exception {
|
public List<HarvestedData> getData() throws Exception {
|
||||||
String context = Utils.getCurrentContext();
|
String context = Utils.getCurrentContext();
|
||||||
|
@ -33,12 +36,12 @@ public class VreUsersHarvester extends BasicHarvester {
|
||||||
ArrayList<HarvestedData> data = new ArrayList<HarvestedData>();
|
ArrayList<HarvestedData> data = new ArrayList<HarvestedData>();
|
||||||
data.add(harvest);
|
data.add(harvest);
|
||||||
return data;
|
return data;
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("Error Haversting Context Users for context {}", context, e);
|
logger.error("Error Haversting Context Users for context {}", context, e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int get() throws MalformedURLException, IOException {
|
private int get() throws MalformedURLException, IOException {
|
||||||
int userNumber = 0;
|
int userNumber = 0;
|
||||||
// la seguente stringa deve essere letta dinamicamente
|
// la seguente stringa deve essere letta dinamicamente
|
||||||
|
@ -46,7 +49,7 @@ public class VreUsersHarvester extends BasicHarvester {
|
||||||
String token = SecurityTokenProvider.instance.get();
|
String token = SecurityTokenProvider.instance.get();
|
||||||
JSONObject jsonObject = new JSONObject(Utils.getJson(url + token));
|
JSONObject jsonObject = new JSONObject(Utils.getJson(url + token));
|
||||||
Boolean success = (Boolean) jsonObject.get("success");
|
Boolean success = (Boolean) jsonObject.get("success");
|
||||||
if (success == false) {
|
if(success == false) {
|
||||||
String message = "get-all-usernames returned an error. token: " + token;
|
String message = "get-all-usernames returned an error. token: " + token;
|
||||||
logger.error(message);
|
logger.error(message);
|
||||||
throw new IOException(message);
|
throw new IOException(message);
|
||||||
|
|
|
@ -22,16 +22,20 @@ import org.gcube.dataharvest.utils.Utils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class DataMethodDownloadHarvester extends BasicHarvester {
|
public class DataMethodDownloadHarvester extends BasicHarvester {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(DataMethodDownloadHarvester.class);
|
private static Logger logger = LoggerFactory.getLogger(DataMethodDownloadHarvester.class);
|
||||||
|
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
public DataMethodDownloadHarvester(Date start, Date end) throws ParseException {
|
public DataMethodDownloadHarvester(Date start, Date end) throws ParseException {
|
||||||
super(start, end);
|
super(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HarvestedData> getData() throws Exception {
|
public List<HarvestedData> getData() throws Exception {
|
||||||
String context = Utils.getCurrentContext();
|
String context = Utils.getCurrentContext();
|
||||||
|
@ -42,18 +46,19 @@ public class DataMethodDownloadHarvester extends BasicHarvester {
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
HomeManager manager = HomeLibrary.getHomeManagerFactory().getHomeManager();
|
HomeManager manager = HomeLibrary.getHomeManagerFactory().getHomeManager();
|
||||||
|
|
||||||
String user = getVREName(context) + "-Manager";
|
String user = getVREName(context) + "-Manager";
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
Home home = manager.getHome(user);
|
Home home = manager.getHome(user);
|
||||||
|
|
||||||
JCRWorkspace ws = (JCRWorkspace) home.getWorkspace();
|
JCRWorkspace ws = (JCRWorkspace) home.getWorkspace();
|
||||||
|
|
||||||
JCRWorkspaceItem item = (JCRWorkspaceItem) ws
|
JCRWorkspaceItem item = (JCRWorkspaceItem) ws
|
||||||
.getItemByPath("/Workspace/MySpecialFolders/" + getVREName(context));
|
.getItemByPath("/Workspace/MySpecialFolders/" + getVREName(context));
|
||||||
|
|
||||||
logger.debug("Analyzing " + context + " from " + startDate.toString() + " to " + endDate.toString());
|
logger.debug("Analyzing " + context + " from " + startDate.toString() + " to " + endDate.toString());
|
||||||
|
|
||||||
logger.error("Before getStats()");
|
logger.error("Before getStats()");
|
||||||
getStats(item, startDate, endDate);
|
getStats(item, startDate, endDate);
|
||||||
logger.error("After getStats()");
|
logger.error("After getStats()");
|
||||||
|
@ -62,58 +67,58 @@ public class DataMethodDownloadHarvester extends BasicHarvester {
|
||||||
logger.debug(harvest.toString());
|
logger.debug(harvest.toString());
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("Error Harvesting Data Methods Download for context {}", context, e);
|
logger.error("Error Harvesting Data Methods Download for context {}", context, e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void getStats(WorkspaceItem root, Date start, Date end) throws InternalErrorException {
|
private void getStats(WorkspaceItem root, Date start, Date end) throws InternalErrorException {
|
||||||
List<? extends WorkspaceItem> children;
|
List<? extends WorkspaceItem> children;
|
||||||
if (root.isFolder()) {
|
if(root.isFolder()) {
|
||||||
children = root.getChildren();
|
children = root.getChildren();
|
||||||
for (WorkspaceItem child : children)
|
for(WorkspaceItem child : children)
|
||||||
getStats(child, start, end);
|
getStats(child, start, end);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
List<AccountingEntry> accounting = root.getAccounting();
|
List<AccountingEntry> accounting = root.getAccounting();
|
||||||
for (AccountingEntry entry : accounting) {
|
for(AccountingEntry entry : accounting) {
|
||||||
|
|
||||||
switch (entry.getEntryType()) {
|
switch(entry.getEntryType()) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
case READ:
|
case READ:
|
||||||
Calendar calendar = entry.getDate();
|
Calendar calendar = entry.getDate();
|
||||||
if (calendar.after(Utils.dateToCalendar(start)) && calendar.before(Utils.dateToCalendar(end))) {
|
if(calendar.after(Utils.dateToCalendar(start))
|
||||||
count++;
|
&& calendar.before(Utils.dateToCalendar(end))) {
|
||||||
}
|
count++;
|
||||||
|
}
|
||||||
break;
|
|
||||||
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("DataMethodDownloadHarvester: " + e.getLocalizedMessage());
|
logger.error("DataMethodDownloadHarvester: " + e.getLocalizedMessage());
|
||||||
throw new InternalErrorException(e.getLocalizedMessage());
|
throw new InternalErrorException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getVREName(String vre) {
|
private static String getVREName(String vre) {
|
||||||
Validate.notNull(vre, "scope must be not null");
|
Validate.notNull(vre, "scope must be not null");
|
||||||
|
|
||||||
String newName;
|
String newName;
|
||||||
if (vre.startsWith(JCRRepository.PATH_SEPARATOR))
|
if(vre.startsWith(JCRRepository.PATH_SEPARATOR))
|
||||||
newName = vre.replace(JCRRepository.PATH_SEPARATOR, "-").substring(1);
|
newName = vre.replace(JCRRepository.PATH_SEPARATOR, "-").substring(1);
|
||||||
else
|
else
|
||||||
newName = vre.replace(JCRRepository.PATH_SEPARATOR, "-");
|
newName = vre.replace(JCRRepository.PATH_SEPARATOR, "-");
|
||||||
return newName;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,18 @@ import org.gcube.dataharvest.harvester.BasicHarvester;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class MethodInvocationHarvester extends BasicHarvester {
|
public class MethodInvocationHarvester extends BasicHarvester {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(MethodInvocationHarvester.class);
|
private static Logger logger = LoggerFactory.getLogger(MethodInvocationHarvester.class);
|
||||||
|
|
||||||
public MethodInvocationHarvester(Date start, Date end) throws ParseException {
|
public MethodInvocationHarvester(Date start, Date end) throws ParseException {
|
||||||
super(start, end);
|
super(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HarvestedData> getData() throws Exception {
|
public List<HarvestedData> getData() throws Exception {
|
||||||
try {
|
try {
|
||||||
|
@ -42,39 +46,39 @@ public class MethodInvocationHarvester extends BasicHarvester {
|
||||||
end.setTime(endDate);
|
end.setTime(endDate);
|
||||||
TemporalConstraint temporalConstraint = new TemporalConstraint(start.getTimeInMillis(),
|
TemporalConstraint temporalConstraint = new TemporalConstraint(start.getTimeInMillis(),
|
||||||
end.getTimeInMillis(), AggregationMode.MONTHLY);
|
end.getTimeInMillis(), AggregationMode.MONTHLY);
|
||||||
|
|
||||||
List<Filter> filters = new ArrayList<>();
|
List<Filter> filters = new ArrayList<>();
|
||||||
filters.add(new Filter(ServiceUsageRecord.CALLED_METHOD, "tag"));
|
filters.add(new Filter(ServiceUsageRecord.CALLED_METHOD, "tag"));
|
||||||
|
|
||||||
List<String> contexts = new ArrayList<>();
|
List<String> contexts = new ArrayList<>();
|
||||||
contexts.add("/d4science.research-infrastructures.eu/SoBigData/TagMe");
|
contexts.add("/d4science.research-infrastructures.eu/SoBigData/TagMe");
|
||||||
|
|
||||||
logger.debug("MethodInvocationHarvester::getData()::getContextTimeSeries");
|
logger.debug("MethodInvocationHarvester::getData()::getContextTimeSeries");
|
||||||
SortedMap<Filter, SortedMap<Calendar, Info>> result = accountingPersistenceQuery.getContextTimeSeries(
|
SortedMap<Filter,SortedMap<Calendar,Info>> result = accountingPersistenceQuery.getContextTimeSeries(
|
||||||
AggregatedServiceUsageRecord.class, temporalConstraint, filters, contexts, true);
|
AggregatedServiceUsageRecord.class, temporalConstraint, filters, contexts, true);
|
||||||
if (result == null) {
|
if(result == null) {
|
||||||
logger.error("No data found.");
|
logger.error("No data found.");
|
||||||
} else {
|
} else {
|
||||||
Set<Filter> ks = result.keySet();
|
Set<Filter> ks = result.keySet();
|
||||||
if (ks != null) {
|
if(ks != null) {
|
||||||
Iterator<Filter> ksi = ks.iterator();
|
Iterator<Filter> ksi = ks.iterator();
|
||||||
while (ksi.hasNext()) {
|
while(ksi.hasNext()) {
|
||||||
// System.out.println("" + ksi.next().toString());
|
// System.out.println("" + ksi.next().toString());
|
||||||
logger.debug("Filter: " + ksi.next().toString());
|
logger.debug("Filter: " + ksi.next().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
StackTraceElement[] ste = x.getStackTrace();
|
StackTraceElement[] ste = x.getStackTrace();
|
||||||
String errorMessage = "MethodInvocationHarvester: " + x.getLocalizedMessage();
|
String errorMessage = "MethodInvocationHarvester: " + x.getLocalizedMessage();
|
||||||
for (StackTraceElement s : ste) {
|
for(StackTraceElement s : ste) {
|
||||||
errorMessage += "\n" + s.toString();
|
errorMessage += "\n" + s.toString();
|
||||||
}
|
}
|
||||||
logger.error(errorMessage);
|
logger.error(errorMessage);
|
||||||
throw x;
|
throw x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class ResourceCatalogueHarvester extends BasicHarvester {
|
public class ResourceCatalogueHarvester extends BasicHarvester {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ResourceCatalogueHarvester.class);
|
private static Logger logger = LoggerFactory.getLogger(ResourceCatalogueHarvester.class);
|
||||||
|
@ -91,8 +95,8 @@ public class ResourceCatalogueHarvester extends BasicHarvester {
|
||||||
JSONObject response = jsonObject.getJSONObject("response");
|
JSONObject response = jsonObject.getJSONObject("response");
|
||||||
|
|
||||||
int numFound = response.getInt("numFound");
|
int numFound = response.getInt("numFound");
|
||||||
HarvestedData h = new HarvestedData(dataType, "/d4science.research-infrastructures.eu/SoBigData/ResourceCatalogue",
|
HarvestedData h = new HarvestedData(dataType,
|
||||||
numFound);
|
"/d4science.research-infrastructures.eu/SoBigData/ResourceCatalogue", numFound);
|
||||||
logger.debug(h.toString());
|
logger.debug(h.toString());
|
||||||
data.add(h);
|
data.add(h);
|
||||||
if(numFound > 0) {
|
if(numFound > 0) {
|
||||||
|
@ -166,5 +170,5 @@ public class ResourceCatalogueHarvester extends BasicHarvester {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@ import org.gcube.resourcemanagement.support.server.managers.scope.ScopeManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class ContextAuthorization {
|
public class ContextAuthorization {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ContextAuthorization.class);
|
private static Logger logger = LoggerFactory.getLogger(ContextAuthorization.class);
|
||||||
|
@ -36,15 +39,12 @@ public class ContextAuthorization {
|
||||||
/**
|
/**
|
||||||
* Contains Context full name as key and Token as Value
|
* Contains Context full name as key and Token as Value
|
||||||
*/
|
*/
|
||||||
protected Map<String, String> contextToToken;
|
protected Map<String,String> contextToToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains Token as key and Context full name as Value
|
* Contains Token as key and Context full name as Value
|
||||||
*/
|
*/
|
||||||
protected Map<String, String> tokenToContext;
|
protected Map<String,String> tokenToContext;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains Properties used to generate tokens
|
* Contains Properties used to generate tokens
|
||||||
|
@ -54,18 +54,19 @@ public class ContextAuthorization {
|
||||||
this.tokenToContext = new HashMap<>();
|
this.tokenToContext = new HashMap<>();
|
||||||
retrieveContextsAndTokens();
|
retrieveContextsAndTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getVOFile() {
|
public File getVOFile() {
|
||||||
try {
|
try {
|
||||||
String voFileName = AccountingDataHarvesterPlugin.getProperties().get().getProperty(VO_FILE, DEFAULT_VO_FILENAME);
|
String voFileName = AccountingDataHarvesterPlugin.getProperties().get().getProperty(VO_FILE,
|
||||||
URL url = ContextAuthorization.class.getClassLoader().getResource(voFileName);
|
DEFAULT_VO_FILENAME);
|
||||||
|
URL url = ContextAuthorization.class.getClassLoader().getResource(voFileName);
|
||||||
File voFile = new File(url.toURI());
|
File voFile = new File(url.toURI());
|
||||||
logger.trace("VO file is {}", voFile);
|
logger.trace("VO file is {}", voFile);
|
||||||
if(!voFile.exists()) {
|
if(!voFile.exists()) {
|
||||||
throw new Exception("No VO file found. Unable to continue without it");
|
throw new Exception("No VO file found. Unable to continue without it");
|
||||||
}
|
}
|
||||||
return voFile;
|
return voFile;
|
||||||
}catch (Exception e) {
|
} catch(Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,23 +79,25 @@ public class ContextAuthorization {
|
||||||
|
|
||||||
Properties properties = AccountingDataHarvesterPlugin.getProperties().get();
|
Properties properties = AccountingDataHarvesterPlugin.getProperties().get();
|
||||||
|
|
||||||
LinkedHashMap<String, ScopeBean> map = ScopeManager.readScopes(getVOFile().getAbsolutePath());
|
LinkedHashMap<String,ScopeBean> map = ScopeManager.readScopes(getVOFile().getAbsolutePath());
|
||||||
for(String scope : map.keySet()) {
|
for(String scope : map.keySet()) {
|
||||||
try {
|
try {
|
||||||
String context = map.get(scope).toString();
|
String context = map.get(scope).toString();
|
||||||
System.out.println("Going to generate Token for Context " + context);
|
System.out.println("Going to generate Token for Context " + context);
|
||||||
logger.info("Going to generate Token for Context {}", context);
|
logger.info("Going to generate Token for Context {}", context);
|
||||||
UserInfo userInfo = new UserInfo(properties.getProperty(USERNAME, DEFAULT_USERNAME), new ArrayList<>());
|
UserInfo userInfo = new UserInfo(properties.getProperty(USERNAME, DEFAULT_USERNAME),
|
||||||
|
new ArrayList<>());
|
||||||
String userToken = authorizationService().generateUserToken(userInfo, context);
|
String userToken = authorizationService().generateUserToken(userInfo, context);
|
||||||
SecurityTokenProvider.instance.set(userToken);
|
SecurityTokenProvider.instance.set(userToken);
|
||||||
String generatedToken = authorizationService().generateExternalServiceToken(properties.getProperty(SERVICE_NAME, DEFAULT_SERVICE_NAME));
|
String generatedToken = authorizationService()
|
||||||
|
.generateExternalServiceToken(properties.getProperty(SERVICE_NAME, DEFAULT_SERVICE_NAME));
|
||||||
|
|
||||||
logger.trace("Token for Context {} is {}", context, generatedToken);
|
logger.trace("Token for Context {} is {}", context, generatedToken);
|
||||||
|
|
||||||
contextToToken.put(context, generatedToken);
|
contextToToken.put(context, generatedToken);
|
||||||
tokenToContext.put(generatedToken, context);
|
tokenToContext.put(generatedToken, context);
|
||||||
|
|
||||||
}catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("Error while elaborating {}", scope, e);
|
logger.error("Error while elaborating {}", scope, e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -102,7 +105,7 @@ public class ContextAuthorization {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch(Exception ex) {
|
||||||
throw ex;
|
throw ex;
|
||||||
} finally {
|
} finally {
|
||||||
SecurityTokenProvider.instance.set(initialToken);
|
SecurityTokenProvider.instance.set(initialToken);
|
||||||
|
@ -117,10 +120,8 @@ public class ContextAuthorization {
|
||||||
return tokenToContext.get(token);
|
return tokenToContext.get(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<String> getContexts(){
|
public SortedSet<String> getContexts() {
|
||||||
return new TreeSet<String>(contextToToken.keySet());
|
return new TreeSet<String>(contextToToken.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,17 @@ import java.util.TimeZone;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
|
private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
|
||||||
|
|
||||||
public static TimeZone UTC_TIMEZONE = TimeZone.getTimeZone("UTC");
|
public static TimeZone UTC_TIMEZONE = TimeZone.getTimeZone("UTC");
|
||||||
public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS Z";
|
public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS Z";
|
||||||
public static final DateFormat DEFAULT_DATE_FORMAT;
|
public static final DateFormat DEFAULT_DATE_FORMAT;
|
||||||
|
|
||||||
public static final String LAUNCH_DATE_FORMAT_PATTERN = "yyyy-MM-dd";
|
public static final String LAUNCH_DATE_FORMAT_PATTERN = "yyyy-MM-dd";
|
||||||
public static final DateFormat LAUNCH_DATE_FORMAT;
|
public static final DateFormat LAUNCH_DATE_FORMAT;
|
||||||
|
|
||||||
|
@ -30,13 +33,13 @@ public class DateUtils {
|
||||||
UTC_DATE_FORMAT = getUTCDateFormat(UTC_DATE_FORMAT_PATTERN);
|
UTC_DATE_FORMAT = getUTCDateFormat(UTC_DATE_FORMAT_PATTERN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateFormat getUTCDateFormat(String pattern){
|
public static DateFormat getUTCDateFormat(String pattern) {
|
||||||
DateFormat dateFormat = new SimpleDateFormat(pattern);
|
DateFormat dateFormat = new SimpleDateFormat(pattern);
|
||||||
dateFormat.setTimeZone(UTC_TIMEZONE);
|
dateFormat.setTimeZone(UTC_TIMEZONE);
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Calendar getUTCCalendarInstance(){
|
public static Calendar getUTCCalendarInstance() {
|
||||||
return Calendar.getInstance(UTC_TIMEZONE);
|
return Calendar.getInstance(UTC_TIMEZONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +50,12 @@ public class DateUtils {
|
||||||
case YEARLY:
|
case YEARLY:
|
||||||
now.add(Calendar.YEAR, -1);
|
now.add(Calendar.YEAR, -1);
|
||||||
now.set(Calendar.MONTH, Calendar.JANUARY);
|
now.set(Calendar.MONTH, Calendar.JANUARY);
|
||||||
now.set(Calendar.DAY_OF_MONTH,1);
|
now.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MONTHLY:
|
case MONTHLY:
|
||||||
now.add(Calendar.MONTH, -1);
|
now.add(Calendar.MONTH, -1);
|
||||||
now.set(Calendar.DAY_OF_MONTH,1);
|
now.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DAILY:
|
case DAILY:
|
||||||
|
@ -72,8 +75,7 @@ public class DateUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Calendar getStartCalendar(int year, int month, int day) {
|
||||||
public static Calendar getStartCalendar(int year, int month, int day){
|
|
||||||
Calendar aggregationStartCalendar = getUTCCalendarInstance();
|
Calendar aggregationStartCalendar = getUTCCalendarInstance();
|
||||||
aggregationStartCalendar.set(Calendar.YEAR, year);
|
aggregationStartCalendar.set(Calendar.YEAR, year);
|
||||||
aggregationStartCalendar.set(Calendar.MONTH, month);
|
aggregationStartCalendar.set(Calendar.MONTH, month);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alessandro Pieve (ISTI - CNR)
|
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public enum MeasureType {
|
public enum MeasureType {
|
||||||
|
|
|
@ -19,6 +19,10 @@ import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(Utils.class);
|
private static Logger logger = LoggerFactory.getLogger(Utils.class);
|
||||||
|
|
|
@ -6,12 +6,12 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.dataharvest.utils.DateUtils;
|
import org.gcube.dataharvest.utils.DateUtils;
|
||||||
import org.gcube.dataharvest.utils.MeasureType;
|
import org.gcube.dataharvest.utils.MeasureType;
|
||||||
import org.gcube.dataharvest.utils.ScopedTest;
|
import org.gcube.dataharvest.utils.ContextTest;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class AccountingDataHarvesterPluginTest extends ScopedTest {
|
public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterPluginTest.class);
|
private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterPluginTest.class);
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,20 @@ import org.gcube.dataharvest.harvester.sobigdata.ResourceCatalogueHarvester;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eric Perrone (ISTI - CNR)
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
public class Harvester {
|
public class Harvester {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(Harvester.class);
|
private static Logger logger = LoggerFactory.getLogger(Harvester.class);
|
||||||
|
|
||||||
public static final String PARAMETER_FROM = "from";
|
public static final String PARAMETER_FROM = "from";
|
||||||
public static final String PARAMETER_TO = "to";
|
public static final String PARAMETER_TO = "to";
|
||||||
public static final String TEST = "test";
|
public static final String TEST = "test";
|
||||||
private boolean testMode = false;
|
private boolean testMode = false;
|
||||||
private Date dateFrom, dateTo;
|
private Date dateFrom, dateTo;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Harvester harvester = new Harvester();
|
Harvester harvester = new Harvester();
|
||||||
try {
|
try {
|
||||||
|
@ -37,115 +43,115 @@ public class Harvester {
|
||||||
//ArrayList<Integer> list = harvester.getSubTree(17);
|
//ArrayList<Integer> list = harvester.getSubTree(17);
|
||||||
//harvester.createSocialReports(list);
|
//harvester.createSocialReports(list);
|
||||||
System.out.println("End.");
|
System.out.println("End.");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Harvester() {
|
public Harvester() {
|
||||||
testMode = false;
|
testMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDateFrom(Date dateFrom) {
|
public void setDateFrom(Date dateFrom) {
|
||||||
this.dateFrom = dateFrom;
|
this.dateFrom = dateFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDateTo(Date dateTo) {
|
public void setDateTo(Date dateTo) {
|
||||||
this.dateTo = dateTo;
|
this.dateTo = dateTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTestMode(boolean testMode) {
|
public void setTestMode(boolean testMode) {
|
||||||
this.testMode = testMode;
|
this.testMode = testMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDateFrom() {
|
public Date getDateFrom() {
|
||||||
return dateFrom;
|
return dateFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDateTo() {
|
public Date getDateTo() {
|
||||||
return dateTo;
|
return dateTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runOne(BasicHarvester harvester) {
|
public void runOne(BasicHarvester harvester) {
|
||||||
try {
|
try {
|
||||||
List<HarvestedData> data = harvester.getData();
|
List<HarvestedData> data = harvester.getData();
|
||||||
if (data != null) {
|
if(data != null) {
|
||||||
insertMonthlyData((Date) dateFrom, (Date) dateTo, data);
|
insertMonthlyData((Date) dateFrom, (Date) dateTo, data);
|
||||||
}
|
}
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error(x.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runAll() {
|
public void runAll() {
|
||||||
try {
|
try {
|
||||||
// collecting info on VRE users
|
// collecting info on VRE users
|
||||||
VreUsersHarvester vreUsersHarvester = new VreUsersHarvester(dateFrom, dateTo);
|
VreUsersHarvester vreUsersHarvester = new VreUsersHarvester(dateFrom, dateTo);
|
||||||
List<HarvestedData> users = vreUsersHarvester.getData();
|
List<HarvestedData> users = vreUsersHarvester.getData();
|
||||||
insertMonthlyData((Date) dateFrom, (Date) dateTo, users);
|
insertMonthlyData((Date) dateFrom, (Date) dateTo, users);
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error(x.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// collecting info on Res. Catalogue (Dataset, Application,
|
// collecting info on Res. Catalogue (Dataset, Application,
|
||||||
// Deliverables, Methods)
|
// Deliverables, Methods)
|
||||||
ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(dateFrom, dateTo);
|
ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(dateFrom, dateTo);
|
||||||
List<HarvestedData> res = resourceCatalogueHarvester.getData();
|
List<HarvestedData> res = resourceCatalogueHarvester.getData();
|
||||||
insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error(x.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// collecting info on Data/Method download
|
// collecting info on Data/Method download
|
||||||
DataMethodDownloadHarvester dataMethodDownloadHarvester = new DataMethodDownloadHarvester(dateFrom, dateTo);
|
DataMethodDownloadHarvester dataMethodDownloadHarvester = new DataMethodDownloadHarvester(dateFrom, dateTo);
|
||||||
List<HarvestedData> res = dataMethodDownloadHarvester.getData();
|
List<HarvestedData> res = dataMethodDownloadHarvester.getData();
|
||||||
insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error(x.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// collecting info on social (posts, replies and likes)
|
// collecting info on social (posts, replies and likes)
|
||||||
SocialHarvester socialHarvester = new SocialHarvester(dateFrom, dateTo);
|
SocialHarvester socialHarvester = new SocialHarvester(dateFrom, dateTo);
|
||||||
List<HarvestedData> res = socialHarvester.getData();
|
List<HarvestedData> res = socialHarvester.getData();
|
||||||
insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error(x.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// collecting info on method invocation
|
// collecting info on method invocation
|
||||||
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(dateFrom, dateTo);
|
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(dateFrom, dateTo);
|
||||||
List<HarvestedData> res = methodInvocationHarvester.getData();
|
List<HarvestedData> res = methodInvocationHarvester.getData();
|
||||||
logger.debug("{}", res);
|
logger.debug("{}", res);
|
||||||
// insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
// insertMonthlyData((Date) dateFrom, (Date) dateTo, res);
|
||||||
} catch (Exception x) {
|
} catch(Exception x) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error(x.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertMonthlyData(Date from, Date to, List<HarvestedData> data) {
|
private void insertMonthlyData(Date from, Date to, List<HarvestedData> data) {
|
||||||
Dao dao = null;
|
Dao dao = null;
|
||||||
try {
|
try {
|
||||||
dao = dbConnect();
|
dao = dbConnect();
|
||||||
dao.insertMonthlyMeasure(data, from, to, false);
|
dao.insertMonthlyMeasure(data, from, to, false);
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (dao != null) {
|
if(dao != null) {
|
||||||
try {
|
try {
|
||||||
dao.disconnect();
|
dao.disconnect();
|
||||||
} catch (DaoException e) {
|
} catch(DaoException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dao dbConnect() throws DaoException {
|
private Dao dbConnect() throws DaoException {
|
||||||
DatabaseParameterRetriever dde = new DatabaseParameterRetriever();
|
DatabaseParameterRetriever dde = new DatabaseParameterRetriever();
|
||||||
//dde.setTestMode(testMode);
|
//dde.setTestMode(testMode);
|
||||||
|
@ -155,70 +161,70 @@ public class Harvester {
|
||||||
dao.connect(dcd.getURI(), dcd.getUser(), dcd.getPassword());
|
dao.connect(dcd.getURI(), dcd.getUser(), dcd.getPassword());
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processParameterArray(String[] args) throws Exception {
|
private void processParameterArray(String[] args) throws Exception {
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
for (int i = 0; i < args.length; i++) {
|
for(int i = 0; i < args.length; i++) {
|
||||||
if (args[i].startsWith(PARAMETER_FROM)) {
|
if(args[i].startsWith(PARAMETER_FROM)) {
|
||||||
String from = getArgValue(args[i]);
|
String from = getArgValue(args[i]);
|
||||||
dateFrom = formatter.parse(from);
|
dateFrom = formatter.parse(from);
|
||||||
System.out.println(dateFrom.toString());
|
System.out.println(dateFrom.toString());
|
||||||
} else if (args[i].startsWith(PARAMETER_TO)) {
|
} else if(args[i].startsWith(PARAMETER_TO)) {
|
||||||
String to = getArgValue(args[i]);
|
String to = getArgValue(args[i]);
|
||||||
dateTo = formatter.parse(to);
|
dateTo = formatter.parse(to);
|
||||||
System.out.println(dateTo.toString());
|
System.out.println(dateTo.toString());
|
||||||
} else if (args[i].toLowerCase().startsWith(TEST)) {
|
} else if(args[i].toLowerCase().startsWith(TEST)) {
|
||||||
testMode = true;
|
testMode = true;
|
||||||
System.out.println("Test: " + testMode);
|
System.out.println("Test: " + testMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getArgValue(String arg) throws Exception {
|
private String getArgValue(String arg) throws Exception {
|
||||||
String[] tokens = arg.split("=");
|
String[] tokens = arg.split("=");
|
||||||
if (tokens.length != 2)
|
if(tokens.length != 2)
|
||||||
throw new Exception("Argument must be in the format 'name=value'.");
|
throw new Exception("Argument must be in the format 'name=value'.");
|
||||||
return tokens[1].trim();
|
return tokens[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArrayList<Integer> getSubTree(int root) {
|
protected ArrayList<Integer> getSubTree(int root) {
|
||||||
Dao dao = null;
|
Dao dao = null;
|
||||||
try {
|
try {
|
||||||
dao = dbConnect();
|
dao = dbConnect();
|
||||||
ArrayList<Integer> subTree = dao.getSubTree(root);
|
ArrayList<Integer> subTree = dao.getSubTree(root);
|
||||||
return subTree;
|
return subTree;
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
if (dao != null) {
|
if(dao != null) {
|
||||||
try {
|
try {
|
||||||
dao.disconnect();
|
dao.disconnect();
|
||||||
} catch (DaoException e) {
|
} catch(DaoException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createSocialReports(ArrayList<Integer> ids) {
|
protected void createSocialReports(ArrayList<Integer> ids) {
|
||||||
Dao dao = null;
|
Dao dao = null;
|
||||||
try {
|
try {
|
||||||
dao = dbConnect();
|
dao = dbConnect();
|
||||||
for (Integer contextId : ids)
|
for(Integer contextId : ids)
|
||||||
dao.createSocialReport(contextId, 2018);
|
dao.createSocialReport(contextId, 2018);
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (dao != null) {
|
if(dao != null) {
|
||||||
try {
|
try {
|
||||||
dao.disconnect();
|
dao.disconnect();
|
||||||
} catch (DaoException e) {
|
} catch(DaoException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ContextAuthorizationTest extends ScopedTest {
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public class ContextAuthorizationTest extends ContextTest {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ContextAuthorizationTest.class);
|
private static Logger logger = LoggerFactory.getLogger(ContextAuthorizationTest.class);
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,6 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.gcube.common.authorization.client.Constants;
|
|
||||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
|
||||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -19,13 +16,12 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ScopedTest {
|
public class ContextTest {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ScopedTest.class);
|
private static final Logger logger = LoggerFactory.getLogger(ContextTest.class);
|
||||||
|
|
||||||
protected static final String PROPERTIES_FILENAME = "token.properties";
|
protected static final String PROPERTIES_FILENAME = "token.properties";
|
||||||
|
|
||||||
private static final String GCUBE_DEVNEXT_VARNAME = "GCUBE_DEVNEXT";
|
private static final String GCUBE_DEVNEXT_VARNAME = "GCUBE_DEVNEXT";
|
||||||
public static final String GCUBE_DEVNEXT;
|
public static final String GCUBE_DEVNEXT;
|
||||||
|
@ -51,16 +47,19 @@ public class ScopedTest {
|
||||||
public static final String TAGME;
|
public static final String TAGME;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
logger.trace("Retrieving Tokens from {}", PROPERTIES_FILENAME);
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
InputStream input = ScopedTest.class.getClassLoader().getResourceAsStream(PROPERTIES_FILENAME);
|
InputStream input = ContextTest.class.getClassLoader().getResourceAsStream(PROPERTIES_FILENAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// load the properties file
|
// load the properties file
|
||||||
properties.load(input);
|
properties.load(input);
|
||||||
} catch (IOException e) {
|
} catch(IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
GCUBE = properties.getProperty(GCUBE_VARNAME);
|
GCUBE = properties.getProperty(GCUBE_VARNAME);
|
||||||
|
|
||||||
GCUBE_DEVNEXT = properties.getProperty(GCUBE_DEVNEXT_VARNAME);
|
GCUBE_DEVNEXT = properties.getProperty(GCUBE_DEVNEXT_VARNAME);
|
||||||
|
@ -77,12 +76,12 @@ public class ScopedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception{
|
public static void beforeClass() throws Exception {
|
||||||
Utils.setContext(DEFAULT_TEST_SCOPE);
|
Utils.setContext(DEFAULT_TEST_SCOPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws Exception{
|
public static void afterClass() throws Exception {
|
||||||
SecurityTokenProvider.instance.reset();
|
SecurityTokenProvider.instance.reset();
|
||||||
ScopeProvider.instance.reset();
|
ScopeProvider.instance.reset();
|
||||||
}
|
}
|
|
@ -1,393 +0,0 @@
|
||||||
package org.gcube.dataharvest.utils;
|
|
||||||
|
|
||||||
public class DataFiller {
|
|
||||||
|
|
||||||
protected static String[] data10 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/AlieiaVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/AnalyticsLab","83",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/Aquabiotech","8",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureTrainingLab","71",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ARDAG_Aquaculture","5",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BOBLME_HilsaAWG","3",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab","374",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiOnym","112",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueCommons","37",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon","44",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueUptake","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB","19",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject","100",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BlueBRIDGEReview","15",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/DRuMFISH","27",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/EllinikaPsariaVRE","11",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ForkysVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","0",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GALAXIDI","6",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF","13",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF_Admin","28",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E","37",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_AbundanceEstimationFromAcoustic","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DALSA","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DASC","17",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_FIACO","28",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_IntroStockAssessment","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE","30",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSE","27",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSY","84",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_StockAssessmentAdvanced","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM","29",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/iLKNAK_Aquaculture","5",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/InfraTraining","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/IOTC_SS3","31",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/iSearch","56",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/MARKELLOS_Aquaculture","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps","30",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab","99",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RStudioLab","68",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining","152",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/SIASPA","19",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StockAssessment","62",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis","26",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/STRATOS_AQUACULTURES","6",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab","182",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","38",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/VME-DB","18",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/WECAFC-FIRMS","20"
|
|
||||||
};
|
|
||||||
|
|
||||||
protected static String[] data11 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/AlieiaVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/AnalyticsLab","93",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/Aquabiotech","8",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureTrainingLab","136",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ARDAG_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BOBLME_HilsaAWG","3",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab","387",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiOnym","116",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueCommons","35",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon","45",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueUptake","33",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB","22",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject","98",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BlueBRIDGEReview","15",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/DRuMFISH","27",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/EllinikaPsariaVRE","11",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ForkysVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","0",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GALAXIDI","4",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF","13",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF_Admin","28",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E","37",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_AbundanceEstimationFromAcoustic","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DALSA","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DASC","17",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_FIACO","28",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_IntroStockAssessment","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE","31",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSE","27",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSY","84",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_StockAssessmentAdvanced","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM","29",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/iLKNAK_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/InfraTraining","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/IOTC_SS3","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/iSearch","58",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/MARKELLOS_Aquaculture","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps","56",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab","110",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RStudioLab","73",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining","161",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/SIASPA","22",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StockAssessment","63",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis","26",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/STRATOS_AQUACULTURES","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab","186",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","40",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/VME-DB","18",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/WECAFC-FIRMS","20"
|
|
||||||
};
|
|
||||||
|
|
||||||
protected static String[] data12 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/AlieiaVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/AnalyticsLab","99",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/Aquabiotech","8",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration","28",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureTrainingLab","273",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ARDAG_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BOBLME_HilsaAWG","3",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab","392",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiOnym","118",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueCommons","35",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon","45",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueUptake","33",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB","22",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject","98",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BlueBRIDGEReview","15",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/DRuMFISH","27",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/EllinikaPsariaVRE","11",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ForkysVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","0",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GALAXIDI","4",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF","13",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF_Admin","30",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E","37",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_AbundanceEstimationFromAcoustic","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DALSA","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DASC","17",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_FIACO","28",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_IntroStockAssessment","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE","31",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSE","27",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSY","84",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_StockAssessmentAdvanced","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM","29",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/iLKNAK_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/InfraTraining","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/IOTC_SS3","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/iSearch","59",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/MARKELLOS_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps","57",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab","114",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RStudioLab","74",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining","164",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/SIASPA","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StockAssessment","63",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis","26",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/STRATOS_AQUACULTURES","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab","188",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","40",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/VME-DB","18",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/WECAFC-FIRMS","20"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String[] data01 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/AlieiaVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/AnalyticsLab","103",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/Aquabiotech","8",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration","35",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureTrainingLab","278",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ARDAG_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BOBLME_HilsaAWG","3",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab","400",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiOnym","121",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueCommons","35",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon","45",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueUptake","33",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB","22",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject","99",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BlueBRIDGEReview","15",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/DRuMFISH","27",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/EllinikaPsariaVRE","11",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ForkysVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","5",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GALAXIDI","4",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF","13",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF_Admin","31",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E","38",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_AbundanceEstimationFromAcoustic","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DALSA","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DASC","17",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_FIACO","28",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_IntroStockAssessment","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE","31",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSE","27",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSY","84",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_StockAssessmentAdvanced","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM","29",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/iLKNAK_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/InfraTraining","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/IOTC_SS3","37",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/iSearch","59",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/MARKELLOS_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps","68",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab","123",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RStudioLab","80",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining","167",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/SIASPA","31",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StockAssessment","63",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis","26",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/STRATOS_AQUACULTURES","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab","191",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","44",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/VME-DB","18",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/WECAFC-FIRMS","20",
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String[] data02 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/AlieiaVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/AnalyticsLab","106",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/Aquabiotech","8",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration","35",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureTrainingLab","279",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ARDAG_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BOBLME_HilsaAWG","3",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab","402",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiOnym","124",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueCommons","35",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon","45",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueUptake","33",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject","99",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BlueBRIDGEReview","15",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/DRuMFISH","27",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/EllinikaPsariaVRE","11",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ForkysVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","5",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GALAXIDI","4",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF","13",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF_Admin","32",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E","38",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_AbundanceEstimationFromAcoustic","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DALSA","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DASC","17",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_FIACO","28",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_IntroStockAssessment","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE","31",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSE","27",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSY","84",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_StockAssessmentAdvanced","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM","29",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/iLKNAK_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/InfraTraining","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/IOTC_SS3","38",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/iSearch","60",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/MARKELLOS_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps","71",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab","127",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RStudioLab","81",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining","171",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/SIASPA","32",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StockAssessment","63",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis","26",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/STRATOS_AQUACULTURES","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab","193",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","49",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/VME-DB","18",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/WECAFC-FIRMS","24"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String[] data03 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/AlieiaVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/AnalyticsLab","107",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/Aquabiotech","8",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration","35",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/AquacultureTrainingLab","278",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ARDAG_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BOBLME_HilsaAWG","3",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab","403",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BiOnym","124",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueCommons","35",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon","45",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueUptake","33",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject","99",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/BlueBRIDGEReview","15",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/DRuMFISH","27",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/EllinikaPsariaVRE","11",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/ForkysVRE","12",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","5",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GALAXIDI","4",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF","13",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/GRSF_Admin","32",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E","38",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_AbundanceEstimationFromAcoustic","36",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DALSA","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_DASC","17",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_FIACO","28",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_IntroStockAssessment","34",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE","32",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSE","29",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/ICES_MSY","84",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_StockAssessmentAdvanced","26",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM","29",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/iLKNAK_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/InfraTraining","10",
|
|
||||||
"/d4science.research-infrastructures.eu/D4Research/IOTC_SS3","38",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/iSearch","61",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/MARKELLOS_Aquaculture","6",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture","27",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps","71",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab","127",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/RStudioLab","81",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining","171",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/SIASPA","32",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StockAssessment","63",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis","26",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/STRATOS_AQUACULTURES","5",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab","191",
|
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas","49",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/VME-DB","18",
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/WECAFC-FIRMS","24"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
public static String[] data04 = {
|
|
||||||
"/d4science.research-infrastructures.eu/FARM/CWP_Secretariat", "8"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String[] vals = {
|
|
||||||
"2017", "1", "0", "2", "80",
|
|
||||||
"2017", "2", "0", "2", "80",
|
|
||||||
"2017", "3", "0", "2", "80",
|
|
||||||
"2017", "4", "0", "2", "80",
|
|
||||||
"2017", "5", "0", "2", "80",
|
|
||||||
"2017", "6", "0", "2", "80",
|
|
||||||
"2017", "7", "4", "2", "80",
|
|
||||||
"2017", "8", "4", "2", "80",
|
|
||||||
"2017", "9", "4", "2", "80",
|
|
||||||
"2017", "10", "4", "2", "80",
|
|
||||||
"2017", "11", "4", "2", "80",
|
|
||||||
"2017", "12", "4", "2", "80",
|
|
||||||
"2018", "1", "4", "2", "80",
|
|
||||||
"2018", "2", "4", "2", "80",
|
|
||||||
"2018", "3", "4", "2", "80"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// for(int i=0; i<data03.length; i+=2) {
|
|
||||||
// String insert = "insert into monthly_measure (year, month, measure, measure_type_id, context_id, day) " +
|
|
||||||
// "values(2018,3," + data03[i+1] + ",2,(select id from context where dname='" + data03[i] + "'),'2018-03-01');";
|
|
||||||
// System.out.println(insert);
|
|
||||||
// }
|
|
||||||
insertMeasures();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void insertMeasures() {
|
|
||||||
String im = "insert into monthly_measure (year, month, measure, measure_type_id, context_id, day) values ";
|
|
||||||
String val = "(%Y, %M, %m, %T, %C, '%D')";
|
|
||||||
|
|
||||||
for(int i=0; i<vals.length; i+=5) {
|
|
||||||
String item = new String(val);
|
|
||||||
item = item.replace("%Y", vals[i]);
|
|
||||||
item = item.replace("%M", vals[i+1]);
|
|
||||||
item = item.replace("%m", vals[i+2]);
|
|
||||||
item = item.replace("%T", vals[i+3]);
|
|
||||||
item = item.replace("%C", vals[i+4]);
|
|
||||||
item = item.replace("%D", getDay(vals[i], vals[i+1]));
|
|
||||||
im += item + ",";
|
|
||||||
}
|
|
||||||
im = im.substring(0, im.length()-1);
|
|
||||||
System.out.println(im);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getDay(String year, String month) {
|
|
||||||
String day = year + "-";
|
|
||||||
if(month.length() < 2)
|
|
||||||
day += "0" + month + "-01";
|
|
||||||
else day += month + "-01";
|
|
||||||
|
|
||||||
return day;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue