Ignore:
Timestamp:
11/26/13 11:56:07 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ResourceFactory.java

    r1095 r1207  
    11package schedframe.resources.computing; 
    22 
    3 import schedframe.resources.CoolEmAllResourceType; 
    43import schedframe.resources.StandardResourceType; 
    54import schedframe.resources.computing.description.ComputingResourceDescription; 
    6 import schedframe.resources.computing.recs.ComputeBox1; 
    7 import schedframe.resources.computing.recs.Node; 
    8 import schedframe.resources.computing.recs.NodeGroup; 
    95import schedframe.scheduling.Scheduler; 
    106import schedframe.scheduling.manager.resources.ManagedResources; 
    117import schedframe.scheduling.plugin.SchedulingPlugin; 
    128import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; 
    13 import schedframe.scheduling.policy.AbstractManagementSystem; 
    14 import schedframe.scheduling.policy.global.GridBroker; 
    15 import schedframe.scheduling.policy.local.LocalManagementSystem; 
    169import schedframe.scheduling.queue.TaskQueueList; 
    17 import simulator.DCWormsConstants; 
    1810 
    1911 
    20 public class ResourceFactory { 
     12public interface ResourceFactory { 
    2113 
    22         public static ComputingResource createResource(ComputingResourceDescription resDesc){ 
    23                  
    24                 if (resDesc.getType().equals(StandardResourceType.DataCenter)) 
    25                         return new DataCenter(resDesc); 
    26                 else if (resDesc.getType().equals(StandardResourceType.Rack)) 
    27                         return new Rack(resDesc); 
    28                 else if (resDesc.getType().equals(StandardResourceType.ComputingNode)) 
    29                         return new ComputingNode(resDesc); 
    30                 else if (resDesc.getType().equals(StandardResourceType.Processor)) 
    31                         return new Processor(resDesc); 
    32                 else if (resDesc.getType().equals(StandardResourceType.Core)) 
    33                         return new Core(resDesc); 
    34                 else if (resDesc.getType().equals(CoolEmAllResourceType.ComputeBox1)) 
    35                         return new ComputeBox1(resDesc); 
    36                 else if (resDesc.getType().equals(CoolEmAllResourceType.NodeGroup)) 
    37                         return new NodeGroup(resDesc); 
    38                 else if (resDesc.getType().equals(CoolEmAllResourceType.Node)) 
    39                         return new Node(resDesc); 
    40                 else if (resDesc.getType().equals(CoolEmAllResourceType.Processor)) 
    41                         return new Processor(resDesc); 
    42                 else if (resDesc.getType().equals(CoolEmAllResourceType.Core)) 
    43                         return new Core(resDesc); 
    44                 else 
    45                         return new ComputingResource(resDesc); 
     14        public ComputingResource createComputingResource(ComputingResourceDescription resDesc); 
     15 
     16        //public Device createDevice(DeviceDescription devDesc); 
    4617         
    47                 /*switch(resDesc.getType()){ 
    48                         case Grid: return new Grid(resDesc); 
    49                         case DataCenter: return new DataCenter(resDesc); 
    50                         case ComputingNode: return new ComputingNode(resDesc); 
    51                         case Processor: return new Processor(resDesc); 
    52                 default: 
    53                         return new ComputingResource(resDesc); 
    54                 }*/ 
    55         } 
    56  
    57         public static Scheduler createScheduler(StandardResourceType type, String id, SchedulingPlugin schedulingPlugin, ExecutionTimeEstimationPlugin execTimeEstimationPlugin, TaskQueueList queues, ManagedResources managedResources) throws Exception{ 
    58                 AbstractManagementSystem ms; 
    59                 switch(type){ 
    60                         case GS: { 
    61                                 ms = new GridBroker("grid", 
    62                                                 schedulingPlugin, execTimeEstimationPlugin, queues); 
    63                                 return new Scheduler(ms, type, managedResources); 
    64                         } 
    65                         case LS: { 
    66                                 ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM, 
    67                                                 schedulingPlugin, execTimeEstimationPlugin, queues); 
    68                                 return new Scheduler(ms, type, managedResources); 
    69                         } 
    70  
    71                 default:{ 
    72                                 ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM, 
    73                                                 schedulingPlugin, execTimeEstimationPlugin, queues); 
    74                                 return new Scheduler(ms, type, managedResources); 
    75                         } 
    76                 } 
    77         } 
     18        public Scheduler createScheduler(StandardResourceType type, String id, SchedulingPlugin schedulingPlugin, ExecutionTimeEstimationPlugin execTimeEstimationPlugin, TaskQueueList queues, ManagedResources managedResources) throws Exception; 
    7819} 
    7920 
Note: See TracChangeset for help on using the changeset viewer.