RMI callback for manage the invitations
This commit is contained in:
parent
cedaf8f009
commit
c54393c2b9
43 changed files with 2060 additions and 556 deletions
32
Commons/src/constants/Config.java
Normal file
32
Commons/src/constants/Config.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package constants;
|
||||
|
||||
/**
|
||||
* Created by loke on 15/06/2017.
|
||||
*/
|
||||
public class Config {
|
||||
|
||||
public static String AuthServerURI = "localhost";
|
||||
public static Integer AuthServerPort = 9999;
|
||||
|
||||
public static String GameServerURI = "localhost";
|
||||
public static Integer GameServerPort = 10000;
|
||||
|
||||
public static String NotificationServerURI = "localhost";
|
||||
public static Integer NotificationServerPort = 20000;
|
||||
public static Integer NotificationServerStubPort = 5000;
|
||||
public static String NotificationServerName ="notification";
|
||||
|
||||
|
||||
public static String getNotificationServerURI(){
|
||||
return "rmi://".concat(NotificationServerURI).concat(":").concat(NotificationServerPort.toString());
|
||||
}
|
||||
|
||||
public static String getAuthServerURI(){
|
||||
return "rmi://".concat(AuthServerURI).concat(":").concat(AuthServerPort.toString());
|
||||
}
|
||||
|
||||
public static String getGameServerURI(){
|
||||
return "tcp://".concat(GameServerURI).concat(":").concat(GameServerPort.toString());
|
||||
}
|
||||
|
||||
}
|
||||
28
Commons/src/constants/Palette.java
Normal file
28
Commons/src/constants/Palette.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package constants;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Created by loke on 13/06/2017.
|
||||
*/
|
||||
public class Palette {
|
||||
public static Color root_backgroundColor = new Color(145,181,88);
|
||||
public static Color inputBox_backgroundColor = new Color(250,250,250); //"#FAFAFA;
|
||||
public static Color button_backgroundColor = new Color(105,130,63); //#69823f
|
||||
public static Font inputBox_font = new Font("DK Trained Monkey", Font.BOLD, 26);
|
||||
public static Font password_font = new Font("Arial Black", Font.BOLD, 26);
|
||||
public static Color fontColor = new Color(95,0,0);
|
||||
public static Color registerLblBtn_color = new Color(95,0,0);
|
||||
public static Color registerLblBtn_onmouseover_color = new Color(95,0,0, 127);
|
||||
public static Color registerLblBtn_onmouseclick_color = new Color(53,66,32);
|
||||
public static Color scrollPanel_backgroundColor = new Color(220,229,207);
|
||||
public static Color dialog_alert = Color.red;
|
||||
public static Color dialog_success = new Color(53,66,32);
|
||||
|
||||
|
||||
public static Font button_font = new Font("DK Trained Monkey", Font.BOLD, 30);
|
||||
|
||||
public Palette() {
|
||||
//TODO fetchare dal server questi dati
|
||||
}
|
||||
}
|
||||
15
Commons/src/interfaces/INotificationClient.java
Normal file
15
Commons/src/interfaces/INotificationClient.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package interfaces;
|
||||
|
||||
import models.Response;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
/**
|
||||
* Created by loke on 19/06/2017.
|
||||
*/
|
||||
public interface INotificationClient extends Remote{
|
||||
|
||||
Response sendInvite(String userName, DefaultListModel<String> users) throws RemoteException;
|
||||
}
|
||||
16
Commons/src/interfaces/INotificationServer.java
Normal file
16
Commons/src/interfaces/INotificationServer.java
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package interfaces;
|
||||
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
/**
|
||||
* Created by loke on 19/06/2017.
|
||||
*/
|
||||
public interface INotificationServer extends Remote {
|
||||
/* registrazione per la callback */
|
||||
public void registerForCallback (INotificationClient ClientInterface) throws RemoteException;
|
||||
|
||||
/* cancella registrazione per la callback */
|
||||
public void unregisterForCallback (INotificationClient ClientInterface) throws RemoteException;
|
||||
|
||||
}
|
||||
|
|
@ -9,12 +9,14 @@ import java.util.regex.Pattern;
|
|||
* Created by loke on 18/06/2017.
|
||||
*/
|
||||
public class Message implements Serializable {
|
||||
public String sender;
|
||||
public String message;
|
||||
public DefaultListModel<String> data;
|
||||
public String token;
|
||||
|
||||
public Message(String message, String token, DefaultListModel<String> data) {
|
||||
public Message(String message, String sender, String token, DefaultListModel<String> data) {
|
||||
this.message = message;
|
||||
this.sender = sender;
|
||||
this.data = data;
|
||||
this.token = token;
|
||||
}
|
||||
|
|
@ -25,7 +27,7 @@ public class Message implements Serializable {
|
|||
for(int i = 0; i< data.size(); i++){
|
||||
dataToString+=data.get(i)+"|";
|
||||
}
|
||||
return "MESSAGE?token="+token+"&message="+message+"&"+dataToString;
|
||||
return "MESSAGE?sender="+sender+"&token="+token+"&message="+message+"&"+dataToString;
|
||||
}
|
||||
|
||||
public static Message toMessage(String data){
|
||||
|
|
@ -33,6 +35,11 @@ public class Message implements Serializable {
|
|||
int divisorType = data.indexOf("=");
|
||||
data = data.substring(divisorType+1, data.length());
|
||||
|
||||
int divisorSender= data.indexOf("&");
|
||||
String sender = data.substring(0,divisorSender);
|
||||
int divisorSender_end = data.indexOf("=");
|
||||
data = data.substring(divisorSender_end+1, data.length());
|
||||
|
||||
int divisorToken= data.indexOf("&");
|
||||
String token = data.substring(0,divisorToken);
|
||||
int divisorToken_end = data.indexOf("=");
|
||||
|
|
@ -51,6 +58,6 @@ public class Message implements Serializable {
|
|||
dataList.addElement(dataArray[i]);
|
||||
}
|
||||
|
||||
return new Message(message,token,dataList);
|
||||
return new Message(message,sender,token,dataList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue