Skip to content

Commit d14a684

Browse files
committed
Finalize the README and LICENSE files
1 parent c4bac28 commit d14a684

File tree

10 files changed

+100
-12
lines changed

10 files changed

+100
-12
lines changed

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2022] Chamal Peiris. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Simple Text Edior Application
2+
3+
4+
5+
6+
** With this basic ORM framework, you can create tables in the database without the use of any SQL queries**
7+
8+
9+
### How to use this repo?
10+
11+
1. Clone the repository first 'git clone'
12+
13+
``https://github.com/Chamal-Peiris/basic-orm-framework.git``
14+
15+
2. Once cloned, open the repository from any prefered IDE
16+
17+
3. Use Maven as the build tool
18+
19+
4. Refresh the pom.xml
20+
21+
22+
### Prerequisites
23+
1. Use JDK 1.8
24+
25+
26+
27+
## Usage
28+
29+
* You can easily use the framework to create tables,databases without any SQL queries
30+
31+
32+
### License
33+
34+
Version 1.0.0 ,30 May 2022
35+
36+
Copyright © 2022 Chamal Peiris. All rights reserved.
37+
38+
Licensed under the [MIT](LICENSE) license
39+
40+
## Acknowledgements
41+
42+
* [Choose an Open Source License](https://choosealicense.com)

src/main/java/lk/ijse/dep8/orm/annotations/DepSessionFactory.java renamed to src/main/java/lk/ijse/dep8/orm/DepSessionFactory.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
package lk.ijse.dep8.orm.annotations;
1+
package lk.ijse.dep8.orm;
2+
3+
import lk.ijse.dep8.orm.annotations.Entity;
4+
import lk.ijse.dep8.orm.annotations.Id;
25

36
import java.lang.annotation.Annotation;
47
import java.lang.reflect.Field;
@@ -8,31 +11,60 @@
811
import java.util.ArrayList;
912
import java.util.List;
1013

14+
/**
15+
* DepSessionfactory is the starting porn of the ORM
16+
*
17+
* @author chamal-peiris
18+
* @since 1.0.0
19+
*/
20+
1121

1222
public class DepSessionFactory {
1323
private final List<Class<?>> entityClassList = new ArrayList<>();
1424
private Connection connection;
1525

26+
/**
27+
*Add classes that have benn annotated with <code>@Entity</code> annotation
28+
* @param entityClass
29+
* @return DepSessionFactory
30+
* @throws RuntimeException if the class is not annotated with <code>@Entity</code> annotation
31+
*/
32+
1633
public DepSessionFactory addAnnotatedClass(Class<?> entityClass){
1734
if (entityClass.getDeclaredAnnotation(Entity.class) == null){
1835
throw new RuntimeException("Invalid entity class");
1936
}
2037
entityClassList.add(entityClass);
2138
return this;
2239
}
23-
40+
/**
41+
* Set the connection
42+
* @return connection set to initialize jdbc connection
43+
* @return DepSessionFactory
44+
*/
2445
public DepSessionFactory setConnection(Connection connection){
2546
this.connection = connection;
2647
return this;
2748
}
2849

50+
/**
51+
* validate whether eberything works okay
52+
*
53+
* @return DepSessionFactory
54+
* @throws RuntimeException
55+
*/
2956
public DepSessionFactory build(){
3057
if (this.connection == null){
3158
throw new RuntimeException("Failed to build without a connection");
3259
}
3360
return this;
3461
}
3562

63+
/**
64+
* Bootstrap the ORM framework and create tables
65+
*
66+
* @throws SQLException
67+
*/
3668
public void bootstrap() throws SQLException {
3769
for (Class<?> entity : entityClassList) {
3870
String tableName = entity.getDeclaredAnnotation(Entity.class).value();

src/test/java/lk/ijse/dep8/orm/annotations/DepSessionFactoryTest.java

Lines changed: 0 additions & 7 deletions
This file was deleted.
-1.14 KB
Binary file not shown.
-18 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven
2-
#Mon May 30 19:28:18 IST 2022
2+
#Mon May 30 21:07:28 IST 2022
33
version=1.0.0
44
groupId=lk.ijse.dep8
55
artifactId=simple-orm-framework
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
lk/ijse/dep8/orm/annotations/Id.class
2-
lk/ijse/dep8/orm/annotations/Bootstrap.class
32
lk/ijse/dep8/orm/annotations/Entity.class
3+
lk/ijse/dep8/orm/DepSessionFactory.class
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
/home/chamals-pc/Desktop/IJSE DEP/phase-3/annotations/src/main/java/lk/ijse/dep8/orm/annotations/Bootstrap.java
1+
/home/chamals-pc/Desktop/IJSE DEP/phase-3/annotations/src/main/java/lk/ijse/dep8/orm/DepSessionFactory.java
22
/home/chamals-pc/Desktop/IJSE DEP/phase-3/annotations/src/main/java/lk/ijse/dep8/orm/annotations/Entity.java
33
/home/chamals-pc/Desktop/IJSE DEP/phase-3/annotations/src/main/java/lk/ijse/dep8/orm/annotations/Id.java
1.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)