Remove Javadoc header from all source files

Also removed SendEvent and simplified some other calls.
This commit is contained in:
2020-09-25 14:29:23 +02:00
parent f0e645c0ae
commit 8eb7743057
140 changed files with 397 additions and 1260 deletions

View File

@ -5,10 +5,6 @@ import java.io.Serializable;
/**
* This interface should be used for any type supposed to be a {@link Message}
* attachment (i.e. images or sound).
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Attachment.java</strong><br>
* Created: <strong>30 Dec 2019</strong><br>
*
* @author Leon Hofmeister
* @author Kai S. K. Engelbart

View File

@ -1,7 +1,6 @@
package envoy.data;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.util.function.Function;
import java.util.logging.Level;
@ -19,10 +18,6 @@ import envoy.util.EnvoyLog;
* default value or over command line argument. Developers that fail to provide
* default values will be greeted with an error message the next time they try
* to start Envoy...
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>Config.java</strong><br>
* Created: <strong>12 Oct 2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.1-beta
@ -104,6 +99,7 @@ public class Config {
public void loadAll(Class<?> declaringClass, String propertiesFilePath, String[] args) {
if (modificationDisabled)
throw new IllegalStateException("Cannot change config after isInitialized has been called");
// Load the defaults from the given .properties file first
final var properties = new Properties();
try {
@ -120,6 +116,7 @@ public class Config {
// Check if all configuration values have been initialized
isInitialized();
// Disable further editing of the config
modificationDisabled = true;
}
@ -130,10 +127,9 @@ public class Config {
* @since Envoy Common v0.1-beta
*/
private void isInitialized() {
if (items.values().stream().map(ConfigItem::get).anyMatch(Objects::isNull))
throw new IllegalStateException("config item(s) has/ have not been initialized:"
+ items.values().stream().filter(configItem -> configItem.get() == null)
.map(ConfigItem::getCommandLong).collect(Collectors.toSet()));
String uninitialized = items.values().stream().filter(c -> c.get() == null).map(ConfigItem::getCommandLong).collect(Collectors.joining(", "));
if(!uninitialized.isEmpty())
throw new IllegalStateException("Config items uninitialized: " + uninitialized);
}
/**

View File

@ -7,10 +7,6 @@ import java.util.function.Function;
* line arguments and its default value.
* <p>
* All {@code ConfigItem}s are automatically mandatory.
* <p>
* Project: <strong>envoy-clientChess</strong><br>
* File: <strong>ConfigItem.javaEvent.java</strong><br>
* Created: <strong>21.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @param <T> the type of the config item's value

View File

@ -1,16 +1,11 @@
package envoy.data;
import java.io.Serializable;
import java.util.Objects;
import java.util.Set;
import java.util.*;
/**
* This class is the superclass for both {@link User} and {@link Group}.<br>
* It provides an id and a name for each user and group.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Contact.java</strong><br>
* Created: <strong>24 Mar 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy v0.1-beta

View File

@ -1,15 +1,9 @@
package envoy.data;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashSet;
import java.util.Set;
import java.io.*;
import java.util.*;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>Group.java</strong><br>
* Created: <strong>24 Mar 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.1-beta
*/

View File

@ -1,14 +1,9 @@
package envoy.data;
import java.time.Instant;
import java.util.Collections;
import java.util.Map;
import java.util.*;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>GroupMessage.java</strong><br>
* Created: <strong>26.03.2020</strong><br>
*
* @author Maximilian K&auml;fer
* @since Envoy Common v0.1-beta
*/

View File

@ -3,11 +3,7 @@ package envoy.data;
import java.io.Serializable;
/**
* Generates increasing IDs between two numbers.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>IDGenerator.java</strong><br>
* Created: <strong>31.12.2019</strong><br>
* Generates increasing IDs between two numbers.
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha

View File

@ -9,10 +9,6 @@ import java.time.Instant;
* <p>
* If the authentication is performed with a token, the token is stored instead
* of the password.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>LoginCredentials.java</strong><br>
* Created: <strong>29.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha

View File

@ -9,10 +9,6 @@ import dev.kske.eventbus.IEvent;
* Represents a unique message with a unique, numeric ID. Further metadata
* includes the sender and recipient {@link User}s, as well as the creation
* date and the current {@link MessageStatus}.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Message.java</strong><br>
* Created: <strong>28.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @author Leon Hofmeister
@ -28,23 +24,22 @@ public class Message implements Serializable, IEvent {
public enum MessageStatus {
/**
* is selected, if a message was sent but not received by the server yet.
* The message has not yet been sent to the server
*/
WAITING,
/**
* is selected, if a sent message was received by the server.
* The message has been sent to the server.
*/
SENT,
/**
* is selected, if a message was delivered from the server to the recipient, but
* has not been read yet.
* The message has been received by its recipient.
*/
RECEIVED,
/**
* is selected, if a recipient opened the corresponding chat of said message.
* The message has been read by its recipient.
*/
READ
}

