-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4e3ea3
commit 238c190
Showing
28 changed files
with
432 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#db implementation: Postgres, Oracle, MongoDB, Derby | ||
#use Derby if you run Unit tests and have no Postgres and Oracle installed on you laptop | ||
#in this case the Derby In-Memory database will be created and used during | ||
#the UnitTest execution | ||
db.implementation=MongoDB | ||
|
||
# names of input files | ||
input.files=test.xlsx | ||
|
||
|
||
# postgres connection parameters | ||
db.server=localhost | ||
db.database=excel2db | ||
db.port=5433 | ||
db.user=postgres | ||
db.password=postgres | ||
|
||
# oracle connection parameters | ||
db.oracle.server=localhost | ||
# specify sid or SERVICE NAME here | ||
db.oracle.sid=xe | ||
db.oracle.port=1521 | ||
db.oracle.user=oracle | ||
db.oracle.password=oracle | ||
|
||
# mongo connection parameters | ||
db.mongo.server=localhost | ||
db.mongo.database=test | ||
db.mongo.port=27017 | ||
db.mongo.user=mongo | ||
db.mongo.password=mongo | ||
|
||
|
||
|
||
# DON'T TOUCH : | ||
# set db implementation classes based on the db.implementation | ||
dbConnectionImplenentation=excel2db.service.impl.DBConnection${db.implementation}Impl | ||
closeConnectionImplenentation=excel2db.service.impl.CloseConnection${db.implementation}Impl | ||
createTableImplenentation=excel2db.service.impl.CreateTable${db.implementation}Impl | ||
populateTableImplenentation=excel2db.service.impl.PopulateTable${db.implementation}Impl | ||
getFirstRowImplenentation=excel2db.service.impl.GetFirstRow${db.implementation}Impl | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package excel2db.service; | ||
|
||
import java.sql.SQLException; | ||
|
||
public interface CloseConnection { | ||
|
||
public void closeDBConnection() throws SQLException; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package excel2db.service; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import com.mongodb.MongoException; | ||
import com.mongodb.MongoWriteConcernException; | ||
|
||
public interface DBConnection { | ||
|
||
public void establishDBConnection() throws SQLException; | ||
public Boolean establishDBConnection() throws SQLException ; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package excel2db.service; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public interface GetFirstRow { | ||
|
||
public ResultSet getFirstRow (String tableName) throws SQLException; | ||
public JSONObject getFirstRow (String tableName) throws SQLException, JSONException; | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/excel2db/service/impl/CloseConnectionDerbyImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package excel2db.service.impl; | ||
|
||
import java.sql.SQLException; | ||
|
||
import excel2db.excel2db; | ||
import excel2db.service.CloseConnection; | ||
|
||
public class CloseConnectionDerbyImpl implements CloseConnection { | ||
|
||
@Override | ||
public void closeDBConnection() throws SQLException { | ||
excel2db.connection.close(); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/excel2db/service/impl/CloseConnectionMongoDBImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package excel2db.service.impl; | ||
|
||
import excel2db.excel2db; | ||
import excel2db.service.CloseConnection; | ||
|
||
/** | ||
* Created by Andrey on 8/15/2017. | ||
*/ | ||
public class CloseConnectionMongoDBImpl implements CloseConnection{ | ||
|
||
@Override | ||
public void closeDBConnection() { | ||
excel2db.mongoClient.close(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/excel2db/service/impl/CloseConnectionOracleImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package excel2db.service.impl; | ||
|
||
import java.sql.SQLException; | ||
|
||
import excel2db.excel2db; | ||
import excel2db.service.CloseConnection; | ||
|
||
/** | ||
* Created by Andrey on 8/15/2017. | ||
*/ | ||
public class CloseConnectionOracleImpl implements CloseConnection { | ||
|
||
@Override | ||
public void closeDBConnection() throws SQLException { | ||
excel2db.connection.close(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/excel2db/service/impl/CloseConnectionPostgresImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package excel2db.service.impl; | ||
|
||
import java.sql.SQLException; | ||
|
||
import excel2db.excel2db; | ||
import excel2db.service.CloseConnection; | ||
|
||
/** | ||
* Created by Andrey on 8/15/2017. | ||
*/ | ||
public class CloseConnectionPostgresImpl implements CloseConnection{ | ||
|
||
@Override | ||
public void closeDBConnection() throws SQLException { | ||
excel2db.connection.close(); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/excel2db/service/impl/CreateTableMongoDBImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package excel2db.service.impl; | ||
|
||
import com.mongodb.DBCollection; | ||
import com.mongodb.client.MongoDatabase; | ||
import excel2db.excel2db; | ||
import excel2db.service.CreateTable; | ||
import org.apache.poi.ss.usermodel.Sheet; | ||
import org.apache.poi.xwpf.usermodel.Document; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class CreateTableMongoDBImpl implements CreateTable { | ||
|
||
public static final Logger logger = LoggerFactory.getLogger(CreateTableMongoDBImpl.class); | ||
|
||
public void createTable(Sheet sheet, String tableName) { | ||
logger.info("MongoDB creates collections automatically while inserting documents"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.