blob: 5da4abddcb8f62dd4220fe274a78cd694f65bac7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Read-Only HDFS Virtual File Driver (VFD) *
* Copyright (c) 2018, The HDF Group. *
* *
* All rights reserved. *
* *
* NOTICE: *
* All information contained herein is, and remains, the property of The HDF *
* Group. The intellectual and technical concepts contained herein are *
* proprietary to The HDF Group. Dissemination of this information or *
* reproduction of this material is strictly forbidden unless prior written *
* permission is obtained from The HDF Group. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package hdf.hdf5lib.structs;
import java.io.Serializable;
/**
* Java representation of the HDFS VFD file access property list (fapl)
* structure.
*
* Used for the access of files hosted on the Hadoop Distributed File System.
*/
public class H5FD_hdfs_fapl_t implements Serializable {
private static final long serialVersionUID = 2072473407027648309L;
/** Version number of the H5FD_hdfs_fapl_t structure. */
private int version;
/** Name of "Name Node" to access as the HDFS server. */
private String namenode_name;
/** Port number to use to connect with Name Node. */
private int namenode_port;
/** Username to use when accessing file. */
private String user_name;
/** Path to the location of the Kerberos authentication cache. */
private String kerberos_ticket_cache;
/** Size (in bytes) of the file read stream buffer. */
private int stream_buffer_size;
/**
* Create a fapl_t structure with the specified components.
* @param namenode_name
* Name of "Name Node" to access as the HDFS server.
* @param namenode_port
* Port number to use to connect with Name Node.
* @param user_name
* Username to use when accessing file.
* @param kerberos_ticket_cache
* Path to the location of the Kerberos authentication cache.
* @param stream_buffer_size
* Size (in bytes) of the file read stream buffer.
*/
public H5FD_hdfs_fapl_t(
String namenode_name,
int namenode_port,
String user_name,
String kerberos_ticket_cache,
int stream_buffer_size)
{
this.version = 1;
this.namenode_name = namenode_name;
this.namenode_port = namenode_port;
this.user_name = user_name;
this.kerberos_ticket_cache = kerberos_ticket_cache;
this.stream_buffer_size = stream_buffer_size;
}
@Override
public boolean equals(Object o) {
if (o == null)
return false;
if (!(o instanceof H5FD_hdfs_fapl_t))
return false;
H5FD_hdfs_fapl_t other = (H5FD_hdfs_fapl_t)o;
if (this.version != other.version)
return false;
if (!this.namenode_name.equals(other.namenode_name))
return false;
if (this.namenode_port != other.namenode_port)
return false;
if (!this.user_name.equals(other.user_name))
return false;
if (!this.kerberos_ticket_cache.equals(other.kerberos_ticket_cache))
return false;
if (this.stream_buffer_size != other.stream_buffer_size)
return false;
return true;
}
@Override
public int hashCode() {
/* this is a _very bad_ hash algorithm for purposes of hashing! */
/* implemented to satisfy the "contract" regarding equality */
int k = (int)this.version;
k += this.namenode_name.length();
k += this.user_name.length();
k += this.kerberos_ticket_cache.length();
k += namenode_port;
k += stream_buffer_size;
return k;
}
@Override
public String toString() {
return "H5FD_hdfs_fapl_t (Version: " + this.version + ") {" +
"\n namenode_name: '" + this.namenode_name +
"'\n namenode_port: " + this.namenode_port +
"\n user_name: '" + this.user_name +
"'\n kerberos_ticket_cache: '" + this.kerberos_ticket_cache +
"'\n stream_buffer_size: " + this.stream_buffer_size +
"\n}\n";
}
}
|