source: DCWoRMS/branches/coolemall/src/schedframe/resources/CoolEmAllResourceFactory.java @ 1271

Revision 1271, 2.5 KB checked in by wojtekp, 11 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.resources;
2
3import schedframe.resources.computing.ComputingResource;
4import schedframe.resources.computing.Core;
5import schedframe.resources.computing.DataCenter;
6import schedframe.resources.computing.Node;
7import schedframe.resources.computing.Processor;
8import schedframe.resources.computing.ResourceFactory;
9import schedframe.resources.computing.coolemall.ComputeBox1;
10import schedframe.resources.computing.coolemall.NodeGroup;
11import schedframe.resources.computing.description.ComputingResourceDescription;
12import schedframe.scheduling.Scheduler;
13import schedframe.scheduling.manager.resources.ManagedResources;
14import schedframe.scheduling.plugin.SchedulingPlugin;
15import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin;
16import schedframe.scheduling.policy.AbstractManagementSystem;
17import schedframe.scheduling.policy.local.LocalManagementSystem;
18import schedframe.scheduling.queue.TaskQueueList;
19import simulator.DCWormsConstants;
20
21public class CoolEmAllResourceFactory implements ResourceFactory{
22       
23        public ComputingResource createComputingResource(ComputingResourceDescription resDesc){
24               
25                if (resDesc.getType().getName().equals(StandardResourceType.DataCenter.getName()))
26                        return new DataCenter(resDesc);
27                else if (resDesc.getType().getName().equals(StandardResourceType.Rack.getName()))
28                        return new ComputeBox1(resDesc);
29                else if (resDesc.getType().getName().equals(CoolEmAllResourceType.NodeGroup.getName()))
30                        return new NodeGroup(resDesc);
31                else if (resDesc.getType().getName().equals(StandardResourceType.Node.getName()))
32                        return new Node(resDesc);
33                else if (resDesc.getType().getName().equals(StandardResourceType.Processor.getName()))
34                        return new Processor(resDesc);
35                else if (resDesc.getType().getName().equals(StandardResourceType.Core.getName()))
36                        return new Core(resDesc);
37                else return new ComputingResource(resDesc);
38        }
39
40        public Scheduler createScheduler(StandardResourceType type, String id, SchedulingPlugin schedulingPlugin, ExecutionTimeEstimationPlugin execTimeEstimationPlugin, TaskQueueList queues, ManagedResources managedResources) throws Exception{
41                AbstractManagementSystem ms;
42                switch(type){
43                        case LS: {
44                                ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM,
45                                                schedulingPlugin, execTimeEstimationPlugin, queues);
46                                return new Scheduler(ms, type, managedResources);
47                        }
48
49                default:{
50                                ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM,
51                                                schedulingPlugin, execTimeEstimationPlugin, queues);
52                                return new Scheduler(ms, type, managedResources);
53                        }
54                }
55        }
56}
Note: See TracBrowser for help on using the repository browser.