package schedframe.resources; import schedframe.resources.computing.Node; import schedframe.resources.computing.ComputingResource; import schedframe.resources.computing.Core; import schedframe.resources.computing.DataCenter; import schedframe.resources.computing.Processor; import schedframe.resources.computing.ResourceFactory; import schedframe.resources.computing.coolemall.ComputeBox1; import schedframe.resources.computing.coolemall.NodeGroup; 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.local.LocalManagementSystem; import schedframe.scheduling.queue.TaskQueueList; import simulator.DCWormsConstants; public class CoolEmAllResourceFactory implements ResourceFactory{ public ComputingResource createComputingResource(ComputingResourceDescription resDesc){ if (resDesc.getType().getName().equals(StandardResourceType.DataCenter.getName())) return new DataCenter(resDesc); else if (resDesc.getType().getName().equals(StandardResourceType.Rack.getName())) return new ComputeBox1(resDesc); else if (resDesc.getType().getName().equals(CoolEmAllResourceType.NodeGroup.getName())) return new NodeGroup(resDesc); else if (resDesc.getType().getName().equals(StandardResourceType.Node.getName())) return new Node(resDesc); else if (resDesc.getType().getName().equals(StandardResourceType.Processor.getName())) return new Processor(resDesc); else if (resDesc.getType().getName().equals(StandardResourceType.Core.getName())) 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 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); } } } }