1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.giraph.jython;
19
20 import org.apache.giraph.conf.BooleanConfOption;
21 import org.apache.giraph.conf.EnumConfOption;
22 import org.apache.giraph.conf.StrConfOption;
23 import org.apache.giraph.graph.GraphType;
24 import org.apache.giraph.graph.Language;
25
26
27
28
29 public class JythonOptions {
30
31 public static class JythonGraphTypeOptions {
32
33 private final GraphType graphType;
34
35 private final StrConfOption jythonClassNameOption;
36
37 private final BooleanConfOption needsWrapperOption;
38
39 private final EnumConfOption<Language> languageOption;
40
41
42
43
44
45
46 public JythonGraphTypeOptions(GraphType graphType) {
47 this.graphType = graphType;
48 jythonClassNameOption = new StrConfOption("giraph.jython." +
49 graphType.dotString() + ".class.name", null,
50 "Name of class in Jython implementing " + graphType.spaceString());
51 needsWrapperOption = new BooleanConfOption("giraph.jython." +
52 graphType.dotString() + ".needs.wrapper", false,
53 "Whether the " + graphType.spaceString() +
54 " jython type needs a wrapper");
55 languageOption = EnumConfOption.create("giraph." +
56 graphType.dotString() + ".language", Language.class, Language.JAVA,
57 "Language " + graphType.spaceString() + " is implemented in");
58 }
59
60 public GraphType getGraphType() {
61 return graphType;
62 }
63
64 public BooleanConfOption getNeedsWrapperOption() {
65 return needsWrapperOption;
66 }
67
68 public StrConfOption getJythonClassNameOption() {
69 return jythonClassNameOption;
70 }
71
72 private EnumConfOption<Language> getLanguageOption() {
73 return languageOption;
74 }
75 }
76
77
78 public static final JythonGraphTypeOptions JYTHON_VERTEX_ID =
79 new JythonGraphTypeOptions(GraphType.VERTEX_ID);
80
81
82 public static final JythonGraphTypeOptions JYTHON_VERTEX_VALUE =
83 new JythonGraphTypeOptions(GraphType.VERTEX_VALUE);
84
85
86 public static final JythonGraphTypeOptions JYTHON_EDGE_VALUE =
87 new JythonGraphTypeOptions(GraphType.EDGE_VALUE);
88
89
90 public static final JythonGraphTypeOptions JYTHON_OUT_MSG_VALUE =
91 new JythonGraphTypeOptions(GraphType.OUTGOING_MESSAGE_VALUE);
92
93
94 public static final StrConfOption JYTHON_COMPUTATION_CLASS_NAME =
95 new StrConfOption("giraph.jython.class", null,
96 "Name of Computation class in Jython script");
97
98
99 private JythonOptions() { }
100 }