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 | 0 | public JythonGraphTypeOptions(GraphType graphType) { |
47 | 0 | this.graphType = graphType; |
48 | 0 | jythonClassNameOption = new StrConfOption("giraph.jython." + |
49 | 0 | graphType.dotString() + ".class.name", null, |
50 | 0 | "Name of class in Jython implementing " + graphType.spaceString()); |
51 | 0 | needsWrapperOption = new BooleanConfOption("giraph.jython." + |
52 | 0 | graphType.dotString() + ".needs.wrapper", false, |
53 | 0 | "Whether the " + graphType.spaceString() + |
54 | |
" jython type needs a wrapper"); |
55 | 0 | languageOption = EnumConfOption.create("giraph." + |
56 | 0 | graphType.dotString() + ".language", Language.class, Language.JAVA, |
57 | 0 | "Language " + graphType.spaceString() + " is implemented in"); |
58 | 0 | } |
59 | |
|
60 | |
public GraphType getGraphType() { |
61 | 0 | return graphType; |
62 | |
} |
63 | |
|
64 | |
public BooleanConfOption getNeedsWrapperOption() { |
65 | 0 | return needsWrapperOption; |
66 | |
} |
67 | |
|
68 | |
public StrConfOption getJythonClassNameOption() { |
69 | 0 | return jythonClassNameOption; |
70 | |
} |
71 | |
|
72 | |
private EnumConfOption<Language> getLanguageOption() { |
73 | 0 | return languageOption; |
74 | |
} |
75 | |
} |
76 | |
|
77 | |
|
78 | 0 | public static final JythonGraphTypeOptions JYTHON_VERTEX_ID = |
79 | |
new JythonGraphTypeOptions(GraphType.VERTEX_ID); |
80 | |
|
81 | |
|
82 | 0 | public static final JythonGraphTypeOptions JYTHON_VERTEX_VALUE = |
83 | |
new JythonGraphTypeOptions(GraphType.VERTEX_VALUE); |
84 | |
|
85 | |
|
86 | 0 | public static final JythonGraphTypeOptions JYTHON_EDGE_VALUE = |
87 | |
new JythonGraphTypeOptions(GraphType.EDGE_VALUE); |
88 | |
|
89 | |
|
90 | 0 | public static final JythonGraphTypeOptions JYTHON_OUT_MSG_VALUE = |
91 | |
new JythonGraphTypeOptions(GraphType.OUTGOING_MESSAGE_VALUE); |
92 | |
|
93 | |
|
94 | 0 | 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 | 0 | private JythonOptions() { } |
100 | |
} |