Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3591929
  • 博文数量: 365
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2522
  • 用 户 组: 普通用户
  • 注册时间: 2019-10-28 13:40
文章分类

全部博文(365)

文章存档

2023年(8)

2022年(130)

2021年(155)

2020年(50)

2019年(22)

我的朋友

分类: Java

2021-06-24 17:18:27

RMI定义远程方法提供给客户端调用

定义的接口:(需要实现

import java.rmi.Remote;

import java.rmi.RemoteException;

import java.sql.SQLException;

import java.util.ArrayList;

public interface ServerMethod extends Remote {

    /**

     *RMI方法

     * 登录 登录成功返回true 否则返回false

     * @param   UID  用户UID

     * @param   Password 用户密码

     * @see boolean

     */

    public boolean Login(String UID,String Password) throws RemoteException, SQLException;//登录

    /**

     *RMI方法

     * 注册 注册成功返回true 否则返回false

     * @param   UID  用户UID

     * @param   Password 用户密码

     * @param Nickname 昵称

     * @see boolean

     */

    public boolean Register(String UID ,String Password,String Nickname)throws SQLException,RemoteException;//注册

    /**

     *RMI方法

     * 获取存在数据库的未读消息

     * @param   UID  用户UID

     * @see ArrayList

     */

    public ArrayList getDBMessage(String UID) throws SQLException,RemoteException;//获取存储在数据库的消息

    /**

     *RMI方法

     * 获取好友列表

     * @param   UID  用户UID

     * @see ArrayList

     */

    public ArrayList getAllFriends(String UID) throws SQLException,RemoteException;//获取好友列表 格式: UID:Nickname

    /**

     *RMI方法

     * 发送消息

     * @param   UID  发送者UID

     * @param Nickname 昵称

     * @param  ReceiveID 接收者ID

     * @param content  内容

     * @see ArrayList

     */

    public boolean SendMessage(String UID,String Nickname,String ReceiveID,String content) throws SQLException,RemoteException;//对方还不是好友,则发送失败

    /**

     *RMI方法

     * 获取实时消息

     * @param   UID  用户UID

     * @see ArrayList

     */

    public  ArrayList GetMessage(String UID) throws Exception;//实时消息获取

    /**

     *RMI方法

     * 发送群聊消息 发送成功返回true

     * @param   UID  发送者UID

     * @param   Nickname 昵称

     * @param   GroupUID 群组UID

     * @param   content 内容

     * @see boolean

     */

    public boolean SendMessageToGroup(String UID,String Nickname,String GroupUID,String content)throws SQLException,RemoteException;//向群聊发送消息

    /**

     *RMI方法

     * 发送群聊消息 发送成功返回true

     * @param   SendUID  发送者UID

     * @param   Nickname 昵称

     * @param   ReceiveUID 接收者UID

     * @param   content 内容

     * @see boolean

     */

    public boolean AddFriendsRequest(String SendUID,String ReceiveUID,String Nickname,String content)throws SQLException,RemoteException;//发送添加好友请求

    /**

     *RMI方法

     * 删除关系

     * @param   ID1 ID2

     * @param   ID2 ID1

     */

    public void DeleteFriend(String ID1,String ID2)throws SQLException,RemoteException;//删除关系

    /**

     *RMI方法

     * 新建群聊

     * @param   SendUID ID2

     * @param   GID ID1

     */

    public boolean NewGroup(String SendUID,String GID)throws SQLException,RemoteException;//新建群聊

    /**

     *RMI方法

     * 添加群聊

     * @param   UID 用户ID

     * @param   GID 群聊ID

     */

    public void AddGroup(String UID,String GID)throws SQLException,RemoteException;//添加群聊 无需验证

    /**

     *RMI方法

     * 修改昵称

     * @param   UID 用户ID

     * @param   newNickname 新用户昵称

     * @see     boolean

     */

    public boolean ChangeNickname(String UID,String newNickname)throws SQLException,RemoteException;//修改昵称

    /**

     *RMI方法

     * 修改密码

     * @param   UID 用户ID

     * @param   newPassword 新密码

     * @see     boolean

     */

    public boolean ChangePassword(String UID,String newPassword)throws SQLException,RemoteException;//修改密码

    /**

     *RMI方法

     * 获取用户消息

     * @param   UID 用户ID

     */

    public String getUserInfo(String UID)throws SQLException,RemoteException;//获取用户信息 若为群组返回 G:GID 若为用户返回 U:UID:Nickname

    /**

     *RMI方法

     * 同意添加好友

     * @param   SendUID 发送者ID

     * @param   ReceiveUID 接收者UID

     */

    public  void AgreeAddFriendRequest(String SendUID,String ReceiveUID)throws SQLException,RemoteException;

    /**

     *RMI方法

     * 拒绝添加好友

     * @param   SendUID 发送者ID

     * @param   ReceiveUID 接收者UID

     */

    public  void RefuseAddFriendRequest(String SendUID,String ReceiveUID)throws SQLException,RemoteException;

}

阅读(1280) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~