Skip to content

Commit

Permalink
Module and package structure (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok authored Sep 23, 2023
1 parent e53c0c9 commit 68eed46
Show file tree
Hide file tree
Showing 146 changed files with 833 additions and 764 deletions.
8 changes: 4 additions & 4 deletions .dx/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ prefs: turing

lib_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs')[:7] }}"
lib_cids:
client: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/client')[:7] }}"
signatures: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/signatures')[:7] }}"
construction: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/construction')[:7] }}"
data: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/data')[:7] }}"
storage: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/storage')[:7] }}"
essentials: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/essentials')[:7] }}"
messaging: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/messaging')[:7] }}"
testing: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/testing')[:7] }}"
app_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps')[:7] }}"
app_cids:
foo: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:apps/foo')[:7] }}"
foo: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps/foo')[:7] }}"
schema_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas')[:7] }}"
schema_cids:
postgres: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas/postgres')[:7] }}"
Expand Down Expand Up @@ -52,4 +52,4 @@ stack_images:
docker_entity: "{{ 'image' if image_repo == 'local' else 'manifest' }}"

app_deps:
foo: [essentials, construction, client, messaging, data]
foo: [essentials, construction, signatures, messaging, storage]
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
schedule:
interval: "daily"
groups:
SpringFramework:
spring-framework:
patterns:
- "org.springframework*"
- package-ecosystem: "maven"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pipeline-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
- main
paths: # waiting for https://github.com/actions/runner/issues/2324
- .dx/**
- tools/**
- .environs/**
- .github/**
- tools/**
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion apps/foo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ COPY app-foo*.jar foo/app.jar
ENTRYPOINT [ \
"java", "-cp", "foo/app.jar:foo/libs/*", \
"-Dconfig.file=foo/application.conf", \
"smecalculus.bezmen.construction.spec.App" \
"smecalculus.bezmen.construction.App" \
]
7 changes: 1 addition & 6 deletions apps/foo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,13 @@
<groupId>${project.groupId}</groupId>
<artifactId>construction</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>client</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>messaging</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data</artifactId>
<artifactId>storage</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package smecalculus.bezmen.construction.spec;
package smecalculus.bezmen.construction;

import static smecalculus.bezmen.configuration.spec.OrmMode.MY_BATIS;
import static smecalculus.bezmen.configuration.spec.OrmMode.SPRING_DATA;
import static smecalculus.bezmen.configuration.spec.WebMode.SPRING_MVC;
import static smecalculus.bezmen.configuration.OrmMode.MY_BATIS;
import static smecalculus.bezmen.configuration.OrmMode.SPRING_DATA;
import static smecalculus.bezmen.configuration.WebMode.SPRING_MVC;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
Expand All @@ -24,25 +24,25 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import smecalculus.bezmen.data.impl.SepulkaDaoMyBatis;
import smecalculus.bezmen.data.impl.SepulkaDaoSpringData;
import smecalculus.bezmen.data.spec.SepulkaDao;
import smecalculus.bezmen.data.spec.SepulkaRecMapper;
import smecalculus.bezmen.data.spec.SepulkaRecMapperImpl;
import smecalculus.bezmen.data.spec.mybatis.SepulkaSqlMapper;
import smecalculus.bezmen.data.spec.springdata.SepulkaRepository;
import smecalculus.bezmen.domain.impl.SepulkaConverterImpl;
import smecalculus.bezmen.domain.impl.SepulkaServiceImpl;
import smecalculus.bezmen.domain.spec.SepulkaConverter;
import smecalculus.bezmen.domain.spec.SepulkaService;
import smecalculus.bezmen.messaging.impl.SepulkaClientImpl;
import smecalculus.bezmen.messaging.impl.springmvc.SepulkaController;
import smecalculus.bezmen.messaging.spec.SepulkaClient;
import smecalculus.bezmen.messaging.spec.SepulkaMsgMapper;
import smecalculus.bezmen.messaging.spec.SepulkaMsgMapperImpl;
import smecalculus.bezmen.validation.spec.BezmenValidator;
import smecalculus.bezmen.core.SepulkaConverter;
import smecalculus.bezmen.core.SepulkaConverterImpl;
import smecalculus.bezmen.core.SepulkaService;
import smecalculus.bezmen.core.SepulkaServiceImpl;
import smecalculus.bezmen.messaging.SepulkaClientImpl;
import smecalculus.bezmen.messaging.SepulkaMsgMapper;
import smecalculus.bezmen.messaging.SepulkaMsgMapperImpl;
import smecalculus.bezmen.messaging.client.SepulkaClient;
import smecalculus.bezmen.messaging.springmvc.SepulkaController;
import smecalculus.bezmen.storage.SepulkaDao;
import smecalculus.bezmen.storage.SepulkaDaoMyBatis;
import smecalculus.bezmen.storage.SepulkaDaoSpringData;
import smecalculus.bezmen.storage.SepulkaRecMapper;
import smecalculus.bezmen.storage.SepulkaRecMapperImpl;
import smecalculus.bezmen.storage.mybatis.SepulkaSqlMapper;
import smecalculus.bezmen.storage.springdata.SepulkaRepository;
import smecalculus.bezmen.validation.EdgeValidator;

@Import({ConfigBeans.class, ValidationBeans.class, MessagingBeans.class, DataBeans.class})
@Import({ConfigBeans.class, ValidationBeans.class, MessagingBeans.class, StorageBeans.class})
@EnableAutoConfiguration(
exclude = {
LiquibaseAutoConfiguration.class,
Expand Down Expand Up @@ -80,7 +80,7 @@ SepulkaMsgMapper sepulkaMsgMapper() {
}

@Bean
SepulkaClient sepulkaClient(BezmenValidator validator, SepulkaService service, SepulkaConverter converter) {
SepulkaClient sepulkaClient(EdgeValidator validator, SepulkaService service, SepulkaConverter converter) {
return new SepulkaClientImpl(validator, service, converter);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package smecalculus.bezmen.core;

import smecalculus.bezmen.messaging.client.SepulkaRegRes;

public class SepulkaConverterImpl implements SepulkaConverter {
public SepulkaRegRes toRegRes(Sepulka sepulka) {
return new SepulkaRegRes(sepulka.id(), sepulka.name());
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package smecalculus.bezmen.domain.impl;
package smecalculus.bezmen.core;

import static java.util.UUID.randomUUID;

import java.util.List;
import lombok.NonNull;
import smecalculus.bezmen.data.spec.SepulkaDao;
import smecalculus.bezmen.domain.spec.Sepulka;
import smecalculus.bezmen.domain.spec.SepulkaService;
import smecalculus.bezmen.messaging.spec.SepulkaRegReq;
import smecalculus.bezmen.messaging.client.SepulkaRegReq;
import smecalculus.bezmen.storage.SepulkaDao;

public record SepulkaServiceImpl(@NonNull SepulkaDao sepulkaDao) implements SepulkaService {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package smecalculus.bezmen.messaging;

import lombok.NonNull;
import smecalculus.bezmen.core.Sepulka;
import smecalculus.bezmen.core.SepulkaConverter;
import smecalculus.bezmen.core.SepulkaService;
import smecalculus.bezmen.messaging.client.SepulkaClient;
import smecalculus.bezmen.messaging.client.SepulkaRegReq;
import smecalculus.bezmen.messaging.client.SepulkaRegRes;
import smecalculus.bezmen.validation.EdgeValidator;

public record SepulkaClientImpl(
@NonNull EdgeValidator validator, @NonNull SepulkaService service, @NonNull SepulkaConverter converter)
implements SepulkaClient {

@Override
public SepulkaRegRes register(SepulkaRegReq request) {
validator.validate(request);
Sepulka sepulka = service.register(request);
return converter.toRegRes(sepulka);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package smecalculus.bezmen.messaging.spec;
package smecalculus.bezmen.messaging;

import org.mapstruct.Mapper;
import smecalculus.bezmen.messaging.client.SepulkaRegReq;
import smecalculus.bezmen.messaging.client.SepulkaRegRes;

@Mapper
public interface SepulkaMsgMapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package smecalculus.bezmen.messaging.spec;
package smecalculus.bezmen.messaging;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package smecalculus.bezmen.messaging.spec;
package smecalculus.bezmen.messaging;

import lombok.Data;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package smecalculus.bezmen.messaging.impl.springmvc;
package smecalculus.bezmen.messaging.springmvc;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import smecalculus.bezmen.messaging.spec.SepulkaClient;
import smecalculus.bezmen.messaging.spec.SepulkaMsgMapper;
import smecalculus.bezmen.messaging.spec.SepulkaRegReq;
import smecalculus.bezmen.messaging.spec.SepulkaRegReqMsg;
import smecalculus.bezmen.messaging.spec.SepulkaRegRes;
import smecalculus.bezmen.messaging.spec.SepulkaRegResMsg;
import smecalculus.bezmen.messaging.SepulkaMsgMapper;
import smecalculus.bezmen.messaging.SepulkaRegReqMsg;
import smecalculus.bezmen.messaging.SepulkaRegResMsg;
import smecalculus.bezmen.messaging.client.SepulkaClient;
import smecalculus.bezmen.messaging.client.SepulkaRegReq;
import smecalculus.bezmen.messaging.client.SepulkaRegRes;

@RestController
@RequestMapping("sepulkas")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package smecalculus.bezmen.data.spec;
package smecalculus.bezmen.storage;

import java.util.List;
import java.util.UUID;
import smecalculus.bezmen.domain.spec.Sepulka;
import smecalculus.bezmen.core.Sepulka;

public interface SepulkaDao {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package smecalculus.bezmen.data.impl;
package smecalculus.bezmen.storage;

import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.UUID;
import lombok.NonNull;
import smecalculus.bezmen.data.spec.SepulkaDao;
import smecalculus.bezmen.data.spec.SepulkaRec;
import smecalculus.bezmen.data.spec.SepulkaRecMapper;
import smecalculus.bezmen.data.spec.mybatis.SepulkaSqlMapper;
import smecalculus.bezmen.domain.spec.Sepulka;
import smecalculus.bezmen.core.Sepulka;
import smecalculus.bezmen.storage.mybatis.SepulkaSqlMapper;

public record SepulkaDaoMyBatis(@NonNull SepulkaRecMapper recMapper, @NonNull SepulkaSqlMapper sqlMapper)
implements SepulkaDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package smecalculus.bezmen.data.impl;
package smecalculus.bezmen.storage;

import static java.util.stream.Collectors.toList;
import static java.util.stream.StreamSupport.stream;

import java.util.List;
import java.util.UUID;
import lombok.NonNull;
import smecalculus.bezmen.data.spec.SepulkaDao;
import smecalculus.bezmen.data.spec.SepulkaRec;
import smecalculus.bezmen.data.spec.SepulkaRecMapper;
import smecalculus.bezmen.data.spec.springdata.SepulkaRepository;
import smecalculus.bezmen.domain.spec.Sepulka;
import smecalculus.bezmen.core.Sepulka;
import smecalculus.bezmen.storage.springdata.SepulkaRepository;

public record SepulkaDaoSpringData(@NonNull SepulkaRecMapper mapper, @NonNull SepulkaRepository repository)
implements SepulkaDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package smecalculus.bezmen.data.spec;
package smecalculus.bezmen.storage;

import lombok.Data;
import org.springframework.data.annotation.Id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package smecalculus.bezmen.data.spec;
package smecalculus.bezmen.storage;

import org.mapstruct.Mapper;
import smecalculus.bezmen.domain.spec.Sepulka;
import smecalculus.bezmen.core.Sepulka;

@Mapper
public interface SepulkaRecMapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package smecalculus.bezmen.data.spec.mybatis;
package smecalculus.bezmen.storage.mybatis;

import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import smecalculus.bezmen.data.spec.SepulkaRec;
import smecalculus.bezmen.storage.SepulkaRec;

public interface SepulkaSqlMapper {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package smecalculus.bezmen.data.spec.springdata;
package smecalculus.bezmen.storage.springdata;

import org.springframework.data.repository.CrudRepository;
import smecalculus.bezmen.data.spec.SepulkaRec;
import smecalculus.bezmen.storage.SepulkaRec;

public interface SepulkaRepository extends CrudRepository<SepulkaRec, String> {}
Loading

0 comments on commit 68eed46

Please sign in to comment.