Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Hexagonal Architecture #71

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmolecules-architecture</artifactId>
<groupId>org.jmolecules</groupId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>jmolecules-cqrs-architecture</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmolecules-architecture</artifactId>
<groupId>org.jmolecules</groupId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>jmolecules-layered-architecture</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmolecules-architecture</artifactId>
<groupId>org.jmolecules</groupId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>jmolecules-onion-architecture</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jmolecules.architecture.onion.hexagonal;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Identifies the {@link CoreLogic} in an hexagonal architecture.
* The core logic, or business logic, of an application consists of the algorithms that are essential to its purpose.
* They implement the use cases that are the heart of the application.
* All dependencies are in the direction of the core logic. The core itself does not depend on anything.
*
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE })
@Documented
public @interface CoreLogic {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jmolecules.architecture.onion.hexagonal;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Identifies the {@link InputPort} in an hexagonal architecture.
* An inbound port defines the exposure of the core’s functionality.
* These interfaces define how the Core Business Logic can be used. This is the only part of the core exposed to the outside world.
*
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE })
@Documented
public @interface InputPort {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jmolecules.architecture.onion.hexagonal;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Identifies the {@link OutputPort} in an hexagonal architecture.
* An outbound port define the core’s view of the outside world. This are the interface the core need to communicate with the outside world.
*
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE })
@Documented
public @interface OutputPort {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jmolecules.architecture.onion.hexagonal;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Identifies the {@link PrimaryAdapter} in an hexagonal architecture.
* It is also known as Driving adapters because they drive the application, and start actions in the core application.
* These adapters can use the inbound ports (interfaces) provided by the core application. The controllers then depends on these interfaces of the core business logic.
*
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE })
@Documented
public @interface PrimaryAdapter {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jmolecules.architecture.onion.hexagonal;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Identifies the {@link SecondaryAdapter} in an hexagonal architecture.
* It is also known as Driven Adapters and represents the connection to your back-end (databases, external libs, network communication, etc.
* These adapters react to actions iniated by the primary adapters. The secondary adapters are implementations of the outbound port.
* Which in return depend on interfaces of these external libraries and tools to transform them, so the core application can use these without being coupled to them.
*
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE })
@Documented
public @interface SecondaryAdapter {
}
2 changes: 1 addition & 1 deletion jmolecules-architecture/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmolecules</artifactId>
<groupId>org.jmolecules</groupId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>jmolecules-architecture</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmolecules-ddd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jmolecules</groupId>
<artifactId>jmolecules</artifactId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>jmolecules-ddd</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmolecules-events/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jmolecules</groupId>
<artifactId>jmolecules</artifactId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>jmolecules-events</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jmolecules</groupId>
<artifactId>jmolecules</artifactId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>jMolecules</name>
Expand Down Expand Up @@ -222,7 +222,7 @@
<url>https://github.com/xmolecules/jmolecules</url>
<connection>scm:git:https://github.com/xmolecules/jmolecules</connection>
<developerConnection>scm:git:ssh://git@github.com/xmolecules/jmolecules.git</developerConnection>
<tag>1.4.0</tag>
<tag>HEAD</tag>
</scm>

</project>
4 changes: 2 additions & 2 deletions readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Release binaries are available from the Maven central repository.
<dependency>
<groupId>org.jmolecules</groupId>
<artifactId>jmolecules-ddd</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
</dependency>
----

Expand All @@ -167,7 +167,7 @@ repositories {
mavenCentral()
}
dependencies {
implementation("org.jmolecules:jmolecules-ddd:1.3.0")
implementation("org.jmolecules:jmolecules-ddd:1.4.0")
}
----

Expand Down