java代写-COMP90015 -Assignment 2
时间:2021-05-05
COMP90015
Distributed Systems – Assignment 2
Distributed Shared White Board Report







Name: Mo Liu
Student ID: 934293


1.Functional description
This system adopts the CS architecture and provides the function of
sharing and editing the whiteboard simultaneously by multiple people. After
logging in, the user enters the name and password of the shared whiteboard
to create a whiteboard of their own. After logging in, other users can apply by
entering the name and password of the shared whiteboard Join the
whiteboard, and a pop-up window prompts that you need to wait for the
administrator's review. The creator (administrator) of the whiteboard can
choose whether to let the user join the shared whiteboard. In the shared
whiteboard, multiple users can edit the whiteboard at the same time, and can
see the content edited by other people on the whiteboard in real time. The
whiteboard provides line segment, drawing, circle, rectangle, text input, and
the eraser can be used to erase the whiteboard. Content. The administrator
can kick out the remaining users in the whiteboard. When the user is kicked,
the whiteboard refreshes the online users in real time. In addition, the
whiteboard of the kicked user will be closed.

2. Main technique
2.1 Overall system structure
The system adopts C-S architecture, in which the server provides storage
and verification of user data and whiteboard data. The client requests the
server to log in, create a whiteboard, and kick out users. The client provides a
graphical interface, and enables users to log in, create a whiteboard, add a
whiteboard, kick out users, and other operations. When a user becomes the
administrator of a whiteboard, relatively speaking, it also becomes a server of
other users. When other users apply for joining the whiteboard, they will
request the user to operate. Therefore, in a whiteboard, there is also a C-S
architecture.
2.2 Network communication
The system uses TCP sockets for network communication. After the
server is turned on, it will listen to client requests. When the client initiates the
request, the server will receive the request and process it, and then return the
message. For the communication between the members in the whiteboard
and the administrator, the system uses RMI to call the remote object.
2.3 Main Data Structure
The system defines a User object on the client, and instantiates the object
to implement the user entity. When the user registers with the server, the
server uses a Map to maintain user information and only stores the user name
and password, so the user name is unique. This system defines a Group
object on the server side to represent the whiteboard, and uses a Map to
maintain the whiteboard information. The unique ID of the whiteboard is used
as the Key of the Map. Because the value comes from the self-increment field
in the program, The identification ID is also unique. The communication
between the client and the server uses a JSON format data structure for
transmission.
2.4 Operation introduction
UserLogin: user login
CreateWhiteBoard: Create a whiteboard
JoinWhiteBoard: Join the whiteboard
DeleteUser: delete the user (triggered when the user closes the client)
3. Detailed design
3.1 Server
Start the server, and the server starts listening for client requests. The
class diagram of the server is as follows

3.2 Client
3.2.1 User login
After starting the client, the login interface is displayed first. By default, the
server ip address and port have been obtained. Fill in the user name and click
the Login button to log in.

The class diagram of user login is as follows:

3.2.2 Menu view
The user enters the name and password of the whiteboard on the menu
interface, clicks the Create button to create the whiteboard, and clicks the join
button to apply to join the whiteboard.

When the user requests to join a whiteboard, a pop-up window prompts
the need to wait for administrator's approval


The class diagram relationship of the menu interface is as follows:

3.2.3 Whiteboard view
After the user creates the whiteboard, open the whiteboard view

As you can see, the menu button is provided on the left side of the
whiteboard. The user can choose a drawing tool. There are pens for drawing,
line segment, circle, eraser, rectangle, and text to achieve user input. When a
user applies to join the whiteboard, the administrator When the user is
selected, a button will be provided below the list to allow or deny the user to
join. When a user joins the whiteboard, all online users will see the same
interface, and any operation on the whiteboard will be synchronized to the
whiteboard of other users. When the administrator selects a member, a kick
button will appear. When the administrator kicks the member, the member's
whiteboard will be closed.

3.3 Drawing implementation
The drawing of the drawing board is based on points, and the point is the
most basic drawing unit, namely Point (x, y). Other tools are obtained by
calculating the points, and the tool uses a unified interface: Tool, which is
worth mentioning The implementation of the eraser tool is the same as the
drawing tool, the difference is that the eraser tool has a larger width, and the
tool color is white. When the user is painting, the RMI service of the server
(here is the drawing board administrator) obtains the drawing history of all
tools, modifies the drawing history, and then each member synchronizes the
drawing history to achieve synchronized drawing .

4.Creativity
1. Use the code to automatically increase the ID to ensure the uniqueness of the
whiteboard group.
2. The user needs the administrator's approval before joining the whiteboard to
ensure the security of the whiteboard group.
3. The administrator can freely kick out any user, but the members do not have
this permission, thus realizing the permission management of the whiteboard.
4. When the user applies for joining, it will prompt that it is waiting for
administrator approval, the view is more friendly.
5. Conclusion
This system realizes the function of multiple users editing and sharing the
whiteboard at the same time. The client communicates with the server
through TCP, and the members and the administrator communicate through
RMI to realize the distributed real-time shared whiteboard. In addition, the
system also provides the permission control of the whiteboard, which provides
different permissions for administrators and ordinary members, and improves
the security of the whiteboard.




































































































































学霸联盟


essay、essay代写
essay、essay代写