@Test public void testPickCorrectStrategy() throws JRException { OnmsQueryExecutorFactoryBundle executorBundle = new OnmsQueryExecutorFactoryBundle(); JRQueryExecuterFactory factory = executorBundle.getQueryExecuterFactory("jrobin"); assertTrue(JRobinQueryExecutorFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("rrdtool"); assertTrue(RrdtoolQueryExecutorFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("resourceQuery"); assertTrue(ResourceQueryExecuterFactory.class == factory.getClass()); System.setProperty("org.opennms.rrd.strategyClass", "org.opennms.netmgt.rrd.rrdtool.JniRrdStrategy"); factory = executorBundle.getQueryExecuterFactory("jrobin"); assertTrue(RrdtoolQueryExecutorFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("rrdtool"); assertTrue(RrdtoolQueryExecutorFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("resourceQuery"); assertTrue(ResourceQueryExecuterFactory.class == factory.getClass()); System.setProperty("org.opennms.rrd.strategyClass", "org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy"); factory = executorBundle.getQueryExecuterFactory("jrobin"); assertTrue(JRobinQueryExecutorFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("rrdtool"); assertTrue(JRobinQueryExecutorFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("resourceQuery"); assertTrue(ResourceQueryExecuterFactory.class == factory.getClass()); factory = executorBundle.getQueryExecuterFactory("sql"); assertNull(factory); }
public JRQueryExecuterFactory getQueryExecuterFactory(String language) throws JRException { String reportLanguage = checkReportLanguage(language); if("jrobin".equals(reportLanguage)) { return new JRobinQueryExecutorFactory(); } else if("rrdtool".equals(reportLanguage)) { return new RrdtoolQueryExecutorFactory(); } else if("resourceQuery".equals(reportLanguage)) { return new ResourceQueryExecuterFactory(); } else { return null; } }
OnmsQueryExecutorFactoryBundle implements QueryExecuterFactoryBundle { public JRQueryExecuterFactory getQueryExecuterFactory(String language) throws JRException { String reportLanguage = checkReportLanguage(language); if("jrobin".equals(reportLanguage)) { return new JRobinQueryExecutorFactory(); } else if("rrdtool".equals(reportLanguage)) { return new RrdtoolQueryExecutorFactory(); } else if("resourceQuery".equals(reportLanguage)) { return new ResourceQueryExecuterFactory(); } else { return null; } } }
OnmsQueryExecutorFactoryBundle implements QueryExecuterFactoryBundle { public JRQueryExecuterFactory getQueryExecuterFactory(String language) throws JRException { String reportLanguage = checkReportLanguage(language); if("jrobin".equals(reportLanguage)) { return new JRobinQueryExecutorFactory(); } else if("rrdtool".equals(reportLanguage)) { return new RrdtoolQueryExecutorFactory(); } else if("resourceQuery".equals(reportLanguage)) { return new ResourceQueryExecuterFactory(); } else { return null; } }  }
OnmsQueryExecutorFactoryBundle implements QueryExecuterFactoryBundle { public JRQueryExecuterFactory getQueryExecuterFactory(String language) throws JRException { String reportLanguage = checkReportLanguage(language); if("jrobin".equals(reportLanguage)) { return new JRobinQueryExecutorFactory(); } else if("rrdtool".equals(reportLanguage)) { return new RrdtoolQueryExecutorFactory(); } else if("resourceQuery".equals(reportLanguage)) { return new ResourceQueryExecuterFactory(); } else { return null; } }  String[] getLanguages(); JRQueryExecuterFactory getQueryExecuterFactory(String language); }
OnmsQueryExecutorFactoryBundle implements QueryExecuterFactoryBundle { public JRQueryExecuterFactory getQueryExecuterFactory(String language) throws JRException { String reportLanguage = checkReportLanguage(language); if("jrobin".equals(reportLanguage)) { return new JRobinQueryExecutorFactory(); } else if("rrdtool".equals(reportLanguage)) { return new RrdtoolQueryExecutorFactory(); } else if("resourceQuery".equals(reportLanguage)) { return new ResourceQueryExecuterFactory(); } else { return null; } }  String[] getLanguages(); JRQueryExecuterFactory getQueryExecuterFactory(String language);  }