package schedframe.scheduling.policy.global; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import schedframe.scheduling.GridResourceDiscovery; import schedframe.scheduling.Scheduler; import schedframe.scheduling.manager.resources.ManagedResources; import schedframe.scheduling.plugin.SchedulingPlugin; import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; import schedframe.scheduling.plugin.grid.ModuleListImpl; import schedframe.scheduling.queue.TaskQueueList; public class GridBroker extends GlobalManagementSystem { private static Log log = LogFactory.getLog(GridBroker.class); protected Set otherGridSchedulersIds; public GridBroker(String name, SchedulingPlugin schedulingPlugin, ExecutionTimeEstimationPlugin execTimeEstimationPlugin, TaskQueueList queues) throws Exception { super(name, "BROKER", schedulingPlugin, execTimeEstimationPlugin, queues); //make use of plug-in interface //Properties prop = new Properties(); //prop.put("plugin.name", name); //prop.put("plugin.utils.timeoperations", "gssim.scheduling.plugin.local.GssimTimeOperations"); //schedulingPlugin.init(prop); otherGridSchedulersIds = new HashSet(); moduleList = new ModuleListImpl(2); //this.moduleList.add(new GridResourceDiscovery(this.getScheduler())); //moduleList.add(new GridReservationManagerNew(this)); if(log.isDebugEnabled()) log.debug(name + ": Creating a broker interface object"); } public void init(Scheduler scheduler, ManagedResources managedResources) { super.init(scheduler, managedResources); //this.scheduler = scheduler; //this.resourceManager = ResourceManagerFactory.createResourceManager(scheduler, managedResources); this.moduleList.add((GridResourceDiscovery)resourceManager); } public List getMyGridResources() { List providerIds = new ArrayList(); for(Scheduler sched: scheduler.getChildren()){ providerIds.add(sched.get_id()); } return providerIds; //return GridSim.getGridResourceList(); } public void addOtherGridSchedulerId(int id){ otherGridSchedulersIds.add(id); } }