source: xssim/trunk/src/test/rewolucja/scheduling/implementation/GridBroker.java @ 230

Revision 230, 2.2 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.rewolucja.scheduling.implementation;
2
3import java.util.ArrayList;
4import java.util.HashSet;
5import java.util.List;
6import java.util.Properties;
7import java.util.Set;
8
9import org.apache.commons.logging.Log;
10import org.apache.commons.logging.LogFactory;
11
12import schedframe.scheduling.plugin.estimation.ExecTimeEstimationPlugin;
13import schedframe.scheduling.plugin.grid.ModuleListImpl;
14import test.rewolucja.reservation.GridReservationManagerNew;
15import test.rewolucja.resources.description.ExecResourceDescription;
16import test.rewolucja.resources.logical.base.LogicalResource;
17import test.rewolucja.resources.manager.factory.ResourceManagerFactory;
18import test.rewolucja.scheduling.GridResourceDiscovery;
19
20public class GridBroker extends GlobalManagementSystem {
21
22       
23        private static Log log = LogFactory.getLog(GridBroker.class);
24
25        protected Set<Integer> otherGridSchedulersIds;
26
27
28        public GridBroker(String name, String schedulingPluginClassName, ExecTimeEstimationPlugin execTimeEstimationPlugin, ExecResourceDescription arc) throws Exception {
29                super(name, "BROKER",  schedulingPluginClassName, execTimeEstimationPlugin, arc);
30               
31                //make use of plug-in interface
32               
33                Properties prop = new Properties();
34                prop.put("plugin.name", name);
35                prop.put("plugin.utils.timeoperations", "gssim.scheduling.plugin.local.GssimTimeOperations");
36                schedulingPlugin.init(prop);
37                otherGridSchedulersIds = new HashSet<Integer>();
38               
39                moduleList = new ModuleListImpl(2);
40                //this.moduleList.add(new GridResourceDiscovery(this.getLogicalResource()));
41                moduleList.add(new GridReservationManagerNew(this));
42               
43                if(log.isDebugEnabled())
44                        log.debug(name + ": Creating a broker interface object");
45        }
46
47        public void init(LogicalResource logRes) {
48                logicalResource = logRes;
49                resourceManager = ResourceManagerFactory.createResourceManager(logicalResource);
50                moduleList.add((GridResourceDiscovery)resourceManager);
51        }
52
53        public List<Integer> getMyGridResources() {
54                List<Integer> providerIds = new ArrayList<Integer>();
55                for(LogicalResource logRes : logicalResource.getChildren()){
56                        providerIds.add(logRes.get_id());
57                }
58                return providerIds;
59                //return GridSim.getGridResourceList();
60        }
61
62        public void addOtherGridSchedulerId(int id){
63                otherGridSchedulersIds.add(id);
64        }
65       
66
67}
Note: See TracBrowser for help on using the repository browser.