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@167597 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9db4794c16
commit
2cb0d8b15f
|
@ -136,49 +136,52 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
||||||
Utils.setContext(contextAuthorization.getTokenForContext(context));
|
Utils.setContext(contextAuthorization.getTokenForContext(context));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// collecting info on VRE users
|
// Collecting info on social (posts, replies and likes)
|
||||||
VreUsersHarvester vreUsersHarvester = new VreUsersHarvester(start, end);
|
|
||||||
List<HarvestedData> harvested = vreUsersHarvester.getData();
|
|
||||||
data.addAll(harvested);
|
|
||||||
} catch(Exception x) {
|
|
||||||
logger.error(x.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
// collecting info on Res. Catalogue (Dataset, Application, Deliverables, Methods)
|
|
||||||
ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end);
|
|
||||||
List<HarvestedData> harvested = resourceCatalogueHarvester.getData();
|
|
||||||
data.addAll(harvested);
|
|
||||||
} catch(Exception x) {
|
|
||||||
logger.error(x.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// collecting info on Data/Method download
|
|
||||||
DataMethodDownloadHarvester dataMethodDownloadHarvester = new DataMethodDownloadHarvester(start, end);
|
|
||||||
List<HarvestedData> harvested = dataMethodDownloadHarvester.getData();
|
|
||||||
data.addAll(harvested);
|
|
||||||
} catch(Exception x) {
|
|
||||||
logger.error(x.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// collecting info on social (posts, replies and likes)
|
|
||||||
SocialHarvester socialHarvester = new SocialHarvester(start, end);
|
SocialHarvester socialHarvester = new SocialHarvester(start, end);
|
||||||
List<HarvestedData> harvested = socialHarvester.getData();
|
List<HarvestedData> harvested = socialHarvester.getData();
|
||||||
data.addAll(harvested);
|
data.addAll(harvested);
|
||||||
} catch(Exception x) {
|
} catch(Exception e) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error("Error harvesting Scoial Interactions for {}", context, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Collecting info on VRE users
|
||||||
|
VreUsersHarvester vreUsersHarvester = new VreUsersHarvester(start, end);
|
||||||
|
List<HarvestedData> harvested = vreUsersHarvester.getData();
|
||||||
|
data.addAll(harvested);
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.error("Error harvesting Context Users for {}", context, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Collecting info on Res. Catalogue (Dataset, Application, Deliverables, Methods)
|
||||||
|
ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end);
|
||||||
|
List<HarvestedData> harvested = resourceCatalogueHarvester.getData();
|
||||||
|
data.addAll(harvested);
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.error("Error harvesting Resource Catalogue Information for {}", context, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// collecting info on method invocation
|
// Collecting info on Data/Method download
|
||||||
|
DataMethodDownloadHarvester dataMethodDownloadHarvester = new DataMethodDownloadHarvester(start, end);
|
||||||
|
List<HarvestedData> harvested = dataMethodDownloadHarvester.getData();
|
||||||
|
data.addAll(harvested);
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.error("Error harvesting Data Method Download for {}", context, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Collecting info on method invocation
|
||||||
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
||||||
List<HarvestedData> harvested = methodInvocationHarvester.getData();
|
List<HarvestedData> harvested = methodInvocationHarvester.getData();
|
||||||
data.addAll(harvested);
|
data.addAll(harvested);
|
||||||
} catch(Exception x) {
|
} catch(Exception e) {
|
||||||
logger.error(x.getLocalizedMessage());
|
logger.error("Error harvesting Method Invocations for {}", context, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ public class VreUsersHarvester extends BasicHarvester {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HarvestedData> getData() throws Exception {
|
public List<HarvestedData> getData() throws Exception {
|
||||||
String context = Utils.getCurrentContext();
|
|
||||||
try {
|
try {
|
||||||
|
String context = Utils.getCurrentContext();
|
||||||
int measure = get();
|
int measure = get();
|
||||||
HarvestedData harvest = new HarvestedData(HarvestedData.USERS, context, measure);
|
HarvestedData harvest = new HarvestedData(HarvestedData.USERS, context, measure);
|
||||||
logger.debug(harvest.toString());
|
logger.debug(harvest.toString());
|
||||||
|
@ -37,7 +37,6 @@ public class VreUsersHarvester extends BasicHarvester {
|
||||||
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);
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,6 @@ public class DataMethodDownloadHarvester extends BasicHarvester {
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("Error Harvesting Data Methods Download for context {}", context, e);
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue