[226] | 1 | package test.rewolucja.resources.logical.implementation; |
---|
| 2 | |
---|
| 3 | import eduni.simjava.Sim_event; |
---|
| 4 | import gridsim.GridSimTags; |
---|
| 5 | import gridsim.IO_data; |
---|
| 6 | import gridsim.gssim.GssimTags; |
---|
| 7 | |
---|
| 8 | import java.util.HashMap; |
---|
| 9 | import java.util.List; |
---|
| 10 | import java.util.Map; |
---|
| 11 | |
---|
| 12 | import schedframe.resources.ResourceStateDescription; |
---|
| 13 | import schedframe.resources.providers.LocalSystem; |
---|
| 14 | import schedframe.resources.units.ResourceUnit; |
---|
| 15 | import schedframe.scheduling.utils.ResourceParameterName; |
---|
| 16 | import test.rewolucja.resources.logical.base.LogicalResource; |
---|
| 17 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
| 18 | import test.rewolucja.scheduling.implementation.ManagementSystem; |
---|
| 19 | |
---|
| 20 | public 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 | } |
---|