use of org.eclipse.sw360.datahandler.thrift.schedule.ScheduleService in project sw360portal by sw360.
the class ScheduleAdminPortlet method scheduleCveSearch.
@UsedAsLiferayAction
public void scheduleCveSearch(ActionRequest request, ActionResponse response) throws PortletException, IOException {
try {
User user = UserCacheHolder.getUserFromRequest(request);
RequestSummary requestSummary = new ThriftClients().makeScheduleClient().scheduleService(ThriftClients.CVESEARCH_SERVICE);
setSessionMessage(request, requestSummary.getRequestStatus(), "Task", "schedule");
} catch (TException e) {
log.error(e);
}
}
use of org.eclipse.sw360.datahandler.thrift.schedule.ScheduleService in project sw360portal by sw360.
the class ScheduleHandler method scheduleService.
@Override
public RequestSummary scheduleService(String serviceName) throws TException {
if (ScheduleConstants.invalidConfiguredServices.contains(serviceName)) {
log.info("Could not schedule " + serviceName + " because of invalid configuration.");
return new RequestSummary(RequestStatus.FAILURE);
}
Scheduler.cancelSyncJobOfService(serviceName);
boolean successSync = false;
switch(serviceName) {
case ThriftClients.CVESEARCH_SERVICE:
successSync = wrapSupplierException(() -> thriftClients.makeCvesearchClient().update(), serviceName);
break;
default:
log.error("Could not schedule service: " + serviceName + ". Reason: service is not registered in ThriftClients.");
}
if (successSync) {
RequestSummary summary = new RequestSummary(RequestStatus.SUCCESS);
summary.setMessage(SW360Utils.getDateTimeString(Scheduler.getNextSync()));
return summary;
} else {
return new RequestSummary(RequestStatus.FAILURE);
}
}
Aggregations