home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.IOException;
- import java.util.Vector;
- import symjava.sql.SQLException;
-
- public class ServerAdmin extends Requester {
- // $FF: renamed from: _v java.util.Vector
- Vector field_0;
- int _mode;
- NetString _reqStr;
-
- public ServerAdmin(ClientSession sess) {
- super(sess);
- }
-
- public Vector ping(String echo, int reps) throws SQLException {
- this.field_0 = null;
- this._mode = 0;
- this._reqStr = new NetString("admin" + super._reqDelim + "ping" + super._reqDelim + echo + super._reqDelim + reps);
- ((Requester)this).execute();
- if (this.field_0 == null) {
- throw new SQLException("Server ping failed.");
- } else {
- return this.field_0;
- }
- }
-
- public Vector getConnectList() throws SQLException {
- this.field_0 = null;
- this._mode = 1;
- this._reqStr = new NetString("admin" + super._reqDelim + "getConnectList");
- ((Requester)this).execute();
- if (this.field_0 == null) {
- throw new SQLException("Error getting server connection list.");
- } else {
- return this.field_0;
- }
- }
-
- public Vector getConnectDetails(int connectionID) throws SQLException {
- this.field_0 = null;
- this._mode = 2;
- this._reqStr = new NetString("admin" + super._reqDelim + "getConnectDetails" + super._reqDelim + connectionID);
- ((Requester)this).execute();
- if (this.field_0 == null) {
- throw new SQLException("Error getting Connection details.");
- } else {
- return this.field_0;
- }
- }
-
- public Vector getServerStats() throws SQLException {
- this.field_0 = null;
- this._mode = 3;
- this._reqStr = new NetString("admin" + super._reqDelim + "getSrvStats");
- ((Requester)this).execute();
- if (this.field_0 == null) {
- throw new SQLException("Error getting server statistics.");
- } else {
- return this.field_0;
- }
- }
-
- public void accept(boolean on) throws SQLException {
- this._mode = 4;
- String s = new String(on ? "yes" : "no");
- this._reqStr = new NetString("admin" + super._reqDelim + "accept" + super._reqDelim + s);
- ((Requester)this).execute();
- }
-
- public ServerConfig getConfig() throws SQLException {
- this.field_0 = null;
- this._mode = 5;
- this._reqStr = new NetString("admin,getConfig");
- ((Requester)this).execute();
- if (this.field_0 != null && this.field_0.size() >= 6) {
- ServerConfig sc = new ServerConfig();
- sc._bAllowRemoteAdmin = ((String)this.field_0.elementAt(0)).equals("true");
- sc._bAllowDebug = ((String)this.field_0.elementAt(1)).equals("true");
- sc._traceRequests = ((String)this.field_0.elementAt(2)).equals("true");
- sc._traceObjects = ((String)this.field_0.elementAt(3)).equals("true");
- sc._traceBytesRead = ((String)this.field_0.elementAt(4)).equals("true");
- sc._traceBytesWritten = ((String)this.field_0.elementAt(5)).equals("true");
- return sc;
- } else {
- throw new SQLException("Error getting config.");
- }
- }
-
- public void setConfig(ServerConfig sc) throws SQLException {
- this._mode = 4;
- this._reqStr = new NetString("admin,setConfig," + sc._traceRequests + super._reqDelim + sc._traceObjects + super._reqDelim + sc._traceBytesRead + super._reqDelim + sc._traceBytesWritten);
- ((Requester)this).execute();
- }
-
- public Vector trace(int connectionID) throws SQLException {
- this.field_0 = null;
- this._mode = 5;
- this._reqStr = new NetString("admin" + super._reqDelim + "trace" + super._reqDelim + connectionID);
- ((Requester)this).execute();
- if (this.field_0 == null) {
- throw new SQLException("Error tracing connection.");
- } else {
- return this.field_0;
- }
- }
-
- public void debug(String request) throws SQLException {
- this._mode = 6;
- this._reqStr = new NetString("debug," + request);
- ((Requester)this).execute();
- }
-
- public void kill(int connectionID) throws SQLException {
- this._mode = 6;
- this._reqStr = new NetString("admin" + super._reqDelim + "kill" + super._reqDelim + connectionID);
- ((Requester)this).execute();
- }
-
- protected void readResults(DataInputStream in) throws IOException, ErrorException, SQLException {
- ServerObject obj = (ServerObject)NetClass.getNextObject(in);
- if ((this._mode == 0 || this._mode == 1 || this._mode == 2 || this._mode == 3 || this._mode == 5) && obj.getType() == 54) {
- this.field_0 = ((ServerList)obj).toStringVector();
- } else if (this._mode != 4 && this._mode != 6 || obj.getType() != 51) {
- ((Requester)this).onObjectError(obj);
- }
- }
-
- protected void writeRequest(DataOutputStream out) throws IOException {
- this._reqStr.write(out);
- }
- }
-