/** * Shares the specified object with the server and associates it with the * specified type. Objects shared in this way are available in the connection-specific * RMI registry on the server and are not available to other connections. */ public <T> void share( T object, Class<? super T> type ) { share(defaultChannel, object, type); }
@Override protected void onInitialize( ClientServiceManager s ) { rpc = getService(RpcClientService.class); if( rpc == null ) { throw new RuntimeException("RmiClientService requires RpcClientService"); } // Register it now so that it is available when the // server starts to send us stuff. Waiting until start() // is too late in this case. rmi = new RmiRegistry(rpc.getRpcConnection(), rmiObjectId, defaultChannel); }
private ChatSession getDelegate() { // We look up the delegate lazily to make the service more // flexible. This way we don't have to know anything about the // connection lifecycle and can simply report an error if the // game is doing something screwy. if (delegate == null) { // Look it up this.delegate = rmiService.getRemoteObject(ChatSession.class); logger.log(Level.FINER, "delegate:{0}", delegate); if (delegate == null) { throw new RuntimeException("No chat session found"); } } return delegate; }
public NetworkClient(String host, int port) throws IOException { client = Network.connectToServer(NetworkConstants.GAME_NAME, NetworkConstants.PROTOCOL_VERSION, host, port); client.addClientStateListener(new ClientStateChangeListener(this)); //this.ed = new RemoteEntityData(client, 0); //ObjectMessageDelegator delegator = new ObjectMessageDelegator(this, true); // client.addMessageListener(delegator, delegator.getMessageTypes()); client.getServices().addServices(new RpcClientService(), new RmiClientService(), new AccountClientService(), new LobbyClientService(), new ChatClientService(), new EtherealClient(NetworkConstants.OBJECT_PROTOCOL, NetworkConstants.ZONE_GRID, NetworkConstants.ZONE_RADIUS)); }
private LobbySession getDelegate() { // We look up the delegate lazily to make the service more // flexible. This way we don't have to know anything about the // connection lifecycle and can simply report an error if the // game is doing something screwy. if (delegate == null) { // Look it up this.delegate = rmiService.getRemoteObject(LobbySession.class); logger.log(Level.FINER, "delegate:{0}", delegate); if (delegate == null) { throw new RuntimeException("No lobby session found"); } } return delegate; }
/** * Shares the specified object with the server and associates it with the * specified name. Objects shared in this way are available in the connection-specific * RMI registry on the server and are not available to other connections. */ public <T> void share( String name, T object, Class<? super T> type ) { share(defaultChannel, name, object, type); }
@Override protected void onInitialize( ClientServiceManager s ) { rpc = getService(RpcClientService.class); if( rpc == null ) { throw new RuntimeException("RmiClientService requires RpcClientService"); } // Register it now so that it is available when the // server starts to send us stuff. Waiting until start() // is too late in this case. rmi = new RmiRegistry(rpc.getRpcConnection(), rmiObjectId, defaultChannel); }
/** * Called during connection setup once the server-side services have been * initialized for this connection and any shared objects, etc. should be * available. */ @Override public void start() { logger.finer("start()"); super.start(); this.delegate = rmiService.getRemoteObject(AccountSession.class); logger.log(Level.FINER, "delegate:{0}", delegate); if (delegate == null) { throw new RuntimeException("No account session found during connection setup"); } }
/** * Shares the specified object with the server and associates it with the * specified type. Objects shared in this way are available in the connection-specific * RMI registry on the server and are not available to other connections. * All object related communication will be done over the specified connection * channel. */ public <T> void share( byte channel, T object, Class<? super T> type ) { share(channel, type.getName(), object, type); }
/** * Shares the specified object with the server and associates it with the * specified name. Objects shared in this way are available in the connection-specific * RMI registry on the server and are not available to other connections. */ public <T> void share( String name, T object, Class<? super T> type ) { share(defaultChannel, name, object, type); }
/** * Shares the specified object with the server and associates it with the * specified type. Objects shared in this way are available in the connection-specific * RMI registry on the server and are not available to other connections. */ public <T> void share( T object, Class<? super T> type ) { share(defaultChannel, object, type); }
/** * Shares the specified object with the server and associates it with the * specified type. Objects shared in this way are available in the connection-specific * RMI registry on the server and are not available to other connections. * All object related communication will be done over the specified connection * channel. */ public <T> void share( byte channel, T object, Class<? super T> type ) { share(channel, type.getName(), object, type); }
@Override protected void onInitialize(ClientServiceManager s) { logger.log(Level.FINER, "onInitialize({0})", s); this.rmiService = getService(RmiClientService.class); if (rmiService == null) { throw new RuntimeException("AccountClientService requires RMI service"); } logger.finer("Sharing session callback."); rmiService.share(NetworkConstants.LOBBY_CHANNEL, sessionCallback, AccountSessionListener.class); }
@Override protected void onInitialize(ClientServiceManager s) { logger.log(Level.FINER, "onInitialize({0})", s); this.rmiService = getService(RmiClientService.class); if (rmiService == null) { throw new RuntimeException("ChatClientService requires RMI service"); } logger.finer("Sharing session callback."); rmiService.share(NetworkConstants.CHAT_CHANNEL, sessionCallback, ChatSessionListener.class); }
@Override protected void onInitialize(ClientServiceManager s) { logger.log(Level.FINER, "onInitialize({0})", s); this.rmiService = getService(RmiClientService.class); if (rmiService == null) { throw new RuntimeException("LobbyClientService requires RMI service"); } logger.finer("Sharing session callback."); rmiService.share(NetworkConstants.LOBBY_CHANNEL, sessionCallback, LobbySessionListener.class); }