package schedframe.resources.computing.profiles.energy.power; import schedframe.resources.StandardResourceType; import schedframe.resources.computing.ComputingResource; import schedframe.resources.computing.profiles.energy.power.ui.ComputingResourcePowerInterface; import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; import schedframe.resources.devices.Device; import schedframe.resources.devices.DevicePowerInterface; import schedframe.resources.devices.PhysicalResource; public class PowerInterfaceFactory { public static PowerInterface createPowerInterface(PhysicalResource resource, PowerProfile pp){ if(pp == null) return null; PowerInterface powerInterface; if(resource.getType().getName().equals(StandardResourceType.DataCenter.getName())) powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.DataCenterPowerInterface((ComputingResource)resource, pp); else if (resource.getType().getName().equals(StandardResourceType.Node.getName())) powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.NodePowerInterface((ComputingResource)resource, pp); else if (resource.getType().getName().equals(StandardResourceType.Processor.getName())) powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface((ComputingResource)resource, pp); else if (resource.getType().getName().equals(StandardResourceType.CRAH.getName())) powerInterface = new DevicePowerInterface(resource, pp); else if (resource.getType().getName().equals(StandardResourceType.Fan.getName())) powerInterface = new DevicePowerInterface(resource, pp); else if (resource.getType().getName().equals(StandardResourceType.Inlet.getName())) powerInterface = new DevicePowerInterface(resource, pp); else if (resource.getType().getName().equals(StandardResourceType.Outlet.getName())) powerInterface = new DevicePowerInterface(resource, pp); else if (resource.getType().getName().equals(StandardResourceType.CoolingDevice.getName())) powerInterface = new DevicePowerInterface(resource, pp); else if (resource.getType().getName().equals(StandardResourceType.Heatsink.getName())) powerInterface = new DevicePowerInterface(resource, pp); else if (resource instanceof Device) powerInterface = new DevicePowerInterface(resource, pp); else powerInterface = new ComputingResourcePowerInterface((ComputingResource)resource, pp); /*switch(resource.getType()){ case DataCenter: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.DataCenterPowerInterfaceNew(resource, pp); break; case ComputingNode: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.ComputingNodePowerInterfaceNew(resource, pp); break; case Processor: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.CPUPowerInterfaceNew(resource, pp); break; default: throw new IllegalArgumentException("ResourceType " + resource.getType() + " is not supported."); }*/ return powerInterface; } }