package test.rewolucja.scheduling.implementation; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Properties; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import schedframe.scheduling.plugin.estimation.ExecTimeEstimationPlugin; import schedframe.scheduling.plugin.grid.ModuleListImpl; import test.rewolucja.reservation.GridReservationManagerNew; import test.rewolucja.resources.description.ExecResourceDescription; import test.rewolucja.resources.logical.base.LogicalResource; import test.rewolucja.resources.manager.factory.ResourceManagerFactory; import test.rewolucja.scheduling.GridResourceDiscovery; public class GridBroker extends GlobalManagementSystem { private static Log log = LogFactory.getLog(GridBroker.class); protected Set otherGridSchedulersIds; public GridBroker(String name, String schedulingPluginClassName, ExecTimeEstimationPlugin execTimeEstimationPlugin, ExecResourceDescription arc) throws Exception { super(name, "BROKER", schedulingPluginClassName, execTimeEstimationPlugin, arc); //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.getLogicalResource())); moduleList.add(new GridReservationManagerNew(this)); if(log.isDebugEnabled()) log.debug(name + ": Creating a broker interface object"); } public void init(LogicalResource logRes) { logicalResource = logRes; resourceManager = ResourceManagerFactory.createResourceManager(logicalResource); moduleList.add((GridResourceDiscovery)resourceManager); } public List getMyGridResources() { List providerIds = new ArrayList(); for(LogicalResource logRes : logicalResource.getChildren()){ providerIds.add(logRes.get_id()); } return providerIds; //return GridSim.getGridResourceList(); } public void addOtherGridSchedulerId(int id){ otherGridSchedulersIds.add(id); } }