-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxyEnvironment.java
More file actions
107 lines (81 loc) · 2.18 KB
/
ProxyEnvironment.java
File metadata and controls
107 lines (81 loc) · 2.18 KB
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
// Copyright (c) 2019-2020 Nicholas Corgan
// SPDX-License-Identifier: BSL-1.0
package Pothos;
public class ProxyEnvironment
{
static
{
LoadNative.loadNative();
}
private long nativeHandle;
public ProxyEnvironment(String name)
{
nativeHandle = allocateJNI(name);
}
public ProxyEnvironment(
String name,
java.util.HashMap proxyEnvironmentArgs)
{
nativeHandle = allocateJNI(name, proxyEnvironmentArgs);
}
public ProxyEnvironment(long handle)
{
nativeHandle = handle;
}
public String getNodeId()
{
return getNodeIdJNI(nativeHandle);
}
public String getUniquePid()
{
return getUniquePidJNI(nativeHandle);
}
public String getPeeringAddress()
{
return getPeeringAddressJNI(nativeHandle);
}
public String getName()
{
return getNameJNI(nativeHandle);
}
public Proxy findProxy(String name)
{
return new Proxy(findProxyJNI(nativeHandle, name));
}
@Override
public String toString()
{
return getName();
}
@Override
public int hashCode()
{
return hashCodeJNI(nativeHandle);
}
@Override
public boolean equals(Object obj)
{
if(this == obj)
{
return true;
}
else if(!(obj instanceof ProxyEnvironment))
{
return false;
}
return equalsJNI(nativeHandle, ((ProxyEnvironment)obj).nativeHandle);
}
//
// JNI below
//
public static native String getLocalUniquePid();
private static native String getNodeIdJNI(long handle);
private static native String getUniquePidJNI(long handle);
private static native String getPeeringAddressJNI(long handle);
private static native String getNameJNI(long handle);
private static native long findProxyJNI(long handle, String name);
private static native int hashCodeJNI(long handle);
private static native boolean equalsJNI(long handle1, long handle2);
private static native long allocateJNI(String name);
private static native long allocateJNI(String name, java.util.HashMap proxyEnvironmentArgs);
}