source: xssim/trunk/src/test/rewolucja/resources/manager/implementation/ClusterResourceManager.java @ 200

Revision 200, 1.4 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.rewolucja.resources.manager.implementation;
2
3import java.util.ArrayList;
4import java.util.List;
5import java.util.Properties;
6
7import test.rewolucja.resources.ResourceType;
8import test.rewolucja.resources.exception.ResourceException;
9import test.rewolucja.resources.logical.LogicalResource;
10
11import test.rewolucja.resources.physical.base.ComputingResource;
12import test.rewolucja.resources.physical.implementation.Processor;
13import test.rewolucja.resources.physical.implementation.ComputingNode;
14
15public 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<Processor> getProcessors(){
33                try {
34                        return (List<Processor>) getResourcesOfType(ResourceType.CPU);
35                } catch (Exception e) {
36                        return new ArrayList<Processor>();
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}
Note: See TracBrowser for help on using the repository browser.