class DefaultRegisterableItemsFactory extends SimpleRegisterableItemsFactory {

    @Override
    public List<ProcessEventListener> getProcessEventListeners(RuntimeEngine runtime) {
        KieSession ksession = ((InternalRuntimeEngine) runtime).internalGetKieSession();
        List<ProcessEventListener> defaultListeners = new ArrayList<ProcessEventListener>();
        DeploymentDescriptor descriptor = getRuntimeManager().getDeploymentDescriptor();
        if (descriptor == null) {
        	// register JPAWorkingMemoryDBLogger
	        AbstractAuditLogger logger = AuditLoggerFactory.newJPAInstance(ksession.getEnvironment());
	        logger.setBuilder(getAuditBuilder(runtime));
	        defaultListeners.add(logger);
        } else if (descriptor.getAuditMode() == AuditMode.JPA) {
        	// register JPAWorkingMemoryDBLogger
        	AbstractAuditLogger logger = null;
        	if (descriptor.getPersistenceUnit().equals(descriptor.getAuditPersistenceUnit())) {
        		logger = AuditLoggerFactory.newJPAInstance(ksession.getEnvironment());
        	} else {
        		Environment env = EnvironmentFactory.newEnvironment();
        		env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, EntityManagerFactoryManager.get().getOrCreate(descriptor.getAuditPersistenceUnit()));
        		logger = AuditLoggerFactory.newJPAInstance(env);
        	}
	        
	        logger.setBuilder(getAuditBuilder(runtime));
	        defaultListeners.add(logger);
        } else if (descriptor.getAuditMode() == AuditMode.JMS) {
            try {
                if (jmsLogger == null) {
                    Properties properties = loadJMSProperties();
                    logger.debug("Creating AsyncAuditLogProducer {}", properties);

                    jmsLogger = AuditLoggerFactory.newJMSInstance((Map) properties);
                    jmsLogger.setBuilder(getAuditBuilder(runtime));
                }
                defaultListeners.add(jmsLogger);
            } catch (IOException e) {
                logger.error("Unable to load jms audit properties from {}", "/jbpm.audit.jms.properties", e);
            }
        }
        // add any custom listeners
        defaultListeners.addAll(super.getProcessEventListeners(runtime));
        // add listeners from descriptor
        defaultListeners.addAll(getEventListenerFromDescriptor(runtime, ProcessEventListener.class));        
        return defaultListeners;
    }

}