use of com.evolveum.midpoint.audit.api.AuditServiceFactory in project midpoint by Evolveum.
the class AuditFactory method init.
public void init() {
Configuration config = getCurrentConfiguration();
//TODO FIX CONFIGURATION, CLEANUP REALLY NEEDED
List<SubnodeConfiguration> auditServices = ((XMLConfiguration) ((CompositeConfiguration) ((SubsetConfiguration) config).getParent()).getConfiguration(0)).configurationsAt(AUDIT_CONFIGURATION + "." + CONF_AUDIT_SERVICE);
for (SubnodeConfiguration serviceConfig : auditServices) {
try {
String factoryClass = getFactoryClassName(serviceConfig);
Class<AuditServiceFactory> clazz = (Class<AuditServiceFactory>) Class.forName(factoryClass);
AuditServiceFactory factory = getFactory(clazz);
factory.init(serviceConfig);
serviceFactories.add(factory);
} catch (Exception ex) {
LoggingUtils.logException(LOGGER, "AuditServiceFactory implementation class {} failed to " + "initialize.", ex, getFactoryClassName(serviceConfig));
throw new SystemException("AuditServiceFactory implementation class " + getFactoryClassName(serviceConfig) + " failed to initialize: " + ex.getMessage(), ex);
}
}
}
use of com.evolveum.midpoint.audit.api.AuditServiceFactory in project midpoint by Evolveum.
the class AuditFactory method getAuditService.
public AuditService getAuditService() {
if (auditService == null) {
AuditServiceProxy proxy = new AuditServiceProxy();
for (AuditServiceFactory factory : serviceFactories) {
try {
AuditService service = factory.getAuditService();
//todo check this autowiring (check logs) how it's done
applicationContext.getAutowireCapableBeanFactory().autowireBean(service);
proxy.registerService(service);
} catch (Exception ex) {
LoggingUtils.logException(LOGGER, "Couldn't get audit service from factory '{}'", ex, factory);
throw new SystemException(ex.getMessage(), ex);
}
}
auditService = proxy;
}
return auditService;
}
Aggregations