docs: @SuppressWarnings({ "unchecked", "rawtypes" })
      protected AbstractAuditLogger getAuditLoggerInstance(RuntimeEngine engine) {
      	DeploymentDescriptor descriptor = getRuntimeManager().getDeploymentDescriptor();
      	AbstractAuditLogger auditLogger = null;
          if ("true".equals(System.getProperty("jbpm.audit.jms.enabled")) || descriptor.getAuditMode() == AuditMode.JMS) {
              try {
                  Properties properties = new Properties();
                  properties.load(getRuntimeManager().getEnvironment().getClassLoader().getResourceAsStream("/jbpm.audit.jms.properties"));
                  
                  auditLogger =  AuditLoggerFactory.newJMSInstance((Map)properties);
              } catch (IOException e) {
                  logger.error("Unable to load jms audit properties from {}", "/jbpm.audit.jms.properties", e);
              }
              auditLogger.setBuilder(getAuditBuilder(engine));
          } else if (descriptor.getAuditMode() == AuditMode.JPA){        
          	if (descriptor.getPersistenceUnit().equals(descriptor.getAuditPersistenceUnit())) {
          		auditLogger = AuditLoggerFactory.newJPAInstance(engine.getKieSession().getEnvironment());
          	} else {
          		auditLogger = new JPAWorkingMemoryDbLogger(EntityManagerFactoryManager.get().getOrCreate(descriptor.getAuditPersistenceUnit()));
          	}
          	auditLogger.setBuilder(getAuditBuilder(engine));
          }        
          
          return auditLogger;
      }