@Test public void testSetDataSource() { System.out.println("setDataSource"); String dataSource = "ZabbixDataSourceAdaptor"; EnergyModeller instance2 = new EnergyModeller(); instance2.setDataSource(dataSource); }
public void setDataSource(String dataSource) { try { if (!dataSource.startsWith(DEFAULT_DATA_SOURCE_PACKAGE)) { dataSource = DEFAULT_DATA_SOURCE_PACKAGE + "." + dataSource; } String wattsUpMeter = DEFAULT_DATA_SOURCE_PACKAGE + ".WattsUpMeterDataSourceAdaptor"; if (wattsUpMeter.equals(dataSource)) { datasource = WattsUpMeterDataSourceAdaptor.getInstance(); } else { datasource = (HostDataSource) (Class.forName(dataSource).newInstance()); } calibrator.setDatasource(datasource); } catch (ClassNotFoundException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source specified was not found"); } catch (InstantiationException | IllegalAccessException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source did not work", ex); } }
EnergyModeller { public void setDataSource(String dataSource) { try { if (!dataSource.startsWith(DEFAULT_DATA_SOURCE_PACKAGE)) { dataSource = DEFAULT_DATA_SOURCE_PACKAGE + "." + dataSource; } String wattsUpMeter = DEFAULT_DATA_SOURCE_PACKAGE + ".WattsUpMeterDataSourceAdaptor"; if (wattsUpMeter.equals(dataSource)) { datasource = WattsUpMeterDataSourceAdaptor.getInstance(); } else { datasource = (HostDataSource) (Class.forName(dataSource).newInstance()); } calibrator.setDatasource(datasource); } catch (ClassNotFoundException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source specified was not found"); } catch (InstantiationException | IllegalAccessException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source did not work", ex); } } }
EnergyModeller { public void setDataSource(String dataSource) { try { if (!dataSource.startsWith(DEFAULT_DATA_SOURCE_PACKAGE)) { dataSource = DEFAULT_DATA_SOURCE_PACKAGE + "." + dataSource; } String wattsUpMeter = DEFAULT_DATA_SOURCE_PACKAGE + ".WattsUpMeterDataSourceAdaptor"; if (wattsUpMeter.equals(dataSource)) { datasource = WattsUpMeterDataSourceAdaptor.getInstance(); } else { datasource = (HostDataSource) (Class.forName(dataSource).newInstance()); } calibrator.setDatasource(datasource); } catch (ClassNotFoundException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source specified was not found"); } catch (InstantiationException | IllegalAccessException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source did not work", ex); } } EnergyModeller();  EnergyModeller(boolean performDataGathering);  EnergyModeller(HostDataSource datasource, DatabaseConnector database); }
EnergyModeller { public void setDataSource(String dataSource) { try { if (!dataSource.startsWith(DEFAULT_DATA_SOURCE_PACKAGE)) { dataSource = DEFAULT_DATA_SOURCE_PACKAGE + "." + dataSource; } String wattsUpMeter = DEFAULT_DATA_SOURCE_PACKAGE + ".WattsUpMeterDataSourceAdaptor"; if (wattsUpMeter.equals(dataSource)) { datasource = WattsUpMeterDataSourceAdaptor.getInstance(); } else { datasource = (HostDataSource) (Class.forName(dataSource).newInstance()); } calibrator.setDatasource(datasource); } catch (ClassNotFoundException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source specified was not found"); } catch (InstantiationException | IllegalAccessException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source did not work", ex); } } EnergyModeller();  EnergyModeller(boolean performDataGathering);  EnergyModeller(HostDataSource datasource, DatabaseConnector database); static void main(String[] args); static EnergyModeller getInstance(); void setEnergyPredictor(String energyPredictor); void setDataSource(String dataSource); void setCurrentEnergyDivisionRule(String divisionRule); void setHistoricEnergyDivisionRule(String divisionRule); void setConsiderIdleEnergyCurrentVm(boolean considerIdleEnergy); HistoricUsageRecord getEnergyRecordForVM(VmDeployed vm, TimePeriod timePeriod); HashSet<HistoricUsageRecord> getEnergyRecordForVM(Collection<VmDeployed> vms, TimePeriod timePeriod); HashSet<HistoricUsageRecord> getEnergyRecordForDeployment(String deploymentId, TimePeriod timePeriod); HistoricUsageRecord getEnergyRecordForHost(Host host, TimePeriod timePeriod); HashSet<HistoricUsageRecord> getEnergyRecordForHost(Collection<Host> hosts, TimePeriod timePeriod); CurrentUsageRecord getCurrentEnergyForVM(VmDeployed vm); HashSet<CurrentUsageRecord> getCurrentEnergyForVM(Collection<VmDeployed> vms); CurrentUsageRecord getCurrentEnergyForHost(Host host); CurrentUsageRecord getCurrentGeneralPowerConsumerOverhead(); HashSet<CurrentUsageRecord> getCurrentEnergyForHost(Collection<Host> hosts); EnergyUsagePrediction getPredictedEnergyForVM(VM vmImage, Collection<VM> vMsOnHost, Host host); EnergyUsagePrediction getPredictedEnergyForVM(VM vmImage, Collection<VM> vMsOnHost, Host host, TimePeriod duration); EnergyUsagePrediction getPredictedEnergyForVMTransfer(VmDeployed vm, Host destination, TimePeriod duration); EnergyUsagePrediction getHostPredictedEnergy(Host host, Collection<VM> virtualMachines); EnergyUsagePrediction getHostPredictedEnergy(Host host, Collection<VM> virtualMachines, TimePeriod duration); Collection<Host> getHost(Collection<String> hostname); Host getHost(String hostname); Collection<Host> getHostList(); List<Host> getHostList(Comparator<Host> sort); static VM getVM(int cpuCount, int ramMb, int diskGb); static Collection<VM> getVMs(OvfDefinition deploymentOVF); ArrayList<VmDeployed> getVMsOnHost(Host host); VmDeployed getVM(String name); VmDeployed getVM(int vmId); void setVMProfileData(VmDeployed vm); double getVmTotalCurrentPowerConsumption(); double getHostsTotalCurrentPowerConsumption(); double getVMToHostPowerRatio(); double getHostPowerUnallocatedToVMs(); void calibrateModelForHost(Collection<Host> hosts); void calibrateModelForHost(Host host); void stop(); }
EnergyModeller { public void setDataSource(String dataSource) { try { if (!dataSource.startsWith(DEFAULT_DATA_SOURCE_PACKAGE)) { dataSource = DEFAULT_DATA_SOURCE_PACKAGE + "." + dataSource; } String wattsUpMeter = DEFAULT_DATA_SOURCE_PACKAGE + ".WattsUpMeterDataSourceAdaptor"; if (wattsUpMeter.equals(dataSource)) { datasource = WattsUpMeterDataSourceAdaptor.getInstance(); } else { datasource = (HostDataSource) (Class.forName(dataSource).newInstance()); } calibrator.setDatasource(datasource); } catch (ClassNotFoundException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source specified was not found"); } catch (InstantiationException | IllegalAccessException ex) { if (datasource == null) { datasource = new ZabbixDirectDbDataSourceAdaptor(); calibrator.setDatasource(datasource); } Logger.getLogger(EnergyModeller.class.getName()).log(Level.WARNING, "The data source did not work", ex); } } EnergyModeller();  EnergyModeller(boolean performDataGathering);  EnergyModeller(HostDataSource datasource, DatabaseConnector database); static void main(String[] args); static EnergyModeller getInstance(); void setEnergyPredictor(String energyPredictor); void setDataSource(String dataSource); void setCurrentEnergyDivisionRule(String divisionRule); void setHistoricEnergyDivisionRule(String divisionRule); void setConsiderIdleEnergyCurrentVm(boolean considerIdleEnergy); HistoricUsageRecord getEnergyRecordForVM(VmDeployed vm, TimePeriod timePeriod); HashSet<HistoricUsageRecord> getEnergyRecordForVM(Collection<VmDeployed> vms, TimePeriod timePeriod); HashSet<HistoricUsageRecord> getEnergyRecordForDeployment(String deploymentId, TimePeriod timePeriod); HistoricUsageRecord getEnergyRecordForHost(Host host, TimePeriod timePeriod); HashSet<HistoricUsageRecord> getEnergyRecordForHost(Collection<Host> hosts, TimePeriod timePeriod); CurrentUsageRecord getCurrentEnergyForVM(VmDeployed vm); HashSet<CurrentUsageRecord> getCurrentEnergyForVM(Collection<VmDeployed> vms); CurrentUsageRecord getCurrentEnergyForHost(Host host); CurrentUsageRecord getCurrentGeneralPowerConsumerOverhead(); HashSet<CurrentUsageRecord> getCurrentEnergyForHost(Collection<Host> hosts); EnergyUsagePrediction getPredictedEnergyForVM(VM vmImage, Collection<VM> vMsOnHost, Host host); EnergyUsagePrediction getPredictedEnergyForVM(VM vmImage, Collection<VM> vMsOnHost, Host host, TimePeriod duration); EnergyUsagePrediction getPredictedEnergyForVMTransfer(VmDeployed vm, Host destination, TimePeriod duration); EnergyUsagePrediction getHostPredictedEnergy(Host host, Collection<VM> virtualMachines); EnergyUsagePrediction getHostPredictedEnergy(Host host, Collection<VM> virtualMachines, TimePeriod duration); Collection<Host> getHost(Collection<String> hostname); Host getHost(String hostname); Collection<Host> getHostList(); List<Host> getHostList(Comparator<Host> sort); static VM getVM(int cpuCount, int ramMb, int diskGb); static Collection<VM> getVMs(OvfDefinition deploymentOVF); ArrayList<VmDeployed> getVMsOnHost(Host host); VmDeployed getVM(String name); VmDeployed getVM(int vmId); void setVMProfileData(VmDeployed vm); double getVmTotalCurrentPowerConsumption(); double getHostsTotalCurrentPowerConsumption(); double getVMToHostPowerRatio(); double getHostPowerUnallocatedToVMs(); void calibrateModelForHost(Collection<Host> hosts); void calibrateModelForHost(Host host); void stop();  }