☕ Java & Kotlin edition
Welcome to the open source CAE CLI tool repository! The cae-cli is designed to make the experience of applying the cae-framework effortless. With one simple command you can generate the whole structure of a new use case in your Java or Kotlin project, already including its components throughout the application layers (core, adapters and assemblers).
State Symbol Key:
✅
— Under release state✔️
— Under snapshot state⏳
— Under full development state
- Clone the project.
- Run the
cae-cli-installer.exe
file. - Add
%CAE_CLI_HOME%
to your system's or user's Path environment variable. - To test the installation, open a command prompt and run
cae ls
.
Expected result:
- Clone the project
- Authorize file
cae-cli-macos-install.sh
to run withchmod +x cae-cli-macos-install.sh
- Run the
cae-cli-macos-installer.sh
in sudo mode. - Add theses exports on
.zshrc
or.bash_profile
file:
export CAE_CLI_HOME="$HOME/cae"
export CAE_META_STRUCTURE_TEMPLATES_PATH="$HOME/cae/file-templates"
- Restart terminal with
source ~/.zshrc
orsource ~/.bash_profile
- To test the installation, run
cae ls
Expected result:
To run any command (except for new-project
), you must be in the root directory of a CAE project. A CAE project is defined as a Java or Kotlin project that contains a cae-settings.json
file in its root directory. The format of this file is as follows:
{
"organization": "br.com.stockio",
"domain": "empresas",
"monolayer": true,
"caeVersion": "0.11.0",
"useCasePaths": [
{
"layer": "core",
"location": "src/main/java/br/com/stockio/empresas/core/use_cases"
},
{
"layer": "adapters",
"location": "src/main/java/br/com/stockio/empresas/adapters/use_cases"
},
{
"layer": "assemblers",
"location": "src/main/java/br/com/stockio/empresas/assemblers/use_cases"
}
]
}
organization
: your groupId.domain
: your artifactId.monolayer
: if the project is structured as a single unit or divided into smaller subprojects.caeVersion
: cae-framework version being currently used.useCasePaths
: paths the CLI will use to find use cases at the core, adapters and assemblers layers.
Run this command for creating a new FunctionUseCase
declaration in your CAE project.
Accepted parameters:
- name: the name of the use case.
- kotlin: whether or not it should be generated in Kotlin.
Expected effect:
├── core/ # Core layer package
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # The new use case package [JUST CREATED]
│ │ │ ├── SomeExampleUseCase.java/kt # Abstract class for the primary port of the new use case [JUST CREATED]
│ │ │ ├── implementations/ # Package for the implementation of the new use case [JUST CREATED]
│ │ │ │ └── SomeExampleUseCaseImplementation.java/kt # Implementation class of the new use case [JUST CREATED]
│ │ │ ├── io/ # Package for the I/O declaration of the use case [JUST CREATED]
│ │ │ │ ├── inputs/ # Package for input classes [JUST CREATED]
│ │ │ │ │ └── SomeExampleUseCaseInput.java/kt # Main input class for the new use case [JUST CREATED]
│ │ │ │ └── output/ # Package for output classes [JUST CREATED]
│ │ │ │ └── SomeExampleUseCaseOutput.java/kt # Main output class for the new use case [JUST CREATED]
├── adapters/ # Adapters layer package
│ ├── use_cases/ # Use cases package
│ │ └── some_example/ # Package for the new use case adapters (starts empty) [JUST CREATED]
├── assemblers/ # Assemblers layer
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # Package for assembling the new use case [JUST CREATED]
│ │ │ └── MyUseCaseAssembler.java/kt # Assembler class (Factory) for the use case [JUST CREATED]
Run this command for creating a new ConsumerUseCase
declaration in your CAE project.
Accepted parameters:
- name: the name of the use case.
- kotlin: whether or not it should be generated in Kotlin.
Expected effect:
├── core/ # Core layer package
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # The new use case package [JUST CREATED]
│ │ │ ├── SomeExampleUseCase.java/kt # Abstract class for the primary port of the new use case [JUST CREATED]
│ │ │ ├── implementations/ # Package for the implementation of the new use case [JUST CREATED]
│ │ │ │ └── SomeExampleUseCaseImplementation.java/kt # Implementation class of the new use case [JUST CREATED]
│ │ │ ├── io/ # Package for the I/O declaration of the use case [JUST CREATED]
│ │ │ │ ├── inputs/ # Package for input classes [JUST CREATED]
│ │ │ │ │ └── SomeExampleUseCaseInput.java/kt # Main input class for the new use case [JUST CREATED]
├── adapters/ # Adapters layer package
│ ├── use_cases/ # Use cases package
│ │ └── some_example/ # Package for the new use case adapters (starts empty) [JUST CREATED]
├── assemblers/ # Assemblers layer
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # Package for assembling the new use case [JUST CREATED]
│ │ │ └── MyUseCaseAssembler.java/kt # Assembler class (Factory) for the use case [JUST CREATED]
Run this command for creating a new SupplierUseCase
declaration in your CAE project.
Accepted parameters:
- name: the name of the use case.
- kotlin: whether or not it should be generated in Kotlin.
Expected effect:
├── core/ # Core layer package
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # The new use case package [JUST CREATED]
│ │ │ ├── SomeExampleUseCase.java/kt # Abstract class for the primary port of the new use case [JUST CREATED]
│ │ │ ├── implementations/ # Package for the implementation of the new use case [JUST CREATED]
│ │ │ │ └── SomeExampleUseCaseImplementation.java/kt # Implementation class of the new use case [JUST CREATED]
│ │ │ ├── io/ # Package for the I/O declaration of the use case [JUST CREATED]
│ │ │ │ ├── outputs/ # Package for output classes [JUST CREATED]
│ │ │ │ │ └── SomeExampleUseCaseOutput.java/kt # Main output class for the new use case [JUST CREATED]
├── adapters/ # Adapters layer package
│ ├── use_cases/ # Use cases package
│ │ └── some_example/ # Package for the new use case adapters (starts empty) [JUST CREATED]
├── assemblers/ # Assemblers layer
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # Package for assembling the new use case [JUST CREATED]
│ │ │ └── MyUseCaseAssembler.java/kt # Assembler class (Factory) for the use case [JUST CREATED]
Run this command for creating a new RunnableUseCase
declaration in your CAE project.
Accepted parameters:
- name: the name of the use case.
- kotlin: whether or not it should be generated in Kotlin.
Expected effect:
├── core/ # Core layer package
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # The new use case package [JUST CREATED]
│ │ │ ├── SomeExampleUseCase.java/kt # Abstract class for the primary port of the new use case [JUST CREATED]
│ │ │ ├── implementations/ # Package for the implementation of the new use case [JUST CREATED]
│ │ │ │ └── SomeExampleUseCaseImplementation.java/kt # Implementation class of the new use case [JUST CREATED]
├── adapters/ # Adapters layer package
│ ├── use_cases/ # Use cases package
│ │ └── some_example/ # Package for the new use case adapters (starts empty) [JUST CREATED]
├── assemblers/ # Assemblers layer
│ ├── use_cases/ # Use cases package
│ │ ├── some_example/ # Package for assembling the new use case [JUST CREATED]
│ │ │ └── MyUseCaseAssembler.java/kt # Assembler class (Factory) for the use case [JUST CREATED]
Run this command for creating a new CAE project.
Accepted parameters:
- artifactId: the name of the project.
- groupId: name of the organization which owns the project.
- caeVersion: the desired cae-framework version.
Expected effect:
- A monolayer project with 3 main packages: core, adapters and assemblers. Multilayer project generation is suspended via CLI.
- A
cae-settings.json
file created and properly set. - The
pom.xml
file created and properly set, including the script for the autodocumentation. - The
LoggerBootstrap.java
file with default settings for the automatic logging mechanism (feel free to change it). - The
LoggerAdapter.java
file which implements theLogger
interface from the framework and adapts it for theSlf4j
format (feel free to change it too). - The
${artifactId}Documentation.java
file which is invoked by the Maven Install phase due to thepom.xml
settings for the autodocumentation process.
Tutorials will soon be available on the SDK's YouTube channel: Clean Arch Enablers SDK.
✔️
cae-framework✔️
cae-utils-mapped-exceptions✔️
cae-utils-http-client✔️
cae-common-primary-adapters✔️
cae-utils-env-vars✔️
cae-utils-trier✔️
cae-rdb⏳
cae-service-catalog
CAE — Clean Architecture made easy.