package test.article.recs.plugins.scheduling; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import schedframe.resources.computing.ComputingNode; import schedframe.scheduling.tasks.TaskInterface; import test.article.recs.utils.AppType; import test.article.recs.utils.TaskToApp; import dcworms.schedframe.scheduling.ExecTask; import dcworms.schedframe.scheduling.Executable; import example.localplugin.BaseLocalSchedulingPlugin; public abstract class RecsSP extends BaseLocalSchedulingPlugin { private static String EXEC_DATA_FILE_NAME = "src/test/article/recs/data/executiveness_data.properties"; private ResourceBundle execBundle; protected TaskToApp taskToApp = new TaskToApp(); protected void initApplicationType(TaskInterface task){ taskToApp.getAppType(task); } protected String createExecutivenessQuery(TaskInterface task, ComputingNode node) { Executable exec = (Executable)task; String query = getApplicationType(exec) + "." + getNodeCategory(node); return query; } private String getApplicationType(ExecTask task){ AppType appType = taskToApp.getAppType(task); return appType.toString(); } private String getNodeCategory(ComputingNode node){ return node.getCategory(); } protected boolean getExecutiveness(String query) throws FileNotFoundException, IOException{ ResourceBundle execBundle = getExecBundle(); return Boolean.valueOf(execBundle.getString(query)).booleanValue(); } private ResourceBundle getExecBundle() throws FileNotFoundException, IOException{ if(execBundle == null){ execBundle = new PropertyResourceBundle(new FileInputStream(EXEC_DATA_FILE_NAME)); } return execBundle; } }