Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhona committed Mar 25, 2022
1 parent e208fac commit c464a05
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.dal.distributeddatabase</groupId>
<artifactId>DistributedDatabase</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>

</project>
7 changes: 7 additions & 0 deletions src/main/java/com/dal/distributed/authentication/Login.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.dal.distributed.authentication;

public class Login {

public void accessSystem() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.dal.distributed.authentication;

public class Registration {

public void registerUser() {
}
}
33 changes: 33 additions & 0 deletions src/main/java/com/dal/distributed/logger/Logger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.dal.distributed.logger;

public class Logger {

private static Logger instance = null;

private Logger() {

}

/**
* This method returns the object of PrintMessage.
*
* @return PrintMessage singleton object
*/
public static Logger instance() {
if (null == instance) {
return new Logger();
} else {
return instance;
}
}

public void info(String message) {
System.out.println(message);
//To Do: Write to info log file
}

public void error(String message) {
System.err.println(message);
//To Do: Write to error log file
}
}
40 changes: 40 additions & 0 deletions src/main/java/com/dal/distributed/main/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.dal.distributed.main;

import com.dal.distributed.authentication.Login;
import com.dal.distributed.authentication.Registration;
import com.dal.distributed.logger.Logger;

import java.util.Scanner;

public class Main {

public static void main(String [] args) {
Logger logger = Logger.instance();

logger.info("Welcome to DPG9 Distributed Database\n");
logger.info("Please select an option from the below list");
logger.info("1. User Registration");
logger.info("2. Login");
logger.info("3. Exit");

Scanner sc = new Scanner(System.in);
final String userInput = sc.nextLine();

while (true) {
switch (userInput) {
case "1":
Registration registration = new Registration();
registration.registerUser();
break;
case "2":
Login login = new Login();
login.accessSystem();
break;
case "3":
System.exit(0);
default:
logger.error("Please enter a valid input.");
}
}
}
}
22 changes: 22 additions & 0 deletions src/main/java/com/dal/distributed/model/SecurityQuestions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.dal.distributed.model;

public class SecurityQuestions {
private String question;
private String answer;

public String getQuestion() {
return question;
}

public void setQuestion(String question) {
this.question = question;
}

public String getAnswer() {
return answer;
}

public void setAnswer(String answer) {
this.answer = answer;
}
}
33 changes: 33 additions & 0 deletions src/main/java/com/dal/distributed/model/UserRegistration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.dal.distributed.model;

import java.util.List;

public class UserRegistration {
private String username;
private String password;
private List<SecurityQuestions> securityQuestions;

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public List<SecurityQuestions> getSecurityQuestions() {
return securityQuestions;
}

public void setSecurityQuestions(List<SecurityQuestions> securityQuestions) {
this.securityQuestions = securityQuestions;
}
}

0 comments on commit c464a05

Please sign in to comment.