Skip to content

Commit 39a693d

Browse files
committed
feat: implement dao factory
1 parent 0f37b4e commit 39a693d

18 files changed

+224
-0
lines changed

dao-factory/README.md

Whitespace-only changes.

dao-factory/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.iluwatar</groupId>
8+
<artifactId>java-design-patterns</artifactId>
9+
<version>1.26.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>dao-factory</artifactId>
13+
14+
<properties>
15+
<maven.compiler.source>21</maven.compiler.source>
16+
<maven.compiler.target>21</maven.compiler.target>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
</properties>
19+
20+
</project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:22
8+
* Filename : Customer
9+
*/public class Customer {
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:16
8+
* Filename : CustomerDAO
9+
*/public interface CustomerDAO {
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:16
8+
* Filename : DAOFactory
9+
*/public interface DAOFactory {
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 17/04/2025
7+
* Time : 00:21
8+
* Filename : DataSourceEnum
9+
*/
10+
public class DataSourceEnum {
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:25
8+
* Filename : FlatFileCustomerDAO
9+
*/
10+
public class FlatFileCustomerDAO {
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:19
8+
* Filename : FlatFileDataSourceFactory
9+
*/public class FlatFileDataSourceFactory {
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:26
8+
* Filename : H2CustomerDAO
9+
*/public class H2CustomerDAO {
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:18
8+
* Filename : H2DataSourceFactory
9+
*/public class H2DataSourceFactory {
10+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.iluwatar.daofactory;
2+
3+
import org.dizitart.no2.collection.Document;
4+
import java.util.Optional;
5+
6+
/**
7+
* Created by: IntelliJ IDEA
8+
* User : dthanh
9+
* Date : 16/04/2025
10+
* Time : 23:26
11+
* Filename : NitriteCustomerDAO
12+
*/
13+
public class MongoCustomerDAO implements CustomerDAO {
14+
@Override
15+
public void save(Customer customer) {
16+
17+
}
18+
19+
@Override
20+
public void update(Customer customer) {
21+
22+
}
23+
24+
@Override
25+
public void delete(Long id) {
26+
27+
}
28+
29+
@Override
30+
public Optional<Customer> findById(Long id) {
31+
return Optional.empty();
32+
}
33+
34+
// @Override
35+
// public List<Customer> findAll() {
36+
// return List.of();
37+
// }
38+
//
39+
// @Override
40+
// public Optional<Customer> findById(Long id) {
41+
// return Optional.empty();
42+
// }
43+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 16/04/2025
7+
* Time : 23:19
8+
* Filename : NitriteDataSourceFactory
9+
*/
10+
public class MongoDataSourceFactory extends DAOFactory {
11+
@Override
12+
public CustomerDAO getCustomerDAO() {
13+
return new MongoCustomerDAO();
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 21/04/2025
7+
* Time : 01:02
8+
* Filename : AppTest
9+
*/public class AppTest {
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 21/04/2025
7+
* Time : 01:03
8+
* Filename : CustomerTest
9+
*/
10+
public class CustomerTest {
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 21/04/2025
7+
* Time : 01:01
8+
* Filename : DAOFactoryTest
9+
*/
10+
public class DAOFactoryTest {
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 21/04/2025
7+
* Time : 01:05
8+
* Filename : FlatFileCustomerDAOTest
9+
*/public class FlatFileCustomerDAOTest {
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 21/04/2025
7+
* Time : 01:05
8+
* Filename : H2CustomerDAOTest
9+
*/
10+
public class H2CustomerDAOTest {
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.iluwatar.daofactory;
2+
3+
/**
4+
* Created by: IntelliJ IDEA
5+
* User : dthanh
6+
* Date : 21/04/2025
7+
* Time : 01:05
8+
* Filename : MongoCustomerDAOTest
9+
*/
10+
public class MongoCustomerDAOTest {
11+
}

0 commit comments

Comments
 (0)