Ignore:
Timestamp:
12/19/12 19:10:54 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/src/test/article/recs/plugins/scheduling/RecsSP.java

    r680 r705  
    11package test.article.recs.plugins.scheduling; 
    22 
     3import java.io.FileInputStream; 
     4import java.io.FileNotFoundException; 
     5import java.io.IOException; 
     6import java.util.PropertyResourceBundle; 
     7import java.util.ResourceBundle; 
     8 
     9import schedframe.resources.computing.ComputingNode; 
    310import schedframe.scheduling.tasks.TaskInterface; 
     11import test.article.recs.utils.AppType; 
    412import test.article.recs.utils.TaskToApp; 
     13import dcworms.schedframe.scheduling.ExecTask; 
     14import dcworms.schedframe.scheduling.Executable; 
    515import example.localplugin.BaseLocalSchedulingPlugin; 
    616 
    717public abstract class RecsSP extends BaseLocalSchedulingPlugin { 
    818 
     19        private static String EXEC_DATA_FILE_NAME = "src/test/article/recs/data/executiveness_data.properties"; 
     20         
     21        private ResourceBundle execBundle; 
     22         
    923        protected TaskToApp taskToApp = new TaskToApp(); 
    1024         
     
    1226                 taskToApp.getAppType(task); 
    1327        } 
     28         
     29        protected String createQuery(TaskInterface<?> task, ComputingNode node) { 
     30                Executable exec = (Executable)task; 
     31                String query = getApplicationType(exec) + "." + getNodeCategory(node); 
     32                return query; 
     33        } 
     34 
     35        private String getApplicationType(ExecTask task){        
     36                AppType appType = taskToApp.getAppType(task); 
     37                return appType.toString(); 
     38        } 
     39         
     40        private String getNodeCategory(ComputingNode node){ 
     41                return node.getCategory(); 
     42        } 
     43 
     44        protected boolean getExecutiveness(String query) throws FileNotFoundException, IOException{ 
     45                ResourceBundle execBundle = getExecBundle(); 
     46                return Boolean.valueOf(execBundle.getString(query)).booleanValue(); 
     47        } 
     48         
     49        private ResourceBundle getExecBundle() throws FileNotFoundException, IOException{ 
     50                if(execBundle == null){ 
     51                        execBundle = new PropertyResourceBundle(new FileInputStream(EXEC_DATA_FILE_NAME)); 
     52                } 
     53                return execBundle; 
     54        } 
    1455} 
Note: See TracChangeset for help on using the changeset viewer.