public Iterator<EventBean> iterator() { if (context.getCustomConfiguration() != null && context.getCustomConfiguration().equals(ITERATE)) { List<EventBean> events = new ArrayList<EventBean>(); for (Object item : data) { events.add(context.getEventFactory().wrap(item)); } return events.iterator(); } return Collections.<EventBean>emptyList().iterator(); }
protected static ExceptionHandlingService initExceptionHandling( String engineURI, ConfigurationEngineDefaults.ExceptionHandling exceptionHandling, ConfigurationEngineDefaults.ConditionHandling conditionHandling) throws ConfigurationException { List<ExceptionHandler> exceptionHandlers; if (exceptionHandling.getHandlerFactories() == null || exceptionHandling.getHandlerFactories().isEmpty()) { exceptionHandlers = Collections.emptyList(); } else { exceptionHandlers = new ArrayList<ExceptionHandler>(); ExceptionHandlerFactoryContext context = new ExceptionHandlerFactoryContext(engineURI); for (String className : exceptionHandling.getHandlerFactories()) { try { ExceptionHandlerFactory factory = (ExceptionHandlerFactory) JavaClassHelper.instantiate(ExceptionHandlerFactory.class, className); ExceptionHandler handler = factory.getHandler(context); if (handler == null) { log.warn( "Exception handler factory '" + className + "' returned a null handler, skipping factory"); continue; } exceptionHandlers.add(handler); } catch (RuntimeException ex) { throw new ConfigurationException( "Exception initializing exception handler from exception handler factory '" + className + "': " + ex.getMessage(), ex); } } } List<ConditionHandler> conditionHandlers; if (conditionHandling.getHandlerFactories() == null || conditionHandling.getHandlerFactories().isEmpty()) { conditionHandlers = Collections.emptyList(); } else { conditionHandlers = new ArrayList<ConditionHandler>(); ConditionHandlerFactoryContext context = new ConditionHandlerFactoryContext(engineURI); for (String className : conditionHandling.getHandlerFactories()) { try { ConditionHandlerFactory factory = (ConditionHandlerFactory) JavaClassHelper.instantiate(ConditionHandlerFactory.class, className); ConditionHandler handler = factory.getHandler(context); if (handler == null) { log.warn( "Condition handler factory '" + className + "' returned a null handler, skipping factory"); continue; } conditionHandlers.add(handler); } catch (RuntimeException ex) { throw new ConfigurationException( "Exception initializing exception handler from exception handler factory '" + className + "': " + ex.getMessage(), ex); } } } return new ExceptionHandlingService(engineURI, exceptionHandlers, conditionHandlers); }