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; |
---|
9 | import test.rewolucja.resources.logical.LogicalResource; |
---|
10 | |
---|
11 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
12 | import test.rewolucja.resources.physical.implementation.CPU; |
---|
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") |
---|
32 | public List<CPU> getProcessors(){ |
---|
33 | try { |
---|
34 | return (List<CPU>) getResourcesOfType(ResourceType.CPU); |
---|
35 | } catch (Exception e) { |
---|
36 | return new ArrayList<CPU>(); |
---|
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 | } |
---|