-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
206 lines (149 loc) · 7.59 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
------------------------ Instructions ---------------------------
1 - unzip project
2 - There are two different ways to run the project
2.1 - Run with Jar:
- To run the server:
- go to Jars/InstagramCloneServer/ open a terminal and write:
java -Djava.security.manager -Djava.security.policy=server.policy -jar InstagramCloneServer.jar 45678
- To run a client:
- go to Jars/InstagramClone/ open a terminal and write:
java -Djava.security.manager -Djava.security.policy=client.policy -jar InstagramClone.jar 127.0.0.1:45678 John helloWorld
- Notes:
- To reset all files generated by InstagramCloneServer and by InstagramClone:
- go to the Jars directory/ open a terminal and write:
bash virgin.sh or ./virgin.sh
2.2 - Run with the eclipse:
- Open two projects in eclipse for InstagramClone and for InstagramCloneServer
- To run the server:
- Run configurations with arguments: 45678 and VM arguments: -Djava.security.manager -Djava.security.policy=server.policy
- To run a client:
- Run configurations with arguments: 127.0.0.1:45678 John helloWorld
and VM arguments: -Djava.security.manager -Djava.security.policy=client.policy
- Notes:
- To reset all files generated by InstagramCloneServer and by InstagramClone:
- go to the InstagramClone-master directory/ open a terminal and write:
bash virgin.sh or ./virgin.sh
---------------- Project Structure ---------------------
- Directory Clients
- Directory userId (Example: John)
- Directory history
- groupId.txt (groupId history relative to userId John)
- Directory myPhotos
- photo.jpg (all photos to send are placed here)
- Directory receivedPhotos
- photo.jpg (all photos received are placed here)
- InstagramClone Project
- client.policy
- bin
- src
- exceptions
- handlers
- main
- InstagramCloneServer Project
- users.txt (all users id are unique and identified here)
- server.policy
- bin
- src
- domain
- exceptions
- handlers
- main
- Directory ClientFiles
- photosId.txt (all photos id are unique and identified here)
- Directory groups
- groupSettings.txt
- groupId.txt (groupId conversation)
- groupIdHistory.txt (groupId conversation history when read by everyone)
- Directory userId (example John)
- followers.txt
-following.txt
- Directory history
- groupId.txt (groupId history relative to userId John)
- Directory photos
- photo.jpg (all photos received are placed here)
---------------------- Notes --------------------------
- Robust design for all operating systems. (Windows and Unix)
- When you run the first customer, all the necessary directories are created for
the functioning of the project such as the Clients/ directory and the InstagramCloneServer/ClientFiles/ directory
- When using the post command, it is necessary that the photo to be sent is placed in a specific directory depending on whether if you ran with the jar or the eclipse:
- Jar
photo to send must be in the directory InstagramClone-master/Jars/Clients/userId/myPhotos/ where
userId is the unique name of the user. Each user has their directory. Photos are uploaded to the server
and are stored in InstagramClone-master/Jars/InstagramCloneServer/ClientFiles/userId/photos/
- Eclipse
photo to send must be in the directory InstagramClone-master/Clients/userId/myPhotos/
where userId is the unique name of the user. Each user has their directory. Photos are uploaded to the server
and are stored in InstagramClone-master/InstagramCloneServer/ClientFiles/userId/photos/
- Directory Clients
This directory has the function of keeping the userId directories.
In order to simulate a machine with a userId, we created a directory
for each userId, which have as subdirectories history, myPhotos and receivedPhotos directories .
When a client connects to the server its directory is created.
Example userId: John, Directory: Clients/John/
- Directory history
stores groupId.txt files representing the conversation history of that groupId,
that the userId has already read. These files are created when you make a collect or when you
a make history command. However when using the history command, we only create the groupId.txt file
if it does not already exist in the userId folder.
- Directory myPhotos
local reserved for placing photos before uploading to the server.
When executing the post command, the photo must be in this directory.
Example: userId: John wants to post photo1.jpg and the
userId: Mark also wants to post the photo2.jpg photo.
So the photos must be saved in the respective directories before the post:
Clients/John/myPhotos/photo1.jpg and Clients/Mark/myPhotos/photo2.jpg
- Directory receivedPhotos
local to receive photos from other users. When the wall command is executed
the photos of the users that we are following are saved here.
- InstagramCloneServer Project
- users.txt
File used to store user information one userId per line in the format:
<userId>:<UserName>:<password> Example: John:Johnny:helloWorld
- Directory ClientFiles
This directory saves all files related to clients
- Directory Groups
Saves all group chat files
There is a special groupSettings.txt file which is used to manage groups.
Each time a group is created a file called groupId.txt is created to
save conversations and another file called groupIdHistory.txt is used to save
the group chat history when everyone has read certain messages
- groupSettings.txt
used to manage groups. Whenever a group is created, a line is added to the file
in this format: <groupId>:<owner>:<member1,memberN>
Note: members can be null, for example when creating the group.
For example UserId: John creates a groupId: friends
Format: friends:Joao:
Example when adding userId Mark: friends:John:Mark
Example when adding userId Pedri10: friends:John:Mark,Pedri10
Example when removing userId Mark: friends:John:Pedri10
- Directory userId (John for example)
Keeps information about everything concerning the userId
- Directory history
Stores the set of groupId.txt files which represents the userId
conversation history. Each groupId.txt just has the conversation content
collected by userId from the same groupId.txt file
in the ClientFiles/groups/groupId.txt directory
- Directory photos
Keeps all userId photos sent by the post command.
In addition to saving photos, it also saves a photos.txt file.
- photos.txt
saves the information for each photo posted in the following format:
<photoPath>:nLikes>:<date>
Example: ClientFiles/John/photos/photo1.jpg:0:2021/60/18/19/23
- followers.txt
saves the followers (userId) one per line
-following.txt
store the following userIds one per line
- photosId.txt
Stores all photo ids one per line in the following format:
<userId>:<photoId> Example: John:photo1.jpg
---------------------- Policies --------------------------
Client:
-Connection permissions and resolve on localhost on port 45678
-Read and write permission in "Clients" directory and subdirectories
Server:
-Accept, listen and resolve permissions on localhost on ports 1024-
-Read and write permission in "bin" directory and subdirectories
-Read and write permission in "src" directory and subdirectories
-Read and write permission in "ClientFiles" directory and subdirectories
-----------------------------------------------------------