use of org.ovirt.engine.core.notifier.NotificationServiceException in project ovirt-engine by oVirt.
the class EventsManager method markOldEventsAsProcessed.
public void markOldEventsAsProcessed(int daysToSendOnStartup) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -daysToSendOnStartup);
Timestamp ts = new Timestamp(calendar.getTimeInMillis());
int updatedRecords;
try (Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("UPDATE audit_log " + "SET processed = 'true' " + "WHERE processed = 'false' AND log_time < ? ;")) {
statement.setTimestamp(1, ts);
updatedRecords = statement.executeUpdate();
if (updatedRecords > 0) {
log.debug("{} old records were marked as processed in the \"audit_log\" table.", updatedRecords);
}
} catch (SQLException e) {
throw new NotificationServiceException("Failed mark old events as processed.", e);
}
}
use of org.ovirt.engine.core.notifier.NotificationServiceException in project ovirt-engine by oVirt.
the class Snmp method createSnmp3.
private org.snmp4j.Snmp createSnmp3(Profile profile) {
try {
TransportMapping<?> transport = new DefaultUdpTransportMapping();
org.snmp4j.Snmp snmp = new org.snmp4j.Snmp(transport);
SecurityProtocols securityProtocols = SecurityProtocols.getInstance();
securityProtocols.addDefaultProtocols();
securityProtocols.addAuthenticationProtocol(new AuthMD5());
securityProtocols.addAuthenticationProtocol(new AuthSHA());
securityProtocols.addPrivacyProtocol(new PrivAES128());
securityProtocols.addPrivacyProtocol(new PrivAES192());
securityProtocols.addPrivacyProtocol(new PrivAES256());
USM usm = new USM(securityProtocols, profile.engineId, 0);
((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)).setLocalEngineID(profile.engineId.getValue());
((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)).getSecurityModels().addSecurityModel(usm);
SecurityModels.getInstance().addSecurityModel(usm);
transport.listen();
snmp.getUSM().addUser(profile.username, getUsmUser(profile));
return snmp;
} catch (IOException e) {
throw new NotificationServiceException("error creating version 3 snmp " + getClass().getName());
}
}
Aggregations