mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
Server console - Some updates to Admin handling.
This commit is contained in:
parent
43e82b7a1a
commit
a6332e6505
6 changed files with 22 additions and 6 deletions
|
@ -205,8 +205,8 @@ public class SessionImpl implements Session {
|
|||
sessionState = SessionState.CONNECTED;
|
||||
serverState = server.getServerState();
|
||||
updateDatabase();
|
||||
logger.info(new StringBuilder("Connected as ").append(this.getUserName()).append(" to MAGE server at ").append(connection.getHost()).append(":").append(connection.getPort()).toString());
|
||||
client.connected(new StringBuilder(this.getUserName()).append("@").append(connection.getHost()).append(":").append(connection.getPort()).append(" ").toString());
|
||||
logger.info("Connected as " + this.getUserName() == null ? "":this.getUserName() + " to MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
client.connected(this.getUserName() == null ? "":this.getUserName() +"@" + connection.getHost() + ":" + connection.getPort() +" ");
|
||||
return true;
|
||||
}
|
||||
disconnect(false);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
|
@ -6,6 +6,7 @@
|
|||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
|
|
|
@ -411,7 +411,7 @@ public class ConnectDialog extends JDialog {
|
|||
connection.setHost(this.txtServer.getText());
|
||||
connection.setPort(Integer.valueOf(this.txtPort.getText()));
|
||||
connection.setPassword(new String(txtPassword.getPassword()));
|
||||
|
||||
connection.setUsername("Admin");
|
||||
connection.setProxyType((ProxyType) this.cbProxyType.getSelectedItem());
|
||||
if (!this.cbProxyType.getSelectedItem().equals(ProxyType.NONE)) {
|
||||
connection.setProxyHost(this.txtProxyServer.getText());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
|
@ -6,6 +6,7 @@
|
|||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
package mage.server.console;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.interfaces.MageClient;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.remote.Connection;
|
||||
|
@ -58,6 +61,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static final Preferences prefs = Preferences.userNodeForPackage(ConsoleFrame.class);
|
||||
private static final MageVersion version = new MageVersion(1, 3, 0, MageVersion.MAGE_VERSION_INFO);
|
||||
|
||||
private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
/**
|
||||
* @return the session
|
||||
*/
|
||||
|
@ -84,6 +88,13 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
} catch (Exception ex) {
|
||||
logger.fatal("", ex);
|
||||
}
|
||||
|
||||
pingTaskExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
session.ping();
|
||||
}
|
||||
}, 60, 60, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public boolean connect(Connection connection) {
|
||||
|
|
|
@ -125,6 +125,9 @@ public class Session {
|
|||
user = UserManager.getInstance().findUser("Admin");
|
||||
}
|
||||
user.setUserData(new UserData(UserGroup.ADMIN, 0, false));
|
||||
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
|
||||
logger.info("Error connecting Admin!");
|
||||
}
|
||||
this.userId = user.getId();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue