1 | package schedframe.resources.computing.profiles.energy.power; |
---|
2 | |
---|
3 | import schedframe.resources.StandardResourceType; |
---|
4 | import schedframe.resources.UserResourceType; |
---|
5 | import schedframe.resources.computing.ComputingResource; |
---|
6 | import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; |
---|
7 | |
---|
8 | public class PowerInterfaceFactory { |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | //new1 |
---|
13 | /*public static PowerInterface createPowerProfile(ResourceType resourceType, List<PowerState> powerStates, List<PState> pStates, String eepn){ |
---|
14 | |
---|
15 | PowerInterface powerProfile; |
---|
16 | |
---|
17 | switch(resourceType){ |
---|
18 | case DataCenter: powerProfile = new DataCenterPowerInterfaceNew(eepn, powerStates); break; |
---|
19 | case ComputingNode: powerProfile = new ComputingNodePowerInterfaceNew(eepn, powerStates); break; |
---|
20 | case Processor: powerProfile = new CPUPowerInterfaceNew(eepn, powerStates, pStates); break; |
---|
21 | default: |
---|
22 | throw new IllegalArgumentException("ResourceType " + resourceType + " is not supported."); |
---|
23 | } |
---|
24 | |
---|
25 | return powerProfile; |
---|
26 | }*/ |
---|
27 | |
---|
28 | public static PowerInterface createPowerInterface(ComputingResource resource, PowerProfile pp){ |
---|
29 | if(pp == null) |
---|
30 | return null; |
---|
31 | PowerInterface powerInterface; |
---|
32 | |
---|
33 | if(resource.getType().getName().equals(StandardResourceType.DataCenter.getName())) |
---|
34 | powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.DataCenterPowerInterface(resource, pp); |
---|
35 | else if (resource.getType().getName().equals(StandardResourceType.ComputingNode.getName())) |
---|
36 | powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface(resource, pp); |
---|
37 | else if (resource.getType().getName().equals(StandardResourceType.Processor.getName())) |
---|
38 | powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface(resource, pp); |
---|
39 | else if (resource.getType().getName().equals(new UserResourceType("Node").getName())) |
---|
40 | powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface(resource, pp); |
---|
41 | else |
---|
42 | powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingResourcePowerInterface(resource, pp); |
---|
43 | |
---|
44 | /*switch(resource.getType()){ |
---|
45 | case DataCenter: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.DataCenterPowerInterfaceNew(resource, pp); break; |
---|
46 | case ComputingNode: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.ComputingNodePowerInterfaceNew(resource, pp); break; |
---|
47 | case Processor: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.CPUPowerInterfaceNew(resource, pp); break; |
---|
48 | default: |
---|
49 | throw new IllegalArgumentException("ResourceType " + resource.getType() + " is not supported."); |
---|
50 | }*/ |
---|
51 | |
---|
52 | return powerInterface; |
---|
53 | } |
---|
54 | } |
---|