Package org.example.services
Class StorageService
- java.lang.Object
-
- org.example.services.StorageService
-
public class StorageService extends java.lang.Object
This class is a singleton, only one instance should exist at any time
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<User>
getAllRegisteredUsers()
Conversation
getConversation(User local, User remote)
static StorageService
getInstance()
static StorageService
getInstance(java.lang.String path)
java.lang.String
getPath()
java.util.List<User>
getUserFromPseudo(java.lang.String pseudo)
java.util.List<Message>
retrieveAllMessages()
void
save(Conversation conversation)
void
save(Message m)
void
save(User u)
-
-
-
Method Detail
-
getInstance
public static StorageService getInstance()
-
getInstance
public static StorageService getInstance(java.lang.String path)
-
save
public void save(@NotNull Conversation conversation) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
save
public void save(@NotNull Message m) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
save
public void save(@NotNull User u) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
retrieveAllMessages
public java.util.List<Message> retrieveAllMessages() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getConversation
public Conversation getConversation(@NotNull User local, @NotNull User remote) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getAllRegisteredUsers
public java.util.List<User> getAllRegisteredUsers() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getUserFromPseudo
public java.util.List<User> getUserFromPseudo(java.lang.String pseudo) throws java.sql.SQLException
- Parameters:
pseudo
-- Returns:
- a List with all the users found. An empty array if none where found
- Throws:
java.sql.SQLException
-
getPath
public java.lang.String getPath()
-
-