Index: /DCWoRMS/trunk/src/test/article2/recs/plugins/scheduling/RecsSP.java
===================================================================
--- /DCWoRMS/trunk/src/test/article2/recs/plugins/scheduling/RecsSP.java	(revision 828)
+++ /DCWoRMS/trunk/src/test/article2/recs/plugins/scheduling/RecsSP.java	(revision 828)
@@ -0,0 +1,55 @@
+package test.article2.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.article2.recs.utils.AppType;
+import test.article2.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/article2/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;
+	}
+}
Index: /DCWoRMS/trunk/src/test/article2/recs/plugins/scheduling/RecsExclusivenessRandomSP.java
===================================================================
--- /DCWoRMS/trunk/src/test/article2/recs/plugins/scheduling/RecsExclusivenessRandomSP.java	(revision 828)
+++ /DCWoRMS/trunk/src/test/article2/recs/plugins/scheduling/RecsExclusivenessRandomSP.java	(revision 828)
@@ -0,0 +1,173 @@
+package test.article2.recs.plugins.scheduling;
+
+import gridsim.dcworms.DCWormsTags;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Random;
+
+import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.resources.ResourceStatus;
+import schedframe.resources.computing.ComputingNode;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Core;
+import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName;
+import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName;
+import schedframe.resources.units.ProcessingElements;
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
+import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.manager.resources.ClusterResourceManager;
+import schedframe.scheduling.manager.resources.ResourceManager;
+import schedframe.scheduling.manager.tasks.JobRegistry;
+import schedframe.scheduling.manager.tasks.JobRegistryImpl;
+import schedframe.scheduling.plan.SchedulingPlanInterface;
+import schedframe.scheduling.plan.impl.SchedulingPlan;
+import schedframe.scheduling.plugin.grid.ModuleList;
+import schedframe.scheduling.queue.TaskQueue;
+import schedframe.scheduling.queue.TaskQueueList;
+import schedframe.scheduling.tasks.TaskInterface;
+
+public class RecsExclusivenessRandomSP extends RecsSP {
+
+	private Random rand = new Random(5);
+	
+	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
+			ResourceManager resManager, ModuleList modules) {
+
+		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
+		SchedulingPlan plan = new SchedulingPlan();
+		// choose the events types to serve.
+		// Different actions for different events are possible.
+		switch (event.getType()) {
+		case START_TASK_EXECUTION:
+		case TASK_FINISHED:
+		//case TIMER:
+			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
+			TaskQueue q = queues.get(0);
+
+			List<ComputingNode> notSelectedNodes = resourceManager.getComputingNodes();
+			// check all tasks in queue
+			for (int i = 0; i < q.size(); i++) {
+				TaskInterface<?> task = q.get(i);
+				// if status of the tasks in READY
+				if (task.getStatus() == DCWormsTags.READY) {
+					ComputingNode node = chooseRandomProvider(resourceManager, task);
+					if (node != null) {
+						node.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.FAN_ON);
+						notSelectedNodes.remove(node);
+						addToSchedulingPlan(plan, task, chooseResourcesForExecution(node, task));
+					}
+				}
+			}
+			adjustOtherFans(notSelectedNodes);
+			break;
+		}
+		return plan;
+	}
+	
+	private ComputingNode chooseRandomProvider(ClusterResourceManager resourceManager, TaskInterface<?> task) {
+		List<ComputingNode> nodes = filterNodes(resourceManager.getComputingNodes(), task);
+		if(nodes.size() > 0)
+			return randomNode(nodes);
+		return null;
+	}
+
+	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
+			ComputingNode node, TaskInterface<?> task) {
+
+		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>();
+
+		int cpuRequest;
+		try {
+			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
+		} catch (NoSuchFieldException e) {
+			cpuRequest = 0;
+		}
+
+		if (cpuRequest != 0) {
+
+			List<Core> cores = node.getProcessors().get(0).getCores();
+
+			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>();				
+			for (int i = 0; i < cores.size(); i++) {
+				if (cores.get(i).getStatus() == ResourceStatus.FREE) {
+					//choosenResources.add(cores.get(i));
+					cpuRequest--;
+				}
+			}
+			if (cpuRequest > 0) {
+				//return null;
+			}
+			choosenResources.add(node.getProcessors().get(0));
+			ProcessingElements pe = new ProcessingElements();
+			pe.addAll(choosenResources);
+			map.put(StandardResourceUnitName.PE, pe);
+			return map;
+		}
+		return null;
+	}
+	
+	private List<ComputingNode> filterNodes(List<ComputingNode> nodes, TaskInterface<?> task){
+		List<ComputingNode> filteredNodes = new ArrayList<ComputingNode>();
+		for (ComputingNode node : nodes) {
+			int cpuRequest;
+			try {
+				cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
+			} catch (NoSuchFieldException e) {
+				cpuRequest = 0;
+			}
+
+			if (cpuRequest != 0) {
+
+				List<Core> cores = node.getProcessors().get(0).getCores();
+				if (cores.size() < cpuRequest) {
+					continue;
+				}
+
+				int freeCores = 0;
+				for(Core core: cores){
+					if(core.getStatus() == ResourceStatus.FREE)
+						freeCores++;
+				}
+				
+				if(freeCores != cores.size())
+					continue;
+				
+				try {
+					if(!getExecutiveness(createExecutivenessQuery(task, node)))
+						continue;
+				} catch (FileNotFoundException e) {
+					continue;
+				} catch (IOException e) {
+					continue;
+				} catch (MissingResourceException e){
+					continue;
+				}
+				filteredNodes.add(node);
+			}
+		}
+		
+		return filteredNodes;
+	}
+	
+	private ComputingNode randomNode(List<ComputingNode> nodes){
+		return nodes.get(rand.nextInt(nodes.size()));
+	}
+	
+	private void adjustOtherFans(List<ComputingNode> nodes){
+		for(ComputingNode node : nodes){
+			if(node.getFreeProcessorsNumber() == node.getProcessorsNumber()){
+				node.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.FAN_OFF);
+			} else if(new JobRegistryImpl(node.getName()).getRunningTasks().size() > 1)
+				node.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("FAN_ON_TURBO"));
+			else 
+				node.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.FAN_ON);
+		}
+	}
+}
