projects
/
demos
/
kafka
/
chat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: Introduced config switches to choose the used implementations
[demos/kafka/chat]
/
src
/
main
/
java
/
de
/
juplo
/
kafka
/
chat
/
backend
/
persistence
/
storage
/
files
/
FilesStorageStrategy.java
diff --git
a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
index
9952117
..
1fd307f
100644
(file)
--- a/
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
+++ b/
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
@@
-1,4
+1,4
@@
-package de.juplo.kafka.chat.backend.persistence.
filestorage
;
+package de.juplo.kafka.chat.backend.persistence.
storage.files
;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JavaType;
@@
-23,7
+23,7
@@
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
@RequiredArgsConstructor
@Slf4j
@RequiredArgsConstructor
@Slf4j
-public class FileStorageStrategy implements StorageStrategy
+public class File
s
StorageStrategy implements StorageStrategy
{
public static final String CHATROOMS_FILENAME = "chatrooms.json";
{
public static final String CHATROOMS_FILENAME = "chatrooms.json";
@@
-36,7
+36,7
@@
public class FileStorageStrategy implements StorageStrategy
@Override
@Override
- public void write
Chatrooms
(Flux<ChatRoom> chatroomFlux)
+ public void write(Flux<ChatRoom> chatroomFlux)
{
Path path = chatroomsPath();
log.info("Writing chatrooms to {}", path);
{
Path path = chatroomsPath();
log.info("Writing chatrooms to {}", path);
@@
-96,7
+96,7
@@
public class FileStorageStrategy implements StorageStrategy
}
@Override
}
@Override
- public Flux<ChatRoom> read
Chatrooms
()
+ public Flux<ChatRoom> read()
{
JavaType type = mapper.getTypeFactory().constructType(ChatRoomTo.class);
return Flux
{
JavaType type = mapper.getTypeFactory().constructType(ChatRoomTo.class);
return Flux
@@
-110,7
+110,6
@@
public class FileStorageStrategy implements StorageStrategy
bufferSize));
}
bufferSize));
}
- @Override
public void writeMessages(ChatRoomTo chatroomTo, Flux<Message> messageFlux)
{
Path path = chatroomPath(chatroomTo);
public void writeMessages(ChatRoomTo chatroomTo, Flux<Message> messageFlux)
{
Path path = chatroomPath(chatroomTo);
@@
-169,7
+168,6
@@
public class FileStorageStrategy implements StorageStrategy
}
}
}
}
- @Override
public Flux<Message> readMessages(ChatRoomTo chatroomTo)
{
JavaType type = mapper.getTypeFactory().constructType(MessageTo.class);
public Flux<Message> readMessages(ChatRoomTo chatroomTo)
{
JavaType type = mapper.getTypeFactory().constructType(MessageTo.class);