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:
16: package org.griphyn.vdl.util;
17:
18: import org.griphyn.vdl.classes.*;
19:
20: /**
21: * This class returns pre-defined type values given the corresponding
22: * strings defined in the XML schema. It is used by
23: * <code>VDLContentHandler</code> to convert string-valued type in XML
24: * document to number-valued type in java objects.
25: *
26: * @author Jens-S. Vöckler
27: * @author Yong Zhao
28: * @version $Revision: 50 $
29: *
30: * @see org.griphyn.vdl.parser.VDLContentHandler
31: *
32: */
33: public class VDLType {
34: /**
35: * Get the container type, it is either SCALAR or LIST
36: *
37: * @param container is the containerType string
38: * @return the constant corresponded to the container type
39: *
40: * @see org.griphyn.vdl.classes.Value
41: */
42: static public int getContainerType(String container) {
43: if (container.equals("list"))
44: return Value.LIST;
45: else
46: return Value.SCALAR;
47: }
48:
49: /**
50: * Get the linkage type of a LFN, which can be INPUT, OUTPUT,
51: * INOUT and NONE.
52: *
53: * @param link is the linkType string
54: * @return the constant corresponded to the string
55: *
56: * @see org.griphyn.vdl.classes.LFN
57: */
58: static public int getLinkType(String link) {
59: if (link.equals("input"))
60: return LFN.INPUT;
61:
62: if (link.equals("output"))
63: return LFN.OUTPUT;
64:
65: if (link.equals("inout"))
66: return LFN.INOUT;
67:
68: return LFN.NONE;
69: }
70:
71: /**
72: * Get the constant for Condor universe
73: *
74: * @param universe is the string for condor universe
75: * @return the constant corresponded to the string
76: *
77: * @see org.griphyn.vdl.classes.Executable
78: */
79: static public int getUniverse(String universe) {
80: if (universe.equals("standard"))
81: return Executable.CONDOR_STANDARD;
82: if (universe.equals("scheduler"))
83: return Executable.CONDOR_SCHEDULER;
84: if (universe.equals("globus"))
85: return Executable.CONDOR_GLOBUS;
86: if (universe.equals("pvm"))
87: return Executable.CONDOR_PVM;
88: if (universe.equals("mpi"))
89: return Executable.CONDOR_MPI;
90:
91: return Executable.CONDOR_VANILLA;
92: }
93: }
|