View File

@ -7,10 +7,6 @@ import envoy.data.Message.MessageStatus;
/**
* Provides a method of constructing the {@link Message} class.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>MessageBuilder.java</strong><br>
* Created: <strong>31.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha

View File

@ -1,17 +1,11 @@
package envoy.data;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashSet;
import java.util.Set;
import java.io.*;
import java.util.*;
/**
* Represents a unique user with a unique, numeric ID, a name and a current
* {@link UserStatus}.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>User.java</strong><br>
* Created: <strong>28.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
@ -32,7 +26,7 @@ public final class User extends Contact {
*
* @since Envoy Common v0.2-alpha
*/
public static enum UserStatus {
public enum UserStatus {
/**
* select this, if a user is online and can be interacted with

View File

@ -1,6 +1,6 @@
/**
* This package contains all data objects that are used both by Envoy Client and
* by Envoy Server Standalone.
* by Envoy Server.
*
* @author Leon Hofmeister
* @author Maximilian K&auml;fer

View File

@ -1,13 +1,10 @@
package envoy.event;
/**
* This enum declares all modification possibilities for a given container.<br>
* This enum declares all modification possibilities for a given container.
* <p>
* These can be: {@link ElementOperation#ADD} or
* {@link ElementOperation#REMOVE}.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>ElementOperation.java</strong><br>
* Created: <strong>25 Mar 2020</strong><br>
* {@link ElementOperation#REMOVE}.
*
* @author Leon Hofmeister
* @since Envoy Common v0.1-beta

View File

@ -8,10 +8,6 @@ import dev.kske.eventbus.IEvent;
* This class serves as a convenience base class for all events. It implements
* the {@link IEvent} interface and provides a generic value. For events without
* a value there also is {@link envoy.event.Event.Valueless}.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Event.java</strong><br>
* Created: <strong>04.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @param <T> the type of the Event
@ -34,11 +30,7 @@ public abstract class Event<T> implements IEvent, Serializable {
public String toString() { return String.format("%s[value=%s]", this.getClass().getSimpleName(), value); }
/**
* Serves as a super class for events that do not carry a value.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Event.java</strong><br>
* Created: <strong>11 Feb 2020</strong><br>
* Serves as a super class for events that do not carry a value.
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha

View File

@ -1,16 +1,11 @@
package envoy.event;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
import envoy.data.User;
/**
* This event creates a group with the given name.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>GroupCreation.java</strong><br>
* Created: <strong>25 Mar 2020</strong><br>
* This event creates a group with the given name.
*
* @author Leon Hofmeister
* @since Envoy Common v0.1-beta
@ -30,7 +25,7 @@ public final class GroupCreation extends Event<String> {
*/
public GroupCreation(String value, Set<Long> initialMemberIDs) {
super(value);
this.initialMemberIDs = (initialMemberIDs != null) ? initialMemberIDs : new HashSet<>();
this.initialMemberIDs = initialMemberIDs != null ? initialMemberIDs : new HashSet<>();
}
/**

View File

@ -3,10 +3,6 @@ package envoy.event;
/**
* Used to communicate with a client that his request to create a group might
* have been rejected as it might be disabled on his current server.
* <p>
* Project: <strong>common</strong><br>
* File: <strong>GroupCreationResult.java</strong><br>
* Created: <strong>22.08.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-beta

View File

@ -6,10 +6,6 @@ import envoy.data.GroupMessage;
import envoy.data.Message.MessageStatus;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>GroupMessageStatusChange.java</strong><br>
* Created: <strong>18.04.2020</strong><br>
*
* @author Maximilian K&auml;fer
* @since Envoy Common v0.1-beta
*/

View File

@ -1,18 +1,15 @@
package envoy.event;
import envoy.data.Contact;
import envoy.data.Group;
import envoy.data.User;
import static envoy.event.ElementOperation.*;
import envoy.data.*;
/**
* This event is used to communicate changes in the group size between client
* and server.<br>
* and server.
* <p>
* Possible actions are adding or removing certain {@link User}s to or from a
* certain {@link Group}.
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>GroupResize.java</strong><br>
* Created: <strong>25 Mar 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.1-beta
@ -36,13 +33,13 @@ public final class GroupResize extends Event<User> {
*/
public GroupResize(User user, Group group, ElementOperation operation) {
super(user);
if (group.getContacts().contains(user)) {
if (operation.equals(ElementOperation.ADD)) throw new IllegalArgumentException(
"Cannot add " + user + " to group " + group.getID() + " because he is already a member of this group");
} else if (operation.equals(ElementOperation.REMOVE))
throw new IllegalArgumentException("Cannot remove " + user + " from group " + group.getID() + " because he is no part of this group");
groupID = group.getID();
this.operation = operation;
if (group.getContacts().contains(user)) {
if (operation.equals(ADD))
throw new IllegalArgumentException(String.format("Cannot add %s to %s!", user, group));
} else if (operation.equals(REMOVE))
throw new IllegalArgumentException(String.format("Cannot remove %s from %s!", user, group));
groupID = group.getID();
}
/**
@ -58,8 +55,22 @@ public final class GroupResize extends Event<User> {
public ElementOperation getOperation() { return operation; }
/**
* {@inheritDoc}
* Applies the operation to a group.
*
* @param group the group to resize
* @since Envoy Common v0.2-beta
*/
public void apply(Group group) {
switch (operation) {
case ADD:
group.getContacts().add(value);
break;
case REMOVE:
group.getContacts().remove(value);
break;
}
}
@Override
public String toString() { return String.format("GroupResize[userid=%d,groupid=%d,operation=%s]", get(), groupID, operation); }
}

View File

@ -3,10 +3,6 @@ package envoy.event;
/**
* Signifies to the client that the handshake failed for the attached
* reason.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>HandshakeRejection.java</strong><br>
* Created: <strong>28 Jan 2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.3-alpha

View File

@ -2,11 +2,7 @@ package envoy.event;
/**
* Signifies to the server that the client needs a new
* {@link envoy.data.IDGenerator} instance.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>IDGeneratorRequest.java</strong><br>
* Created: <strong>28 Jan 2020</strong><br>
* {@link envoy.data.IDGenerator} instance.
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.3-alpha

View File

@ -3,10 +3,6 @@ package envoy.event;
/**
* This event should be sent when a user is currently typing something in a
* chat.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>IsTyping.java</strong><br>
* Created: <strong>24.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta
@ -18,7 +14,8 @@ public final class IsTyping extends Event<Long> {
private static final long serialVersionUID = 1L;
/**
* The number of milliseconds that this event will be active.<br>
* The number of milliseconds that this event will be active.
* <p>
* Currently set to 3.5 seconds.
*
* @since Envoy Common v0.2-beta
@ -28,8 +25,8 @@ public final class IsTyping extends Event<Long> {
/**
* Creates a new {@code IsTyping} event with originator and recipient.
*
* @param sourceID the id of the originator
* @param destinationID the id of the contact the user wrote to
* @param sourceID the ID of the originator
* @param destinationID the ID of the contact the user wrote to
* @since Envoy Common v0.2-beta
*/
public IsTyping(Long sourceID, long destinationID) {
@ -38,7 +35,7 @@ public final class IsTyping extends Event<Long> {
}
/**
* @return the id of the contact in whose chat the user typed something
* @return the ID of the contact in whose chat the user typed something
* @since Envoy Common v0.2-beta
*/
public long getDestinationID() { return destinationID; }

View File

@ -2,11 +2,7 @@ package envoy.event;
/**
* This class allows envoy users to send an issue proposal to the server who, if
* not disabled by its admin, will forward it directly to gitea.
* <p>
* Project: <strong>common</strong><br>
* File: <strong>IssueProposal.java</strong><br>
* Created: <strong>05.08.2020</strong><br>
* not disabled by its administrator, will forward it directly to Gitea.
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-beta

View File

@ -5,10 +5,6 @@ import java.time.Instant;
import envoy.data.Message;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>MessageStatusChange.java</strong><br>
* Created: <strong>6 Jan 2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/

View File

@ -3,14 +3,11 @@ package envoy.event;
import envoy.data.Contact;
/**
* This event informs<br>
* This event informs
* <p>
* a) the server of the name change of a user or a group.
* b) another user of this users name change.
*
* Project: <strong>envoy-common</strong><br>
* File: <strong>NameChange.java</strong><br>
* Created: <strong>25 Mar 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.1-beta
*/

View File

@ -2,10 +2,6 @@ package envoy.event;
/**
* This event can be used to transmit a new authentication token to a client.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>NewAuthToken.java</strong><br>
* Created: <strong>19.09.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-beta

View File

@ -3,10 +3,6 @@ package envoy.event;
/**
* This event is used so that the server can tell the client that attachments
* will be filtered out.
* <p>
* Project: <strong>common</strong><br>
* File: <strong>NoAttachments.java</strong><br>
* Created: <strong>22.08.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-beta

View File

@ -3,10 +3,6 @@ package envoy.event;
import envoy.data.Contact;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>PasswordChangeRequest.java</strong><br>
* Created: <strong>31.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-beta
*/

View File

@ -3,10 +3,6 @@ package envoy.event;
/**
* This class acts as a notice to the user whether his
* {@link envoy.event.PasswordChangeRequest} was successful.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>PasswordChangeResult.java</strong><br>
* Created: <strong>01.08.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-beta

View File

@ -1,10 +1,6 @@
package envoy.event;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>ProfilePicChange.java</strong><br>
* Created: <strong>31.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-beta
*/

View File

@ -4,10 +4,6 @@ import envoy.data.User;
import envoy.data.User.UserStatus;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>UserStatusChange.java</strong><br>
* Created: <strong>1 Feb 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-alpha
*/

View File

@ -1,15 +1,10 @@
package envoy.event.contact;
import envoy.data.Contact;
import envoy.event.ElementOperation;
import envoy.event.Event;
import envoy.event.*;
/**
* Signifies the modification of a contact list.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>ContactOperation.java</strong><br>
* Created: <strong>05.02.2020</strong><br>
* Signifies the modification of a contact list.
*
* @author Maximilian K&auml;fer
* @since Envoy Common v0.2-alpha

View File

@ -4,10 +4,6 @@ import envoy.event.Event;
/**
* Requests a user search from the server.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>UserSearchRequest.java</strong><br>
* Created: <strong>05.02.2020</strong><br>
*
* @author Maximilian K&auml;fer
* @since Envoy Common v0.2-alpha

View File

@ -7,10 +7,6 @@ import envoy.event.Event;
/**
* Contains a list of users for which a search has been requested.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>UserSearchResult.java</strong><br>
* Created: <strong>11 Feb 2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha

View File

@ -1,9 +1,5 @@
/**
* This package contains all contact-related events.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>package-info.java</strong><br>
* Created: <strong>28 Mar 2020</strong><br>
* This package contains all contact-related events.
*
* @author Leon Hofmeister
* @author Maximilian K&auml;fer

View File

@ -1,10 +1,6 @@
package envoy.exception;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>EnvoyException.java</strong><br>
* Created: <strong>27 Oct 2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy v0.1-alpha
*/

View File

@ -3,12 +3,6 @@ package envoy.util;
import java.util.regex.Pattern;
/**
* Implements contact name validation.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Bounds.java</strong><br>
* Created: <strong>25.06.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.1-beta
*/

View File

@ -1,7 +1,6 @@
package envoy.util;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.logging.*;
@ -11,10 +10,6 @@ import envoy.data.Config;
/**
* Configures the {@link java.util.logging} API to output the log into the
* console and a log file.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>EnvoyLogger.java</strong><br>
* Created: <strong>14.12.2019</strong><br>
*
* @author Leon Hofmeister
* @author Kai S. K. Engelbart

View File

@ -4,10 +4,6 @@ import java.io.*;
/**
* Defines utility methods related to serialization.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SerializationUtils.java</strong><br>
* Created: <strong>23.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
@ -34,8 +30,8 @@ public final class SerializationUtils {
* @since Envoy Common v0.2-alpha
*/
public static int bytesToInt(byte[] bytes, int offset) {
return ((bytes[offset] & 0xFF) << 24) | ((bytes[offset + 1] & 0xFF) << 16) | ((bytes[offset + 2] & 0xFF) << 8)
| ((bytes[offset + 3] & 0xFF) << 0);
return (bytes[offset] & 0xFF) << 24 | (bytes[offset + 1] & 0xFF) << 16 | (bytes[offset + 2] & 0xFF) << 8
| (bytes[offset + 3] & 0xFF) << 0;
}
/**