source: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/StandardResourceFactory.java @ 1247

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