Skip to content

Commit

Permalink
change according to cgeckstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Besok committed Nov 10, 2019
1 parent 74c7273 commit de56cbb
Show file tree
Hide file tree
Showing 27 changed files with 825 additions and 714 deletions.
4 changes: 2 additions & 2 deletions saga/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: pattern
title: Saga
folder: Communication
folder: saga
permalink: /patterns/saga/
categories: Behavioral
tags:
Expand Down Expand Up @@ -43,4 +43,4 @@ Use the Saga pattern, if:
- you can not use 2PC(two phase commit)

## Credits
- [pattern description](https://microservices.io/patterns/data/saga.html)
- [Pattern: Saga](https://microservices.io/patterns/data/saga.html)
33 changes: 17 additions & 16 deletions saga/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@
THE SOFTWARE.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.22.0-SNAPSHOT</version>
</parent>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.22.0-SNAPSHOT</version>
</parent>

<artifactId>saga</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<artifactId>saga</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,40 @@


/**
* Chapter is an interface representing a contract for an external service.
* ChoreographyChapter is an interface representing a contract for an external service.
* In that case, a service needs to make a decision what to do further
* hence the server needs to get all context representing {@link Saga}
* */
public interface Chapter {

/**
* In that case, every method is responsible to make a decision on what to do then
* @param saga incoming saga
* @return saga result
*/
Saga execute(Saga saga);

/**
* @return service name.
*/
String getName();

/**
* The operation executed in general case.
* @param saga incoming saga
* @return result {@link Saga}
*/
Saga process(Saga saga);

/**
* The operation executed in rollback case.
* @param saga incoming saga
* @return result {@link Saga}
*/
Saga rollback(Saga saga);
*/
public interface ChoreographyChapter {

/**
* In that case, every method is responsible to make a decision on what to do then
*
* @param saga incoming saga
* @return saga result
*/
Saga execute(Saga saga);

/**
* @return service name.
*/
String getName();

/**
* The operation executed in general case.
*
* @param saga incoming saga
* @return result {@link Saga}
*/
Saga process(Saga saga);

/**
* The operation executed in rollback case.
*
* @param saga incoming saga
* @return result {@link Saga}
*/
Saga rollback(Saga saga);


}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
* Class representing a service to book a fly
*/
public class FlyBookingService extends Service {
public FlyBookingService(ServiceDiscoveryService service) {
super(service);
}
public FlyBookingService(ServiceDiscoveryService service) {
super(service);
}

@Override
public String getName() {
return "booking a Fly";
}
@Override
public String getName() {
return "booking a Fly";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
* Class representing a service to book a hotel
*/
public class HotelBookingService extends Service {
public HotelBookingService(ServiceDiscoveryService service) {
super(service);
}
public HotelBookingService(ServiceDiscoveryService service) {
super(service);
}

@Override
public String getName() {
return "booking a Hotel";
}
@Override
public String getName() {
return "booking a Hotel";
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
/**
* Class representing a service to init a new order.
*/
public class OrderService extends Service{
public class OrderService extends Service {

public OrderService(ServiceDiscoveryService service) {
super(service);
}
public OrderService(ServiceDiscoveryService service) {
super(service);
}

@Override
public String getName() {
return "init an order";
}
@Override
public String getName() {
return "init an order";
}
}

0 comments on commit de56cbb

Please sign in to comment.