Project

General

Profile

1
package eu.dnetlib.rmi.data;
2

    
3
import java.util.Arrays;
4
import java.util.HashSet;
5
import java.util.List;
6
import java.util.Set;
7
import java.util.stream.Collectors;
8

    
9
/**
10
 * Enum of supported hadoop job types.
11
 *
12
 * @author claudio
13
 */
14
public enum HadoopJobType {
15

    
16
	/**
17
	 * The mapreduce.
18
	 */
19
	mapreduce,
20

    
21
	/**
22
	 * The admin.
23
	 */
24
	admin,
25

    
26
	/**
27
	 * The oozie.
28
	 */
29
	oozie;
30

    
31
	/**
32
	 * The Enum AdminJobType.
33
	 */
34
	public enum AdminJobType {
35

    
36
		/**
37
		 * The copytable job.
38
		 * <p>
39
		 * <pre>
40
		 * {@code
41
		 * bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --starttime=1265875194289 --endtime=1265878794289
42
		 * --peer.adr=server1,server2,server3:2181:/hbase --families=myOldCf:myNewCf,cf2,cf3 TestTable <code>
43
		 *
44
		 * Options:
45
		 * rs.class     hbase.regionserver.class of the peer cluster,
46
		 *              specify if different from current cluster
47
		 * rs.impl      hbase.regionserver.impl of the peer cluster,
48
		 * startrow     the start row
49
		 * stoprow      the stop row
50
		 * starttime    beginning of the time range (unixtime in millis)
51
		 *              without endtime means from starttime to forever
52
		 * endtime      end of the time range.  Ignored if no starttime specified.
53
		 * versions     number of cell versions to copy
54
		 * new.name     new table's name
55
		 * peer.adr     Address of the peer cluster given in the format
56
		 *              hbase.zookeeer.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent
57
		 * families     comma-separated list of families to copy
58
		 *              To copy from cf1 to cf2, give sourceCfName:destCfName.
59
		 *              To keep the same name, just give "cfName"
60
		 * all.cells    also copy delete markers and deleted cells
61
		 *
62
		 * Args:
63
		 * tablename    Name of the table to copy
64
		 * }
65
		 * </pre>
66
		 */
67
		copytable;
68

    
69
		public static Set<String> asStringSet() {
70
			return new HashSet<>(asStringList());
71
		}
72

    
73
		public static List<String> asStringList() {
74
			return asList().stream().map(it -> it.toString()).collect(Collectors.toList());
75

    
76
		}
77

    
78
		public static List<AdminJobType> asList() {
79
			return Arrays.asList(AdminJobType.values());
80
		}
81

    
82
	}
83
}
(20-20/40)