use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.
the class ServerGame method addDelegateMessenger.
public void addDelegateMessenger(final IDelegate delegate) {
final Class<? extends IRemote> remoteType = delegate.getRemoteType();
// if its null then it shouldn't be added as an IRemote
if (remoteType == null) {
return;
}
final Object wrappedDelegate = delegateExecutionManager.createInboundImplementation(delegate, new Class<?>[] { delegate.getRemoteType() });
final RemoteName descriptor = getRemoteName(delegate);
remoteMessenger.registerRemote(wrappedDelegate, descriptor);
}
use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.
the class AbstractGame method setupLocalPlayers.
private void setupLocalPlayers(final Set<IGamePlayer> localPlayers) {
final PlayerList playerList = gameData.getPlayerList();
for (final IGamePlayer gp : localPlayers) {
final PlayerID player = playerList.getPlayerId(gp.getName());
gamePlayers.put(player, gp);
final IPlayerBridge bridge = new DefaultPlayerBridge(this);
gp.initialize(bridge, player);
final RemoteName descriptor = ServerGame.getRemoteName(gp.getPlayerId(), gameData);
remoteMessenger.registerRemote(gp, descriptor);
}
}
use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.
the class ClientMessenger method bareBonesSendMessageToServer.
private void bareBonesSendMessageToServer(final String methodName, final Object... messages) {
final List<Object> args = new ArrayList<>();
final Class<?>[] argTypes = new Class<?>[messages.length];
for (int i = 0; i < messages.length; i++) {
final Object message = messages[i];
args.add(message);
argTypes[i] = args.get(i).getClass();
}
final RemoteName rn = ServerModel.SERVER_REMOTE_NAME;
final RemoteMethodCall call = new RemoteMethodCall(rn.getName(), methodName, args.toArray(), argTypes, rn.getClazz());
final HubInvoke hubInvoke = new HubInvoke(null, false, call);
send(hubInvoke, getServerNode());
}
use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.
the class Chat method shutdown.
/**
* Stop receiving events from the messenger.
*/
public void shutdown() {
messengers.getChannelMessenger().unregisterChannelSubscriber(chatChannelSubscribor, new RemoteName(chatChannelName, IChatChannel.class));
if (messengers.getMessenger().isConnected()) {
final RemoteName chatControllerName = ChatController.getChatControlerRemoteName(chatName);
final IChatController controller = (IChatController) messengers.getRemoteMessenger().getRemote(chatControllerName);
controller.leaveChat();
}
}
use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.
the class ModeratorController method getHostConnections.
@Override
public String getHostConnections(final INode node) {
assertUserIsAdmin();
if (serverMessenger.getServerNode().equals(node)) {
throw new IllegalStateException("Cannot do this for server node");
}
final RemoteName remoteName = RemoteHostUtils.getRemoteHostUtilsName(node);
final IRemoteHostUtils remoteHostUtils = (IRemoteHostUtils) allMessengers.getRemoteMessenger().getRemote(remoteName);
return remoteHostUtils.getConnections();
}
Aggregations