source: DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/power/PowerInterfaceFactory.java @ 788

Revision 788, 2.7 KB checked in by wojtekp, 12 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.resources.computing.profiles.energy.power;
2
3import schedframe.resources.StandardResourceType;
4import schedframe.resources.UserResourceType;
5import schedframe.resources.computing.ComputingResource;
6import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
7
8public 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}
Note: See TracBrowser for help on using the repository browser.