@Test public void testDefaultConfigLogFeeder() throws Exception { LogSearchConfigLogFeeder config = LogSearchConfigFactory.createLogSearchConfigLogFeeder( Collections.<String, String> emptyMap(), null, LogSearchConfigLogFeederClass1.class); Assert.assertSame(config.getClass(), LogSearchConfigLogFeederClass1.class); }
public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName, Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init) throws Exception { try { LogSearchConfigLogFeeder logSearchConfig = null; String configClassName = properties.get("logsearch.config.logfeeder.class"); if (configClassName != null && !"".equals(configClassName.trim())) { Class<?> clazz = Class.forName(configClassName); if (LogSearchConfig.class.isAssignableFrom(clazz)) { logSearchConfig = (LogSearchConfigLogFeeder) clazz.newInstance(); } else { throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " + LogSearchConfigLogFeeder.class.getName()); } } else { logSearchConfig = defaultClass.newInstance(); } if (init) { logSearchConfig.init(properties, clusterName == null ? "null" : clusterName.toLowerCase()); } return logSearchConfig; } catch (Exception e) { logger.error("Could not initialize logsearch config.", e); throw e; } }
LogSearchConfigFactory { public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName, Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init) throws Exception { try { LogSearchConfigLogFeeder logSearchConfig = null; String configClassName = properties.get("logsearch.config.logfeeder.class"); if (configClassName != null && !"".equals(configClassName.trim())) { Class<?> clazz = Class.forName(configClassName); if (LogSearchConfig.class.isAssignableFrom(clazz)) { logSearchConfig = (LogSearchConfigLogFeeder) clazz.newInstance(); } else { throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " + LogSearchConfigLogFeeder.class.getName()); } } else { logSearchConfig = defaultClass.newInstance(); } if (init) { logSearchConfig.init(properties, clusterName == null ? "null" : clusterName.toLowerCase()); } return logSearchConfig; } catch (Exception e) { logger.error("Could not initialize logsearch config.", e); throw e; } } }
LogSearchConfigFactory { public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName, Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init) throws Exception { try { LogSearchConfigLogFeeder logSearchConfig = null; String configClassName = properties.get("logsearch.config.logfeeder.class"); if (configClassName != null && !"".equals(configClassName.trim())) { Class<?> clazz = Class.forName(configClassName); if (LogSearchConfig.class.isAssignableFrom(clazz)) { logSearchConfig = (LogSearchConfigLogFeeder) clazz.newInstance(); } else { throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " + LogSearchConfigLogFeeder.class.getName()); } } else { logSearchConfig = defaultClass.newInstance(); } if (init) { logSearchConfig.init(properties, clusterName == null ? "null" : clusterName.toLowerCase()); } return logSearchConfig; } catch (Exception e) { logger.error("Could not initialize logsearch config.", e); throw e; } }  }
LogSearchConfigFactory { public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName, Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init) throws Exception { try { LogSearchConfigLogFeeder logSearchConfig = null; String configClassName = properties.get("logsearch.config.logfeeder.class"); if (configClassName != null && !"".equals(configClassName.trim())) { Class<?> clazz = Class.forName(configClassName); if (LogSearchConfig.class.isAssignableFrom(clazz)) { logSearchConfig = (LogSearchConfigLogFeeder) clazz.newInstance(); } else { throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " + LogSearchConfigLogFeeder.class.getName()); } } else { logSearchConfig = defaultClass.newInstance(); } if (init) { logSearchConfig.init(properties, clusterName == null ? "null" : clusterName.toLowerCase()); } return logSearchConfig; } catch (Exception e) { logger.error("Could not initialize logsearch config.", e); throw e; } }  static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
      Class<? extends LogSearchConfigServer> defaultClass, boolean init); static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
      Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init); static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
                                                                  Class<? extends LogSearchConfigServer> defaultClass); static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
      Class<? extends LogSearchConfigLogFeeder> defaultClass); }
LogSearchConfigFactory { public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName, Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init) throws Exception { try { LogSearchConfigLogFeeder logSearchConfig = null; String configClassName = properties.get("logsearch.config.logfeeder.class"); if (configClassName != null && !"".equals(configClassName.trim())) { Class<?> clazz = Class.forName(configClassName); if (LogSearchConfig.class.isAssignableFrom(clazz)) { logSearchConfig = (LogSearchConfigLogFeeder) clazz.newInstance(); } else { throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " + LogSearchConfigLogFeeder.class.getName()); } } else { logSearchConfig = defaultClass.newInstance(); } if (init) { logSearchConfig.init(properties, clusterName == null ? "null" : clusterName.toLowerCase()); } return logSearchConfig; } catch (Exception e) { logger.error("Could not initialize logsearch config.", e); throw e; } }  static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
      Class<? extends LogSearchConfigServer> defaultClass, boolean init); static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
      Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init); static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
                                                                  Class<? extends LogSearchConfigServer> defaultClass); static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
      Class<? extends LogSearchConfigLogFeeder> defaultClass);  }