01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15: package org.griphyn.cPlanner.selector.site;
16:
17: import org.griphyn.cPlanner.classes.ADag;
18: import org.griphyn.cPlanner.classes.PegasusBag;
19:
20: import org.griphyn.cPlanner.common.LogManager;
21:
22: import org.griphyn.cPlanner.common.PegasusProperties;
23:
24: import org.griphyn.cPlanner.partitioner.graph.Adapter;
25:
26: import org.griphyn.cPlanner.selector.SiteSelector;
27:
28: import org.griphyn.cPlanner.poolinfo.PoolInfoProvider;
29:
30: import org.griphyn.common.catalog.transformation.Mapper;
31:
32: import java.util.List;
33:
34: /**
35: * The Abstract Site selector.
36: *
37: * @author Karan Vahi
38: * @author Jens-S. Vöckler
39: * @author Gaurang Mehta
40: *
41: *
42: * @version $Revision: 298 $
43: */
44: public abstract class Abstract implements SiteSelector {
45:
46: /**
47: * The properties passed to Pegasus at runtime.
48: */
49: protected PegasusProperties mProps;
50:
51: /**
52: * The handle to the logger.
53: */
54: protected LogManager mLogger;
55:
56: /**
57: * The handle to the site catalog.
58: */
59: protected PoolInfoProvider mSCHandle;
60:
61: /**
62: * The handle to the TCMapper object.
63: */
64: protected Mapper mTCMapper;
65:
66: /**
67: * The bag of Pegasus objects.
68: */
69: protected PegasusBag mBag;
70:
71: /**
72: * Initializes the site selector.
73: *
74: * @param bag the bag of objects that is useful for initialization.
75: *
76: */
77: public void initialize(PegasusBag bag) {
78: mBag = bag;
79: mProps = (PegasusProperties) bag
80: .get(PegasusBag.PEGASUS_PROPERTIES);
81: mLogger = (LogManager) bag.get(PegasusBag.PEGASUS_LOGMANAGER);
82: mSCHandle = (PoolInfoProvider) bag.get(PegasusBag.SITE_CATALOG);
83: mTCMapper = (Mapper) bag.get(PegasusBag.TRANSFORMATION_MAPPER);
84: }
85:
86: /**
87: * Maps the jobs in the workflow to the various grid sites.
88: * The jobs are mapped by setting the site handle for the jobs.
89: *
90: * @param workflow the workflow.
91: *
92: * @param sites the list of <code>String</code> objects representing the
93: * execution sites that can be used.
94: */
95: public void mapWorkflow(ADag workflow, List sites) {
96: mapWorkflow(Adapter.convert(workflow), sites);
97: }
98:
99: }
|