-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing log4j2 yaml and DB connections
- Loading branch information
1 parent
27aa09d
commit f9e2c10
Showing
18 changed files
with
163 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea/ | ||
*/target | ||
logs/ |
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
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
12 changes: 12 additions & 0 deletions
12
generic-commands/src/main/java/com/file/monitoring/generic/commands/dao/NamesDAO.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,12 @@ | ||
package com.file.monitoring.generic.commands.dao; | ||
|
||
import com.file.monitoring.generic.commands.dto.Names; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface NamesDAO { | ||
int count(); | ||
List<Names> findAll(); | ||
Optional<Names> getNameById(long id); | ||
} |
47 changes: 47 additions & 0 deletions
47
...c-commands/src/main/java/com/file/monitoring/generic/commands/dao/mysql/NamesDAOImpl.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,47 @@ | ||
package com.file.monitoring.generic.commands.dao.mysql; | ||
|
||
import com.file.monitoring.generic.commands.dao.NamesDAO; | ||
import com.file.monitoring.generic.commands.dto.Names; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Primary; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Primary | ||
@Repository | ||
public class NamesDAOImpl implements NamesDAO { | ||
@Autowired | ||
private JdbcTemplate jdbcTemplate; | ||
|
||
@Override | ||
public int count() { | ||
return jdbcTemplate | ||
.queryForObject("SELECT COUNT(*) FROM Names", Integer.class); | ||
} | ||
|
||
@Override | ||
public List<Names> findAll() { | ||
return jdbcTemplate.query( | ||
"SELECT * FROM Names", | ||
(rs, rowNum) -> | ||
new Names( | ||
rs.getLong("id"), | ||
rs.getString("FName"), | ||
rs.getString("LName") | ||
) | ||
); | ||
} | ||
|
||
@Override | ||
public Optional<Names> getNameById(long id) { | ||
return jdbcTemplate.queryForObject("SELECT * FROM Names WHERE id = ?", (rs, rowNum) -> | ||
Optional.of(new Names( | ||
rs.getLong("id"), | ||
rs.getString("FName"), | ||
rs.getString("LName") | ||
)), id); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
generic-commands/src/main/java/com/file/monitoring/generic/commands/dto/Names.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 com.file.monitoring.generic.commands.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class Names { | ||
private long id; | ||
private String fName; | ||
private String lName; | ||
|
||
public Names(long id, String fName, String lName) { | ||
this.id = id; | ||
this.fName = fName; | ||
this.lName = lName; | ||
} | ||
} |
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
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
9 changes: 8 additions & 1 deletion
9
...ds/src/main/java/com/file/monitoring/generic/commands/processors/GenericProcessor5_1.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
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
21 changes: 13 additions & 8 deletions
21
...com/file/monitoring/generic/commands/processors/factory/GenericProcessorsFactoryImpl.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 |
---|---|---|
@@ -1,47 +1,52 @@ | ||
package com.file.monitoring.generic.commands.processors.factory; | ||
|
||
import com.file.monitoring.generic.commands.processors.*; | ||
import org.springframework.beans.factory.BeanFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class GenericProcessorsFactoryImpl implements GenericProcessorsFactory { | ||
@Autowired | ||
private BeanFactory beanFactory; | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor1_1() { | ||
return new GenericProcessor1_1(); | ||
return beanFactory.getBean(GenericProcessor1_1.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor1_2() { | ||
return new GenericProcessor1_2(); | ||
return beanFactory.getBean(GenericProcessor1_2.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor2_1() { | ||
return new GenericProcessor2_1(); | ||
return beanFactory.getBean(GenericProcessor2_1.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor3_1() { | ||
return new GenericProcessor3_1(); | ||
return beanFactory.getBean(GenericProcessor3_1.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor3_2() { | ||
return new GenericProcessor3_2(); | ||
return beanFactory.getBean(GenericProcessor3_2.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor4_1() { | ||
return new GenericProcessor4_1(); | ||
return beanFactory.getBean(GenericProcessor4_1.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor5_1() { | ||
return new GenericProcessor5_1(); | ||
return beanFactory.getBean(GenericProcessor5_1.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
|
||
@Override | ||
public GenericProcessor createGenericProcessor5_2() { | ||
return new GenericProcessor5_2(); | ||
return beanFactory.getBean(GenericProcessor5_2.class.getSimpleName(), GenericProcessor.class); | ||
} | ||
} |
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