source: xssim/trunk/src/test/rewolucja/resources/logical/implementation/Cluster.java @ 226

Revision 226, 1.8 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.rewolucja.resources.logical.implementation;
2
3import eduni.simjava.Sim_event;
4import gridsim.GridSimTags;
5import gridsim.IO_data;
6import gridsim.gssim.GssimTags;
7
8import java.util.HashMap;
9import java.util.List;
10import java.util.Map;
11
12import schedframe.resources.ResourceStateDescription;
13import schedframe.resources.providers.LocalSystem;
14import schedframe.resources.units.ResourceUnit;
15import schedframe.scheduling.utils.ResourceParameterName;
16import test.rewolucja.resources.logical.base.LogicalResource;
17import test.rewolucja.resources.physical.base.ComputingResource;
18import test.rewolucja.scheduling.implementation.ManagementSystem;
19
20public class Cluster extends LogicalResource{
21       
22        public Cluster(ManagementSystem manSys) throws Exception {
23                super(manSys);
24        }
25       
26        public Cluster(ManagementSystem manSys, List<ComputingResource> res) throws Exception {
27                super(manSys, res);
28        }
29
30        protected void processOtherRequest(Sim_event ev) {
31                switch (ev.get_tag()) {
32                case GssimTags.QUERY_RESOURCE_DESC:
33                        ResourceStateDescription desc = new ResourceStateDescription(new LocalSystem(get_name(), null, null));
34                        Map<ResourceParameterName, ResourceUnit> units = new HashMap<ResourceParameterName, ResourceUnit>();
35                        desc.addComputingResources(compResources);
36                        //ResourceComponentsNew resourceComponents = new ResourceComponentsNew(get_name());
37                        //resourceComponents.addAll(resources);
38                        //units.put(ResourceParameterName.RESOURCECOMPONENTS, resourceComponents);
39
40                        desc.addResourceUnit(units);
41                        desc.setQueuesSize(managementSystem.getQueuesSize());
42                        IO_data data = new IO_data(desc, 0, ev.get_src());
43                        send(ev.get_src(), GridSimTags.SCHEDULE_NOW, GssimTags.QUERY_RESOURCE_DESC_RESULT, data);
44                        break;
45
46                default:
47                        managementSystem.processEvent(ev);
48                        break;
49                }
50        }
51       
52}
Note: See TracBrowser for help on using the repository browser.