Removing deprecated methods. So long, and don't let the

door hit you on the way out...


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7004 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 14 years ago
parent 9bdaa48efa
commit e441958434
  1. 96
      engine/src/networking/com/jme3/network/connection/Client.java
  2. 20
      engine/src/networking/com/jme3/network/connection/Connection.java
  3. 153
      engine/src/networking/com/jme3/network/connection/Server.java
  4. 7
      engine/src/networking/com/jme3/network/message/Message.java

@ -242,44 +242,6 @@ public class Client extends ServiceManager implements MessageListener, Connectio
} }
} }
/**
* Send a message over TCP. If this client is a connector, it'll simply send to this
* connector. If the client is a normal client, this'll be sent to the server.
*
* @param object The object to send.
* @throws IOException When a writing error occurs.
* @deprecated Use send with the reliable message flag set to true.
*/
@Deprecated
public void sendTCP(Object object) throws IOException {
if (tcp == null) throw new IOException("No TCP client/server.");
if (!isConnected) throw new IOException("Not connected yet. Use connect() first.");
if (isConnector) {
tcp.sendObject(this, object);
} else {
tcp.sendObject(object);
}
}
/**
* Send a message over UDP. If this client is a connector, it'll simply send to this
* connector. If the client is a normal client, this'll be sent to the server.
*
* @param object The object to send.
* @throws IOException When a writing error occurs.
* @deprecated Use send.
*/
@Deprecated
public void sendUDP(Object object) throws IOException {
if (udp == null) throw new IOException("No UDP client/server.");
if (!isConnected) throw new IOException("Not connected yet. Use connect() first.");
if (isConnector) {
udp.sendObject(this, object);
} else {
udp.sendObject(object);
}
}
/** /**
* Disconnect from the server. * Disconnect from the server.
* *
@ -555,64 +517,6 @@ public class Client extends ServiceManager implements MessageListener, Connectio
} }
} }
///
/**
* Add a message listener for a specific class.
*
* @param messageClass The class to listen for.
* @param listener The listener.
* @deprecated Use addMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void addIndividualMessageListener(Class messageClass, MessageListener listener) {
if (tcp != null) tcp.addIndividualMessageListener(messageClass, listener);
if (udp != null) udp.addIndividualMessageListener(messageClass, listener);
}
/**
* Add a message listener for specific classes.
*
* @param messageClass The classes to listen for.
* @param listener The listener.
* @deprecated Use addMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void addIndividualMessageListener(Class[] messageClass, MessageListener listener) {
for (Class c : messageClass) {
if (tcp != null) tcp.addIndividualMessageListener(c, listener);
if (udp != null) udp.addIndividualMessageListener(c, listener);
}
}
/**
* Remove a message listener for a specific class.
*
* @param messageClass The class to what this listener is registered.
* @param listener The listener.
* @deprecated Use removeMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void removeIndividualMessageListener(Class messageClass, MessageListener listener) {
if (tcp != null) tcp.removeIndividualMessageListener(messageClass, listener);
if (udp != null) udp.removeIndividualMessageListener(messageClass, listener);
}
/**
*Remove a message listener for specific classes.
*
* @param messageClass The classes to remove for.
* @param listener The listener.
* @deprecated Use addMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void removeIndividualMessageListener(Class[] messageClass, MessageListener listener) {
for (Class c : messageClass) {
if (tcp != null) tcp.removeIndividualMessageListener(c, listener);
if (udp != null) udp.removeIndividualMessageListener(c, listener);
}
}
public void messageReceived(Message message) { public void messageReceived(Message message) {
try { try {
disconnectInternal((DisconnectMessage)message); disconnectInternal((DisconnectMessage)message);

@ -324,26 +324,6 @@ public abstract class Connection implements Runnable {
} }
} }
//
@Deprecated
public void addIndividualMessageListener(Class messageClass, MessageListener listener) {
if (individualMessageListeners.containsKey(messageClass)) {
individualMessageListeners.get(messageClass).add(listener);
} else {
List<MessageListener> list = new ArrayList<MessageListener>();
list.add(listener);
individualMessageListeners.put(messageClass, list);
}
}
@Deprecated
public void removeIndividualMessageListener(Class messageClass, MessageListener listener) {
if (individualMessageListeners.containsKey(messageClass)) {
individualMessageListeners.get(messageClass).remove(listener);
}
}
protected void fireMessageReceived(Message message) { protected void fireMessageReceived(Message message) {
// Pass to listeners. // Pass to listeners.
for (MessageListener listener : messageListeners) { for (MessageListener listener : messageListeners) {

@ -239,101 +239,6 @@ public class Server extends ServiceManager implements MessageListener {
} }
} }
/**
* Send a TCP message to the given connector.
*
* @param connector The connector to send the message to.
* @param object The object to send.
* @throws IOException When a writing error occurs.
* @deprecated Unnecessary, use client.send().
*/
@Deprecated
public void sendTCP(Client connector, Object object) throws IOException {
if (tcp == null) throw new IOException("No TCP server.");
if (!isBound) throw new IOException("Not bound yet. Use bind() first.");
tcp.sendObject(connector, object);
}
/**
* Send a UDP message to the given connector.
*
* @param connector The connector to send to.
* @param object The object to send.
* @throws IOException When a writing error occurs.
* @deprecated Unnecessary, use client.send().
*/
@Deprecated
public void sendUDP(Client connector, Object object) throws IOException {
if (udp == null) throw new IOException("No UDP server.");
if (!isBound) throw new IOException("Not bound yet. Use bind() first.");
udp.sendObject(connector, object);
}
/**
* Broadcast a TCP message.
*
* @param object The message to broadcast.
* @throws IOException When a writing error occurs.
* @deprecated Use broadcast() instead.
*/
@Deprecated
public void broadcastTCP(Object object) throws IOException {
if (tcp == null) throw new IOException("No TCP server.");
if (!isBound) throw new IOException("Not bound yet. Use bind() first.");
tcp.sendObject(object);
}
/**
* Broadcast a UDP message.
*
* @param object The message to broadcast.
* @throws IOException When there's no UDP server initialized, when the server was not bound to a port yet or when a
* write error occurs.
* @deprecated Use broadcast() instead.
*/
@Deprecated
public void broadcastUDP(Object object) throws IOException {
if (udp == null) throw new IOException("No UDP server.");
if (!isBound) throw new IOException("Not bound yet. Use bind() first.");
udp.sendObject(object);
}
/**
* Broadcast a message over TCP, except to the given client.
*
* @param except The client to refrain from sending the object to.
* @param object The object to send.
* @throws IOException When a writing error occurs.
* @deprecated Use broadcastExcept() instead.
*/
@Deprecated
public void broadcastExceptTCP(Client except, Object object) throws IOException {
if (tcp == null) throw new IOException("No TCP server.");
if (!isBound) throw new IOException("Not bound yet. Use bind() first.");
for (Client con : tcp.getConnectors()) {
if (con == except) continue;
con.sendTCP(object);
}
}
/**
* Broadcast a message over UDP, except to the given client.
*
* @param except The client to refrain from sending the object to.
* @param object The object to send.
* @throws IOException When a writing error occurs.
* @deprecated Use broadcastExcept() instead.
*/
@Deprecated
public void broadcastExceptUDP(Client except, Object object) throws IOException {
if (udp == null) throw new IOException("No UDP server.");
if (!isBound) throw new IOException("Not bound yet. Use bind() first.");
for (Client con : udp.getConnectors()) {
if (con == except) continue;
con.sendUDP(object);
}
}
/** /**
* Start this server. * Start this server.
* *
@ -518,64 +423,6 @@ public class Server extends ServiceManager implements MessageListener {
} }
} }
///
/**
* Add a message listener for a specific class.
*
* @param messageClass The class to listen for.
* @param listener The listener.
* @deprecated Use addMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void addIndividualMessageListener(Class messageClass, MessageListener listener) {
if (tcp != null) tcp.addIndividualMessageListener(messageClass, listener);
if (udp != null) udp.addIndividualMessageListener(messageClass, listener);
}
/**
* Add a message listener for specific classes.
*
* @param messageClass The classes to listen for.
* @param listener The listener.
* @deprecated Use addMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void addIndividualMessageListener(Class[] messageClass, MessageListener listener) {
for (Class c : messageClass) {
if (tcp != null) tcp.addIndividualMessageListener(c, listener);
if (udp != null) udp.addIndividualMessageListener(c, listener);
}
}
/**
* Remove a message listener for a specific class.
*
* @param messageClass The class to what this listener is registered.
* @param listener The listener.
* @deprecated Use removeMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void removeIndividualMessageListener(Class messageClass, MessageListener listener) {
if (tcp != null) tcp.removeIndividualMessageListener(messageClass, listener);
if (udp != null) udp.removeIndividualMessageListener(messageClass, listener);
}
/**
*Remove a message listener for specific classes.
*
* @param messageClass The classes to remove for.
* @param listener The listener.
* @deprecated Use addMessageListener(MessageListener, Class...) instead.
*/
@Deprecated
public void removeIndividualMessageListener(Class[] messageClass, MessageListener listener) {
for (Class c : messageClass) {
if (tcp != null) tcp.removeIndividualMessageListener(c, listener);
if (udp != null) udp.removeIndividualMessageListener(c, listener);
}
}
public void messageReceived(Message message) { public void messageReceived(Message message) {
// Right now, this is definitely a DisconnectMessage. // Right now, this is definitely a DisconnectMessage.
DisconnectMessage dcMessage = (DisconnectMessage)message; DisconnectMessage dcMessage = (DisconnectMessage)message;

@ -50,13 +50,6 @@ public class Message {
private transient Connection connection; private transient Connection connection;
private transient boolean reliable = true; private transient boolean reliable = true;
/**
* @deprecated Do NOT use anymore. No alternative, since it's set automatically.
*/
public Message(Connection connection) {
this.connection = connection;
}
public Message() {} public Message() {}
public Message(boolean reliable) { public Message(boolean reliable) {

Loading…
Cancel
Save