Appease the forbidden APIs task
Original commit: elastic/x-pack-elasticsearch@4a392aa110
This commit is contained in:
parent
f9da0b147f
commit
479326f68b
|
@ -17,13 +17,16 @@ public class InfoRequest extends Request {
|
||||||
|
|
||||||
public final String jvmVersion, jvmVendor, jvmClassPath, osName, osVersion;
|
public final String jvmVersion, jvmVendor, jvmClassPath, osName, osVersion;
|
||||||
|
|
||||||
public InfoRequest(Properties props) {
|
/**
|
||||||
|
* Build the info request containing information about the current JVM.
|
||||||
|
*/
|
||||||
|
public InfoRequest() {
|
||||||
super(Action.INFO);
|
super(Action.INFO);
|
||||||
jvmVersion = props.getProperty("java.version", EMPTY);
|
jvmVersion = System.getProperty("java.version", EMPTY);
|
||||||
jvmVendor = props.getProperty("java.vendor", EMPTY);
|
jvmVendor = System.getProperty("java.vendor", EMPTY);
|
||||||
jvmClassPath = props.getProperty("java.class.path", EMPTY);
|
jvmClassPath = System.getProperty("java.class.path", EMPTY);
|
||||||
osName = props.getProperty("os.name", EMPTY);
|
osName = System.getProperty("os.name", EMPTY);
|
||||||
osVersion = props.getProperty("os.version", EMPTY);
|
osVersion = System.getProperty("os.version", EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfoRequest(String jvmVersion, String jvmVendor, String jvmClassPath, String osName, String osVersion) {
|
public InfoRequest(String jvmVersion, String jvmVendor, String jvmClassPath, String osName, String osVersion) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class CliHttpClient implements AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Response serverInfo() {
|
public Response serverInfo() {
|
||||||
Bytes ba = http.put(out -> ProtoUtils.write(out, new InfoRequest(System.getProperties())));
|
Bytes ba = http.put(out -> ProtoUtils.write(out, new InfoRequest()));
|
||||||
return doIO(ba, in -> readResponse(in, Action.INFO));
|
return doIO(ba, in -> readResponse(in, Action.INFO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,20 +10,22 @@ import org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.Action;
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import static org.elasticsearch.xpack.sql.jdbc.net.protocol.StringUtils.EMPTY;
|
import static org.elasticsearch.xpack.sql.jdbc.net.protocol.StringUtils.EMPTY;
|
||||||
|
|
||||||
public class InfoRequest extends Request {
|
public class InfoRequest extends Request {
|
||||||
public final String jvmVersion, jvmVendor, jvmClassPath, osName, osVersion;
|
public final String jvmVersion, jvmVendor, jvmClassPath, osName, osVersion;
|
||||||
|
|
||||||
public InfoRequest(Properties props) {
|
/**
|
||||||
|
* Build the info request containing information about the current JVM.
|
||||||
|
*/
|
||||||
|
public InfoRequest() {
|
||||||
super(Action.INFO);
|
super(Action.INFO);
|
||||||
jvmVersion = props.getProperty("java.version", EMPTY);
|
jvmVersion = System.getProperty("java.version", EMPTY);
|
||||||
jvmVendor = props.getProperty("java.vendor", EMPTY);
|
jvmVendor = System.getProperty("java.vendor", EMPTY);
|
||||||
jvmClassPath = props.getProperty("java.class.path", EMPTY);
|
jvmClassPath = System.getProperty("java.class.path", EMPTY);
|
||||||
osName = props.getProperty("os.name", EMPTY);
|
osName = System.getProperty("os.name", EMPTY);
|
||||||
osVersion = props.getProperty("os.version", EMPTY);
|
osVersion = System.getProperty("os.version", EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfoRequest(String jvmVersion, String jvmVendor, String jvmClassPath, String osName, String osVersion) {
|
public InfoRequest(String jvmVersion, String jvmVendor, String jvmClassPath, String osName, String osVersion) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class JdbcHttpClient implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private InfoResponse fetchServerInfo() throws SQLException {
|
private InfoResponse fetchServerInfo() throws SQLException {
|
||||||
BytesArray ba = http.put(out -> ProtoUtils.write(out, new InfoRequest(System.getProperties())));
|
BytesArray ba = http.put(out -> ProtoUtils.write(out, new InfoRequest()));
|
||||||
return doIO(ba, in -> readResponse(in, Action.INFO));
|
return doIO(ba, in -> readResponse(in, Action.INFO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue