[104] | 1 | package test.rewolucja.resources.manager.implementation; |
---|
| 2 | |
---|
| 3 | import java.util.ArrayList; |
---|
| 4 | import java.util.List; |
---|
| 5 | import java.util.Properties; |
---|
| 6 | |
---|
| 7 | import test.rewolucja.resources.ResourceType; |
---|
| 8 | import test.rewolucja.resources.exception.ResourceException; |
---|
[224] | 9 | import test.rewolucja.resources.logical.base.LogicalResource; |
---|
[104] | 10 | |
---|
| 11 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
[200] | 12 | import test.rewolucja.resources.physical.implementation.Processor; |
---|
[104] | 13 | import test.rewolucja.resources.physical.implementation.ComputingNode; |
---|
| 14 | |
---|
| 15 | public class ClusterResourceManager extends ResourceManager{ |
---|
| 16 | |
---|
| 17 | public ClusterResourceManager(List<ComputingResource> resources, List<LogicalResource> logicalLayers) { |
---|
| 18 | super(resources, logicalLayers); |
---|
| 19 | // TODO Auto-generated constructor stub |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | @SuppressWarnings("unchecked") |
---|
| 23 | public List<ComputingNode> getComputingNodes(){ |
---|
| 24 | try { |
---|
| 25 | return (List<ComputingNode>) getResourcesOfType(ResourceType.COMPUTING_NODE); |
---|
| 26 | } catch (ResourceException e) { |
---|
| 27 | return new ArrayList<ComputingNode>(); |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | @SuppressWarnings("unchecked") |
---|
[200] | 32 | public List<Processor> getProcessors(){ |
---|
[104] | 33 | try { |
---|
[200] | 34 | return (List<Processor>) getResourcesOfType(ResourceType.CPU); |
---|
[104] | 35 | } catch (Exception e) { |
---|
[200] | 36 | return new ArrayList<Processor>(); |
---|
[104] | 37 | } |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | @SuppressWarnings("unchecked") |
---|
| 41 | public List<ComputingNode> getComputingNodes(Properties properties){ |
---|
| 42 | properties.setProperty("type", ResourceType.COMPUTING_NODE.toString()); |
---|
| 43 | return (List<ComputingNode>) filterResources(properties); |
---|
| 44 | |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | } |
---|