package schedframe.resources.computing; import schedframe.resources.StandardResourceType; import schedframe.resources.computing.description.ComputingResourceDescription; import schedframe.scheduling.Scheduler; import schedframe.scheduling.manager.resources.ManagedResources; import schedframe.scheduling.plugin.SchedulingPlugin; import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; import schedframe.scheduling.policy.AbstractManagementSystem; import schedframe.scheduling.policy.global.GridBroker; import schedframe.scheduling.policy.local.LocalManagementSystem; import schedframe.scheduling.queue.TaskQueueList; import simulator.DCWormsConstants; public class StandardResourceFactory implements ResourceFactory { public ComputingResource createComputingResource(ComputingResourceDescription resDesc){ if (resDesc.getType().equals(StandardResourceType.DataCenter)) return new DataCenter(resDesc); else if (resDesc.getType().equals(StandardResourceType.Rack)) return new Rack(resDesc); else if (resDesc.getType().equals(StandardResourceType.Node)) return new Node(resDesc); else if (resDesc.getType().equals(StandardResourceType.Processor)) return new Processor(resDesc); else if (resDesc.getType().equals(StandardResourceType.Core)) return new Core(resDesc); else return new ComputingResource(resDesc); } public Scheduler createScheduler(StandardResourceType type, String id, SchedulingPlugin schedulingPlugin, ExecutionTimeEstimationPlugin execTimeEstimationPlugin, TaskQueueList queues, ManagedResources managedResources) throws Exception{ AbstractManagementSystem ms; switch(type){ case GS: { ms = new GridBroker("grid", schedulingPlugin, execTimeEstimationPlugin, queues); return new Scheduler(ms, type, managedResources); } case LS: { ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM, schedulingPlugin, execTimeEstimationPlugin, queues); return new Scheduler(ms, type, managedResources); } default:{ ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM, schedulingPlugin, execTimeEstimationPlugin, queues); return new Scheduler(ms, type, managedResources); } } } }